Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dose anyone know of a way to play 1 window media file in 3 to 4 players and
make then all start and stop at the same time?

What I want to do is play the same file in 3 or 4 players at the same time and
have them all start and stop at the same time.

Right now when I load them they display as soon as each player is ready and play.
Some times its player 1 that starts first, other times its player 3 and so on.

Is there a wait, command or something I can check to make sure each one is loaded and ready to play then start them all playing?

Thanks for any idea you might have...
Posted
Comments
Kenneth Haugland 26-Mar-13 18:13pm    
Why cant you just use one player and duplicate this?
Dr David Johnson PhD 26-Mar-13 20:54pm    
How can I make multiple duplicates of one player in vb?

You can play one file via DirectShow and use Inf Tee Filter on video stream with multiple video renderers, or use one VMR9/EVR with custom allocator presenter and present target surface on couple render targets at the same time. So you will need to control one graph and one file playback only for multiple view.
 
Share this answer
 
Comments
Dr David Johnson PhD 27-Mar-13 14:00pm    
Thanks for the help!!!!!

Duplicating players was kind of unstable and I was having a lot of problems
keeping the program running. However the suggestion of getting all the players
started and setting them to zero worked very well for my application!
Maxim Kartavenkov 27-Mar-13 14:10pm    
Actully, the best way from performance and sync position it is to use the allocator presenters with same Direct3D device and multiple render targets. But it require brief Direct3D knowledge and DirectShow.
You must have autoStart = true if playback starts as soon as a filename is assigned.

A technique for starting multiple players which seems to work (I'll claim nothing more than that) is
1) Start a player
2) Wait until the playing state is achieved
3) Repeat 1 and 2 for other players
4) Pause all players
5) Set the playback position of all players to 0
6) Restart play for all

Steps 4 and 6 are probably not required as synchronisation looks the same with them removed.

VB
Private Sub Start(filename As String)
    REM players are AxWMPLib.AxWindowsMediaPlayer

    player1.settings.autoStart = False
    player1.URL = filename

    player2.settings.autoStart = False
    player2.URL = filename

    player1.Ctlcontrols.play()
    While player1.playState <> WMPLib.WMPPlayState.wmppsPlaying
        Application.DoEvents()
        System.Threading.Thread.Sleep(20)
    End While

    player2.Ctlcontrols.play()
    While player2.playState <> WMPLib.WMPPlayState.wmppsPlaying
        Application.DoEvents()
        System.Threading.Thread.Sleep(20)
    End While
    
    REM synchronise the players
    player1.Ctlcontrols.pause()
    player2.Ctlcontrols.pause()
    player1.Ctlcontrols.currentPosition = 0.0
    player2.Ctlcontrols.currentPosition = 0.0
    player1.Ctlcontrols.play()
    player2.Ctlcontrols.play()
End Sub


You'll have to excuse the use of Application.DoEvents and the Sleep in this "proof of concept" code!

Alan.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900