Seeking to Specific points in a Windows Media player file
I have had trouble getting Windows Media Player to consistently seek to markers embedded in the video itself, but it does seem to seek to specific timings.
Some sample code is provided below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Seeking to Specific Points in a Windows Media File</TITLE> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </HEAD> <BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <P align="center"><BR> <BR> <BR> <OBJECT id='mediaPlayer' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'> <PARAM name='fileName' value='video.asx'> <PARAM name='autoStart' value='1'> <PARAM name='ShowControls' value='true'> <PARAM name='EnableContextMenu' value='true'> <PARAM name='EnableMarkerCount' value='true'> <PARAM name='ShowGoToBar' value='true'> <PARAM name='ShowStatusBar' value='true'> <PARAM name='ShowTracker' value='true'> <EMBED src="video.asx" width="300" height="290" enablemarkercount="1" enablecontextmenu="1" enablefullscreencontrols="1" enabletracker="1" showcontrols="1" showaudiocontrols="1" showdisplay="1" showgotobar="1" showpositioncontrols="1" showstatusbar="1" showtracker="1" allowchangedisplaysize="0" autorewind="0" balance="0" bufferingtime="3" filename="video.asx" videobordercolor="1" videoborderwidth="1" volume="-500" > </EMBED> </OBJECT> <BR> <BR> <A href=''onClick='javascript:mediaPlayer.CurrentPosition=149; return false'>Jump to 2</A> <BR> <A href=''onClick='javascript:mediaPlayer.CurrentPosition=268; return false'>Jump to 3</A> <BR> <A href=''onClick='javascript:mediaPlayer.CurrentPosition=396; return false'>Jump to 4 </A> </P> </BODY> </HTML>
Ellen,
THANKS!!!
Your script is exactly what was needed!!
Ellen,
my thanks were a bit premature. Our application places the video and links in one frame and target images in the other. Your example works great for just jumping to specific times within a single frame.
Maybe i can figure out how to tweak it a little?
Best regards.
A good source of info about scripting within frames is here
http://www.yourhtmlsource.com/javascript/scriptingframes.html
It’s not working with me, when clicking the link the page refreshes and the video begins the streaming from the start point.
Iam using firefox and windows xp
The player model has changed since I wrote this. Try this Windows Media Object Model reference page:
http://msdn.microsoft.com/en-us/library/bb249672(VS.85).aspx
for new examples of script commands. Frankly I haven’t gotten it working yet, perhaps I don’t have the right version installed at work. This lack of compatibility, even with Windows Media itself is why I switched us all to FLV.
—–