Jump to content
Sign in to follow this  

Interacting with the full Windows Media Player

Recommended Posts


I am trying to write a script that will run the full Windows Media Player application, stream a video from a URL, detect when the video has completed playing and then exit. This script is going to be run by 30-50 virtual machines at the same time for load testing.

My past couple days of browsing this from and MSDN have not yielded the results I am looking for.

My issue is that .playState () only works when the stream is opened with .URL = $url, and that method of opening the stream does not open the full WMplayer.exe like .openplayer($url) does. Can I make .URL behave like .openplayer($url) or make the .playState () command work with .openplayer($url)?

Here is what my code looks like at the moment.

$url = "http://itc.virginia.edu/network/videotest/when-I-go-to-UVA-lg.asx" ;Streaming Video URL

$WMP = ObjCreate("WMPlayer.ocx")

With $WMP 
    ;.openPlayer($url) ;Unable to get $WMP.playState ()
    .URL = $url ;does not open WMPlayer.exe
sleep (2000)
While $WMP.playState () = 3
    MsgBox(0, "Play State:", $WMP.playState ())

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.