Rob
Rob

Reputation: 323

popcorn.js play() Does Not Work for Vimeo Videos

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);

Upvotes: 2

Views: 779

Answers (1)

ari
ari

Reputation: 56

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

example.listen( 'canplaythrough', function() {
  example.play();
});

Upvotes: 1

Related Questions