Domanda

I'm using popcorn.js with Vimeo. I would like to play my Vimeo video programmatically, but I can't seem to get the basic play() method to work for Vimeo videos.

The example code from popcorn.js.org doesn't work for me. The video does not "play right away."

document.addEventListener("DOMContentLoaded", function () {

     var example = Popcorn.vimeo(
     '#video',
     'http://player.vimeo.com/video/25107077');

     // add a footnote at 2 seconds, and remove it at 6 seconds
     example.footnote({
       start: 2,
       end: 6,
       text: "Pop!",
       target: "footnotediv"
     });

     // play the video right away
     example.play();

  }, false);
È stato utile?

Soluzione

Move example.play() into an appropriate listener. This should work:

example.listen( 'canplaythrough', function() {
  example.play();
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top