Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player.playlist.first() triggers also autoadvance immediately #50

Closed
Moowalker opened this issue Jul 27, 2016 · 3 comments
Closed

player.playlist.first() triggers also autoadvance immediately #50

Moowalker opened this issue Jul 27, 2016 · 3 comments

Comments

@Moowalker
Copy link

I am trying to make a loop playlist but it seems that when I call player.playlist.first() it automaticaly autoadvances at the 2nd video in my playlist. My Code:

<video id="video" class="video-js vjs-default-skin"
       controls preload="auto" width="785" height="400"
       data-setup='{}' autoplay>
    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading
        to a web browser that <a href="http://videojs.com/html5-video-support/"
                                 target="_blank">supports HTML5 video</a></p>
</video>
var player = videojs('video');

    player.playlist([{
        sources: [{
            src: 'http://octo.ath.cx/videos/voltaren.mp4',
            type: 'video/mp4'
        }]
    }, {
        sources: [{
            src: 'http://octo.ath.cx/videos/voltaren2.mp4',
            type: 'video/mp4'
        }]
    } , {
        sources: [{
            src: 'http://octo.ath.cx/videos/aspirin.mp4',
            type: 'video/mp4'
        }]
    }]);

    var size = Object.keys(player.playlist()).length;

    player.playlist.autoadvance(0);

    player.on( 'ended', function() {
        if ( size == (player.playlist.currentItem() + 1)){
            player.playlist.first();
        }
    });

So after player.playlist.first(); is triggered, immediately it goes at the 2nd item of the playlist.

@lonormaly
Copy link

Same here

@adyballa
Copy link

That's caused by autoadvance(). The reset is buggy in my opinion. It doesnt cancel all timeout-handlers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants