mozilla / popcorn-js

The HTML5 Media Framework. (Unmaintained. See https://github.com/menismu/popcorn-js for activity)
MIT License
2.14k stars 632 forks source link

The way to replay video ? #469

Closed davidanquetin closed 6 years ago

davidanquetin commented 8 years ago

Hello

in my project, i have a Popcorn video Instance, without controls option (i make my own control buttons)

when i play for the first time with my PLAY Button, it is ok. The play()/pause() are ok. When the video is all played once, at the end, i would that the play() function to play the video from the beginning again.. But nothing is happened.. The play() event is emitted, but the video is not played in my view..

I tried to force currentTime after the end of first playing (myPopcornInstance.currentTime(0)), but i does not work.. I tried to force play and pause at time 0 with play(0).pause(0), but does not work...

I think there is a simple way to do this, that i missed , or that i did not understood ?...

Thanks ! David

cadecairos commented 8 years ago

Hello @davidanquetin,

You can try listening for the ended event.

var $pop = Popcorn("#video");
$pop.on("ended", function() {
  $pop.currentTime(0);  
});