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

fix: 'no 360 support' error in IE #67

Merged
merged 3 commits into from
May 8, 2018
Merged
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
27 changes: 21 additions & 6 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ class VR extends Plugin {

super(player, settings);

this.polyfill_ = new WebVRPolyfill({
TOUCH_PANNER_DISABLED: false
});

this.options_ = settings;
this.player_ = player;
this.bigPlayButtonIndex_ = player.children().indexOf(player.getChild('BigPlayButton')) || 0;
Expand All @@ -65,10 +61,18 @@ class VR extends Plugin {
// IE 11 does not support enough webgl to be supported
// older safari does not support cors, so it wont work
if (videojs.browser.IE_VERSION || !utils.corsSupport) {
this.triggerError_({code: 'web-vr-not-supported', dismiss: false});
// if a player triggers error before 'loadstart' is fired
// video.js will reset the error overlay
this.player_.on('loadstart', () => {
this.triggerError_({code: 'web-vr-not-supported', dismiss: false});
});
return;
}

this.polyfill_ = new WebVRPolyfill({
TOUCH_PANNER_DISABLED: false
});

this.handleVrDisplayActivate_ = videojs.bind(this, this.handleVrDisplayActivate_);
this.handleVrDisplayDeactivate_ = videojs.bind(this, this.handleVrDisplayDeactivate_);
this.handleResize_ = videojs.bind(this, this.handleResize_);
Expand Down Expand Up @@ -204,7 +208,18 @@ class VR extends Plugin {
this.player_.error(errorObj);
// if we don't have videojs-errors just use a normal player error
} else {
this.player_.error({code: errorObj.code, message: errors[errorObj.code].message});
// strip any html content from the error message
// as it is not supported outside of videojs-errors
const div = document.createElement('div');

div.innerHTML = errors[errorObj.code].message;

const message = div.textContent || div.innerText || '';

this.player_.error({
code: errorObj.code,
message
});
}
}

Expand Down