Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help - html5 video tag - Eventlistener "timeupdate"

    Hi,
    This code goes into a click event that is supposed to play one second of a movie. The next click increments and plays the next second, etc.

    What I have here works for the first click - on the second click, the movie does not play. Third click , the playhead advances to the next position as expected but still is paused, and so on.

    Tis is in an Adobe Edge project, and I'm testing in Firefox.

    Any help would be greatly appreciated.


    //add 1 to "pTime" each click - pTime is where the video should pause
    sym.setVariable("pTime", pTime + 1);

    // set playhead back 1 second then play//
    myVideo.currentTime = (pTime-1);
    myVideo.play();

    // event listener checks the current
    // movie time/position of the playhead 4 times per second
    myVideo.addEventListener("timeupdate", function()

    if (myVideo.currentTime >= pTime) {
    myVideo.pause();
    }}, false);
    Last edited by kethklx; 11-30-2012 at 09:48 PM.

  • #2
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think i fixed it. The variable needs to be grabbed again from inside the function, i.e. it's not global. Is there a more elegant way to do this?

    myVideo.addEventListener("timeupdate", function() {


    var pTime = sym.getVariable("pTime");


    if (myVideo.currentTime >= pTime) {
    myVideo.pause();


  •  

    Tags for this Thread

    Posting Permissions

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