From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling windows media player in labview

Solved!
Go to solution

Hi,

 

I am having difficulties controlling a WMP in LabVIEW using it's ActiveX controls... What i need to do is to have a control to to go from frame to frame. I made something but when i slide the crontroller, it suddenly hangs?

 

Also: when i play the video in mij windows media player, it opens normally, but when i open it in the labview activex control, the screen stays balck? I have an AVI file that is H.264 compressed and i've installed the latest k-lite codec pack.

 

I use a property Node (activeX) to adjust the controls "IWMPPlayer4" => "controls" -> IWMPControls => "current position".

 

Does anyone has experience with this?

Best regards,

Thijs Boeree

 

 

0 Kudos
Message 1 of 21
(9,455 Views)

I can see the video screen now... but when i scroll through time, it suddenly hangs...?

in the attachment the file...

 

0 Kudos
Message 2 of 21
(9,452 Views)

Hello Thijs,

 

Do you scroll thorugh time by using your Control?

 

When I do this with a sample avi of Windows Media Player (C:\Users\Public\Videos\Sample Videos\Wildlife.wmv), then it does seem to work.

 

Just to make sure we understand eachother correctly: What do you actually mean with "it suddenly hangs"?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 3 of 21
(9,427 Views)

Hi,

 

What i mean is: i made a controller on the frontpanel (slide bar) and when i control the "currentPosition" LabVIEW hangs after a certain amount of scrolling through the video? Maybe it's because of the video? I have a H.264 video.

 

I've attached a vi in the example.

 

Best regards and thanks for the help so far!

Thijs Boeree

0 Kudos
Message 4 of 21
(9,414 Views)

Hello Thijs,

 

With the first VI I was not able to reproduce the issue.

With this one I am able to reproduce the hanging.

 

I have slightly adapted your code to show you were it goes wrong. (see attachment)

 

You see that if you click on a certain point/position in the slider you only get one execution of the "slider value change" event case.

If you start sliding back and forth, then you have (very easily) several hundreds of executions of this event case.

 

This is what is causing your "hanging".

You also see that if you wait long enough, then you'll normally end up at the right position in the video.

 

So this is where you would have to change your design.

 

How do you actually want your design to follow the slider in LabVIEW?

Do you want it to detect all small changes to the slider?

Do you only want it to change after a significant change in slider value?

Do you want it to only change when you've stopped sliding?

 

Or do you want a combination of the things mentioned above?

 

The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at:

http://ni.com/samplecodelicense

 

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 5 of 21
(9,393 Views)

Hi,

 

Thank you, this is what the programm should do:

 

Open an EMG file (Electromyography)

Open a video file, which was simultaneously recorded

 

Then when you scroll through the data of the EMG, the video should also move along.

 

Best regards,

Thijs Boeree

0 Kudos
Message 6 of 21
(9,386 Views)

Hello Thijs,

 

Is this more what you are looking for?

 

The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 7 of 21
(9,378 Views)

Hi,

 

I don't see what you have changed?

Best regards,

Thijs Boeree

0 Kudos
Message 8 of 21
(9,376 Views)

Hello Thijs,

 

Don't you see any difference in behaviour?

 

Please look in the event structure.

We're no longer triggering the ActiveX part on the value change event.

Instead we're triggering it with the "mouse up" event. (so when you release it)

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
Message 9 of 21
(9,372 Views)

Ok,

 

Thanks! That's a good solution! For playing the video, i just control the speed of the data with the timing of the video! And otherwise i only update at mouse up release!

 

Best regards!

0 Kudos
Message 10 of 21
(9,370 Views)