yanwsh / videojs-panorama

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

Problem about viewing dual fisheye #126

Closed tiepviet closed 6 years ago

tiepviet commented 6 years ago

Hi @yanwsh I have problem about viewing dual fisheye video. I'm using the below config but it didn't work exactly.

player.panorama({
          clickToToggle: (!isMobile()),
          videoType: "dual_fisheye",
          clickAndDrag: true,
          autoMobileOrientation: true,
          backToVerticalCenter: false,
          backToHorizonCenter: false,
          maxLat: -10,
          initLat: -10,
          rotateX: -Math.PI / 2,
          NoticeMessage: (isMobile())? "please move your phone" : "please use your mouse drag and drop the video",
          callback: function () {
            if(!isMobile()) player.play();
          }
        });

I see this config not work exactly with my video (1472x736)

dualFish: {
        width: 1920,
        height: 1080,
        circle1: {
            x: 0.240625,
            y: 0.553704,
            rx: 0.23333,
            ry: 0.43148,
            coverX: 0.913,
            coverY: 0.9
        },
        circle2: {
            x: 0.757292,
            y: 0.553704,
            rx: 0.232292,
            ry: 0.4296296,
            coverX: 0.913,
            coverY: 0.9308
        }
    }

My test video: https://www.dropbox.com/s/9zixehazaw3zwkz/dual.mp4?dl=0

Can you explain calculation formula in dual fisheye? Thank you very much.

tiepviet commented 6 years ago

https://github.com/yanwsh/videojs-panorama/blob/a771a6f913e3d98a3ad14d8f8a4bb0baa8e54f22/src/scripts/lib/Canvas.js#L43-L64

yanwsh commented 6 years ago

circle1: x, y are the center point, suppose the left circle center point is (462, 482), then x = 446/ 1920, y = 482/ 1080. rx, ry are the radius size for first circle x, suppose radius is 466, then rx = 466/ 1920, ry = 466/ 1080. coverX, coverY are coverage rate, suppose left and right have 10% duplicate image, then it will be 0.9, adjust it to make two image concatenate seamlessly.

tiepviet commented 6 years ago

Thank you very much. I'll try to change some params. And hope it work :)

yanwsh commented 6 years ago

Does it work?

tiepviet commented 6 years ago

Does it work?

Thank you very much. It worked perfectly. I will close this issue.