문제

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>
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top