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

SUP-46065: Player shows VR button based on "360" (or variations) tag #110

Closed
wants to merge 6 commits into from
9 changes: 9 additions & 0 deletions src/vr.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Vr extends BasePlugin {
* @static
*/
static defaultConfig: Object = {
tag: '360',
moveMultiplier: 0.15,
deviceMotionMultiplier: 1,
startInStereo: false,
Expand Down Expand Up @@ -95,6 +96,7 @@ class Vr extends BasePlugin {
_longitude: number;
_calculateCanvasSizeInterval: ?IntervalID;
_crossOriginSet: boolean;
_tag: string;

/**
* @constructor
Expand All @@ -106,6 +108,7 @@ class Vr extends BasePlugin {
super(name, player, config);
this._initMembers();
this._addBindings();
this.updateVrIsOn(this.config.tag);
}

/**
Expand Down Expand Up @@ -282,6 +285,11 @@ class Vr extends BasePlugin {
}
}

updateVrIsOn(vrTag: string): void {
this._tag = vrTag ?? '360';
this.player.setVrTag(vrTag);
}

_updateCamera(): void {
if (this._camera) {
// limiting latitude from -89 to 89 (cannot point to the sky or under your feet)
Expand Down Expand Up @@ -453,6 +461,7 @@ class Vr extends BasePlugin {
this._latitude = 0;
this._longitude = 180;
this._crossOriginSet = false;
this._tag = this.config.tag;
}

_cancelAnimationFrame(): void {
Expand Down