mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.21k stars 717 forks source link

Video autoplay does not work #928

Open edwinius opened 3 years ago

edwinius commented 3 years ago

Hello, thank you for the very nice plug in. I am having trouble making the video to autoplay, have experiment and tried everything, and in different browsers and devices, the autoplay just does not start.

Panorama view, everything works fine, but I had to click the play button for it to start.

Here is my code:

<video 
        id="panorama" class="video-js vjs-default-skin vjs-big-play-centered" 
        controls
        muted
        preload="none"
        loop
        style="width:100%;height:100%;" 
        crossorigin="anonymous"
        src='vidmin.mp4'
        poster='poster.jpg'
        playsinline="true"
        autoplay
    >
        <source src="vidmin.mp4" type="video/mp4"/>
        <source src="vidmin.webm" type="video/webm"/>
        <p class="vjs-no-js">
            To view this video please enable JavaScript, and consider upgrading to
            a web browser that 
            <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
        </p>
</video>

<script>
    var player = window.player = videojs('panorama', {
        playsinline: true,
        autoplay: true,
        muted: true,
        preload: 'metadata',
        plugins: {
            pannellum: {}
        }
    });
</script>

Thank you very much for your attention and help.

mpetroff commented 3 years ago

What versions of Video.js and Pannellum are you using?

rut-shah commented 3 years ago

I am facing the same problem.

videojs('panoramaVideo', { loop: true, autoplay: true, plugins: { pannellum: {} } });

Video.js version 7.10.2 and Pannellum 2.5.6.

Any help would be appreciated.

Thank you.

mpetroff commented 3 years ago

This seems to be an upstream issue with Video.js. At least for me, it exhibits the same behavior when the Pannellum plugin isn't used. Setting autoplay: true only works in Firefox, and setting autoplay: 'muted' only works in Chrome.