SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sync Player.controls.currentPosition

    Hi guys,

    I am working in Windows media player enable to web page. I want to use Player.controls.currentPosition value to thie function below:

    function playNextClip(){
    if Player.controls.currentPosition = 40 {

    // play next movie clip
    }
    }

    I tried to monitor the value of Player.controls.currentPosition, so , I put the function on <body onload='playNextClip()'>, but it doesnot work: Player.controls.currentPosition stay in 0.

    Another hand, I tried the wmpprop:Player.controls.currentPosition, MSDN said it can listen Player.controls.currentPosition value:
    function playNextClip(){
    if wmpprop:Player.controls.currentPosition = 40 {

    // play next movie clip
    }
    }

    However , it doesnot work as well.

    Could anyone tell me how to sync the Player.controls.currentPosition value from a media file start playing?

    Thanks lots

  2. #2
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Btw

    BTW , I know I can use some extenal event lik onClick, OnMouseover to get the value of Player.controls.currentPosition. But I want to page detect the Player.controls.currentPosition value automaticly , dont need any mouse action to triger it.

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This might get you started:
    Code:
    <script type="text/javascript">
    var wmpInterval;
    
    window.onload = setTheInterval;
    
    function setTheInterval() {
    	wmpInterval = window.setInterval(skipIfPast40, 100); // causes "skipIfPast40" function to run every 100ms
    }
    
    function skipIfPast40() {
    	if (Player.controls.currentPosition >= 40) { // it might not be exactly 40 when we test the position
    		// cancel interval
    		window.clearInterval(wmpInterval);
    		// play next clip
    		Player.URL = "nextclip";
    		// start interval over
    		setTheInterval();
    	}
    }
    </script>

  4. #4
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks.

    I got the answer, use the timeout() to execute the function per second.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •