yanwsh / videojs-panorama

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

HandleResize #145

Open jessica88888 opened 6 years ago

jessica88888 commented 6 years ago

Hi Yanwsh,

Thanks for this great plugin. May I know how to modify this so that it could change the canvas size according to Parent's div size or specified size? I've tried many different ways, unfortunately, I can't get them to work. Only resizing in full screen will work. Because I've theater mode, the canvas was drawn to fit the video player's size, it would be great if we could set a custom size and pass it via handleResize.

var player = window.player = videojs('videojs-panorama-player', {}, function () {
    window.addEventListener("resize", function () {
        var canvas = player.getChild('Canvas');
        canvas.handleResize();
    });
});

Besides, may I know how should I modify this codes if I've already declared videojs earlier:

var player = videojs('my-player');
player.panorama({
    clickAndDrag: true,
        callback: function () {
        player.play();
    }
});

I'm a beginner and hope that you could help me with this, thanks once again.

Best regards, Jessica

shawnzam commented 6 years ago

@yanwsh Any chance you could take a look at this? I, also, would like to get this resolved.