Results 1 to 3 of 3

Thread: Looping video

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    12
    Vote Rating
    0
      0  

    Default Looping video

    Hi

    Is it possible to loop a video in a scene??
    I placed an action at the end of the scene to 'restart' but the video doesn't loop.
    I tried adding '50' to the iterations on the video element but still nothing.

    Can anybody help me??

    E

  2. #2
    Sencha User arnebech's Avatar
    Join Date
    Jun 2010
    Posts
    498
    Vote Rating
    10
      0  

    Default

    If you want to a loop a video when it ends, you could do something like this for the custom JS start action of the scene. Make sure you video id is "my-video-id" or matches that in the code.

    Code:
    if (!this.videoListener) {
        
        //so we only call this once
        this.videoListener = true;
        
        var videoContainer = controller.getElementById('my-video-id');
        var videoElement = videoContainer.querySelector('video');
        
        videoElement.addEventListener('ended',function(){
            videoElement.play();
        },false);
        
    }

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    30
    Vote Rating
    0
      0  

    Default

    works great! thanks for the tip Arne

Posting Permissions

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