tags:

views:

54

answers:

3

i have the following code....

For Each dgvRow In bout_grid.Rows
            vfile = dgvRow.Cells("FileName").Value
            video.FileName = "D:\bee\" + vfile

            vduration = video.Duration
            vposition = video.Position

            If vduration > 0 The
                bplayer_out.URL = "D:\bee\" + vfile
                bplayer_out.Ctlcontrols.play()
            End If

        Next dgvRow

but it plays only one video and than stops but i want that it should play every video in datagridview i.e bout_grid....i have tried

System.Threading.Thread.Sleep = vduration

but it stops every thing how can i solve it

A: 

What happens after bplayer_out.Ctlcontrols.play() finishes? A dialog pops up? An exception? Both these outcomes would halt the for each loop.

Run it with the debugger and see where the control returns after bplayer_out.Ctlcontrols.play()

Ando
when it finishes it stops playing and remain in stopped position...
Web Worm
If you close bplayer_out after finishing playing the video the control should return in the for each loop. It is just like opening a new (modal) message box - you cannot go continue until you dismiss the message box.If you do not want you for each loop to stop you should use a different thread for playing/queueing the videos to play.Or is there bplayer_out.Ctlcontrols.queueVideo method?
Ando
Maybe you can go through all the cells, construct the list of videos to play and pass this to bplayer_out.Ctlcontrols (the the behaviour should be that the player starts playing the first video and then continues with the second one - but this all depends on what is bossible with this bplayer (what type is it? :) ) )
Ando
A: 

It is very possible that bplayer_out.Ctlcontrols.play() is asynchronous, like with many other sound API's. It is therefore possible that next sound immediately plays while the first one is still busy - you might just hear the first one.

What type is bplayer?

Philip Fourie
+1  A: 

Yes, you can't make this kind of code work in a Windows Forms or WPF app. Windows apps are event driven, you can't program long loops without blocking UI updates.

Windows Media Player generates events when something significant happened. Like the PlayStateChange event. Write an event handler for that event to index to the next item in your list. Note that WMP also supports play lists.

Your ultimate resource for programming WMP in Visual Basic is this MSDN Library topic. Take a look at the provided samples.

Hans Passant