yanwsh / videojs-panorama

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

How can I disable panorama after the plugin was initialized? #53

Open manuelsechi opened 7 years ago

manuelsechi commented 7 years ago

after I initialised panorama for a 360 video I would like to disable it if the next one is not a 360 one, and I am not reloading the page so I'd need to programmaticaly disable it.

thanks M

yanwsh commented 7 years ago

Will work on it.

icetronics commented 7 years ago

Hi, are there any updates on this one? @yanwsh, could you please give pointers at least how the panorama plugin can be removed from a vjs instance? (e.g. remove canvas, etc)

moshest commented 7 years ago

+1

moshest commented 7 years ago

This is what I using in order to remove the panorama:

const canvas = player.getChild('Canvas');
if (!canvas) return;

canvas.handleDispose(); // doing nothing, see issue #100
canvas.startAnimation = () => {}; // fix bug on handleDispose method 

player.removeChild('Canvas');
player.removeChild('HelperCanvas');
player.removeChild('Notice');

player.controlBar.removeChild('VRButton');
delete player.tech({ IWillNotUseThisInPlugins: true }).el().style.display;

UPDATE: handleDispose() method is buggy, see issue #100.

paulomedia commented 6 years ago

Hi I'm try your solution with

player.removeChild('Canvas');

but, i can hear the audio and can not watch the video, we have to try do something more than that.

I'm trying to temporarily find a method to disable the plugin and activate it, basing me in videojs-panorama.v5.js, while we wait for a solution from yanwsh

paulomedia commented 6 years ago

I can see the vídeo changing the display to 'block'

player.tech({ IWillNotUseThisInPlugins: true }).el().style.display = 'block';,

That's the reason why I did not see the video, when I deleted it.

delete player.tech({ IWillNotUseThisInPlugins: true }).el().style.display;

the vídeo not change the display to block value.

Best regards

yanwsh commented 6 years ago

hey, i noticed for some reason, it doesn't work. will work on it.

jjinkxy commented 6 years ago

+1

gaxunil commented 6 years ago

+1 - I need a way to toggle the panorama dewarpping etc on and off. We have 360 fish eye video and I need to enable a way for the user to trigger the nice things the panorama plugin does for us, but also be able to disable it and return to round, fisheye view (no dewarpping, panorama plugin essentially disabled). I could work on adding this and getting up a PR - any guidance on the general things that need to be done? @yanwsh