yanwsh / videojs-panorama

a plugin for videojs run a full 360 degree panorama video.
http://yanwsh.github.io/videojs-panorama/
Other
494 stars 159 forks source link

Autoplay support #80

Open kuehn-sba opened 7 years ago

kuehn-sba commented 7 years ago

Can the plugin handle the videojs autoplay option? For me, it's not working:

            this.vjs = videojs(video, {
                autoplay: true,
                preload: 'metadata',
                plugins: {
                    panorama: {
                        showNotice: false,
                        clickAndDrag: true,
                        clickToToggle: true
                    }
                }
            });
kevinrogerteng commented 7 years ago

@kuehn-sba Have you tried using the callback options? Something like...

            this.vjs = videojs(video, {
                preload: 'metadata',
                plugins: {
                    panorama: {
                        showNotice: false,
                        clickAndDrag: true,
                        clickToToggle: true,
                        callback: function() {
                             //autoplay would be a variable/option
                             if (autoplay) {
                                  this.vjs.play()
                             }
                        }
                    }
                }
            });

I have a different syntax where I don't use the plugin option, so I'm not sure if this will work for you.

kuehn-sba commented 7 years ago

thx, but I already use this workaround... autoplay would be more general

yanwsh commented 7 years ago

Hey, you have another two options:

First: put autoplay attribute to video tag like below:

<video autoplay></video>

Second: put autoplay to videojs options

videojs(video, {
       preload: 'metadata',
      autoplay: true,
      plugins: {
         .....
      }
});
kuehn-sba commented 7 years ago

hi yanwsh,

In the case of the Autoplay flag, the video will start automatically, but it will only be displayed in black. When I restart playback or using the workaround above, it will work.

bhartendukumar12 commented 7 years ago

https://s3.ap-south-1.amazonaws.com/viyatrademo/Viyatra.html

check this goto source code