Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: motion controls option #137

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'`
Expand Down
10 changes: 8 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down