JSFiddle - React, Tailwind, and code Playground

by popcornjs

HTML

<script src="http://popcornjs.org/code/dist/popcorn-complete.min.js"></script>
<video height="180" width="300" id="video" controls>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.mp4"></source>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.ogv"></source>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.webm"></source>
</video>

CSS

html{font-family:arial;}

JavaScript

var pop = Popcorn( "#video" ),
    fired = 0;

//This exec should only run once
pop.exec( 5, function() {
    console.log( "exec fired " + ( ++fired ) + " times" );

    // Destroy the instance
    Popcorn.destroy( pop );

    pop.currentTime( 0 ).play();
});

pop.listen( "canplay", function() {
    pop.play();
});