From 49a2bd131adafabce21122f9e65028d4b18047ac Mon Sep 17 00:00:00 2001 From: brandonocasey Date: Fri, 14 Sep 2018 16:49:50 -0400 Subject: [PATCH] feat: motion controls option --- README.md | 6 ++++++ src/plugin.js | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4c272424..cddbb6b6 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Maintenance Status: Stable - [Accessing THREE.js objects](#accessing-threejs-objects) - [Options](#options) - [`forceCardboard`](#forcecardboard) + - [`motionControls`](#motioncontrols) - [`projection`](#projection) - [`'360'`, `'Sphere'`, or `'equirectangular'`](#360-sphere-or-equirectangular) - [`'Cube'` or `'360_CUBE'`](#cube-or-360_cube) @@ -184,6 +185,11 @@ player.vr().rendeer; Force the cardboard button to display on all devices even if we don't think they support it. +### `motionControls` +> Type: `boolean`, default: `true on ios and andriod` + +Whether motion/gyro controls should be enabled. + ### `projection` > Type `string`, default: `'auto'` diff --git a/src/plugin.js b/src/plugin.js index a83b33b8..77622a20 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -508,11 +508,17 @@ class VR extends Plugin { if (!this.controls3d) { this.log('no HMD found Using Orbit & Orientation Controls'); - this.controls3d = new OrbitOrientationContols({ + const options = { camera: this.camera, canvas: this.renderedCanvas, orientation: videojs.browser.IS_IOS || videojs.browser.IS_ANDROID || false - }); + }; + + if (this.options_.motionControls === false) { + options.orientation = false; + } + + this.controls3d = new OrbitOrientationContols(options); this.canvasPlayerControls = new CanvasPlayerControls(this.player_, this.renderedCanvas); }