View Full Version : How to get the playback time please?

11-01-2006, 01:21 PM
I put a WMP in my web page:

<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="384" height="357">
<param name="ShowStatusBar" value="-1">
<param name="Filename" value="temp.wmv">
<embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" filename="temp.wmv" src="temp.wmv" width="384" height="357">

After the video is fully loaded, I am wondering whether I can get the remaining playback time via ASP, wherever the playback slide bar is set?

Is there any OCX that I can use?

For e.g., after the video (20 seconds long) is fully loaded, I slide the playback bar to 15 seconds. How can I get the (20-15)=5 seconds and put it in an variable dynamically by ASP please?

Thanks for any ideas in advance!

11-02-2006, 04:33 AM
ASP runs through the server. It isn't client side and has no access to what the client does once the data is send to him/her from the server.

Javascript would be the right answer here.... however... since a WMV is just embedded, I don't know if it's even possible.

One option would be to look into embedding a movie in flash which has more specific graphics controls and MIGHT have an option for seeing what time the movie is at and then flash can output to javascript, though it is quite complex.

One suggestion for JUST getting the LENGTH of a movie would be to look for an ASP expansion/addition/plugin (can't remember the right word) that actually is able to analyze movies.
I know that I saw a PHP expansion for Quicktime movies, but I don't know if any exist for ASP and/or WMV.
With that, it had options like movie info and grabbing a frame as an image.
With that you could have gotten the length and done some of what you're talking about above.

11-02-2006, 10:03 AM
I wonder whether this one is possible by Javascript too. :confused:

11-02-2006, 10:55 AM
I doubt it.
Plugins don't usually communicate with javascript.
There might be a complex way.
Perhaps there's a way to tell when a button was clicked and then set a timer in JS until another is. Or something.
But, really, I doubt it.

You'd need some way of monitoring the video...and the plugin does that, not JS.

That's why I suggested flash, or perhaps use another form of various layers, where the video loads through something... streaming. Dunno.
Flash is likely the only real viable option.