LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need to control 2 Windows Media Players simultaneously!!

Hi to all,

I am using LV 7 and included two Media Player ActiveX controls to my vi. Now I want to control them simultaneously, like "Master Slave". If I start one of them the other should start too. The same should happen if I use the track bar.
Does anyone has an idea?

Thanks,

Henning
0 Kudos
Message 1 of 7
(3,569 Views)
Henning,

Take a look at the attached example I attached. I tried to show you a few methods, the main one being the ActiveX event call back. In this example I made the movies track each other, so that when you change the position of one, it changes the other. You could use the same idea to control thier starts, stops etc.

Evan
National Instruments
Message 2 of 7
(3,569 Views)
Evan,

thank you very much for your example! At the moment I am trying to find my way through it. I have never worked with these call back events before... However, it works quite fine but If I am scrolling in one Media Player after some time LV crashes! The ActivMovie Windows causes an error in LabVIEW.exe. Have you experienced the same problem? Could it be the kind of Video file I am using (e.g. AVI/MPEG, Codecs...)

Any further help would be appreciated!

Henning
0 Kudos
Message 3 of 7
(3,569 Views)
Hi, it is me again!
I just found out that this behaviour has nothing to with the codec or file format. It only happens if I scroll too quickly through in the Media Player. That means that there is a difference of one frame between the two players. Then LV crashes. Until now I have found no workaround...

Henning
0 Kudos
Message 4 of 7
(3,569 Views)
Try this version. I added a sempaphore so that the event is only being handled one at a time.

I also tried to add some comments to the code to explain it a little. In addition I have a global in there so that you can see what is happening in the callback VI. It has no funcitonal use, other than visualization.

Let me know if you have any questions about my method, I realize it is a little confusing. In addition I think the jerkiness of the video as you change the track is due to media player and I have not yet figured out how to get around it. You may need to add some code to pause the two while you the mouse is down on eitehr container, and then play them again on a mouse up.

Evan
National Instruments
0 Kudos
Message 5 of 7
(3,570 Views)
Hi Evan,

thanks a lot! Now it works great. I added some more code to your example and I think I understood what you did...

Have a nice day,

Henning
0 Kudos
Message 6 of 7
(3,569 Views)
Looks to me like you're using mplayer2.exe as the ActiveX component. Can you modify the example to work with WMP9? When I tried to modify the ActiveX assignments I got a number of method conflicts -- those I could sort out -- but the call back function I am not familiar with in LV.
0 Kudos
Message 7 of 7
(3,551 Views)