tags:

views:

85

answers:

1

I have list of video files in datagridview object, and I want to play it one after other

I have the following code

For Each dgvRow In bout_shedule.Rows
    vfile = dgvRow.Cells("VideoFile").value
    player.URL = vfile
    player.Ctlcontrols.play()
    System.Threading.Thread.Sleep(duration * 1000)
Next

I also have get the duration of video file; now I want the media player to play the first video and stops the loop; once it finishes playing video, than the loop continues to the 2nd row, but the nothing is going to play at all. How can I solve this problem ?

+2  A: 

One thing is for sure, when your application has events, don't go into a polling loop. Your video library interface should have a 'on stop' event that you need to register for. Your code is relying on the fact that the client isn't going to pause the video, or rewind.

You need to find a way to block till the video player object raises a stop event.

This is a link to the interface of the object you are using. It has a section for the events the player offers. You need to register for a certain event (events that represent stopping or the skip/forward button) and react to it. I can't explain further you should read the MSDN documentation or get a book on GUI programming.

Hassan Syed
so how can i use that event to loop through every video
Web Worm
could you please help me by showing a code sample....??
Web Worm
I need to see the interface of player.CtlControls , is this a standard .net object ?
Hassan Syed
it is a simple windows media player with uiMode = "None"
Web Worm
I have added an explanation.
Hassan Syed