javascriptjquerypopcornjs

Popcorn constructor syntax


Any idea why this is not firing autoplay? It's my first time using this plugin but I thought I had the syntax right...?

<html lang="en">
<head>

    <script src="support/jquery-2.0.3.min.js"></script>
    <script src="support/popcorn-complete.min.js"></script>

    <script>

    $(document).ready( function() {

        var popClip = Popcorn("#sampleClip", {
            autoplay: true
        });

    });

    </script>

</head>
<body>

    <video id="sampleClip">
        <source src="..sample.mp4">
        <source src="..sample.ogv">
        <source src="..sample.webm">    
    </video>

</body>
</html>

Solution

  • Try using autoplay as a methodinstead of a flag. The documentation is not very clear about using it as a flag. As a method I'm totally sure it works, as you can see in this fiddle.

    $(document).ready( function() {
    
            var popClip = Popcorn("#sampleClip");
            popClip.autoplay();
    });
    

    Besides, make sure jQuery and popcorn were actually loaded. I'm also not sure that ..sample.mp4 is actually going to work as a source. Try replacing them by something formatted like this: ../sample.mp4.