Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #49 from cvan/update-polyfill-checks
Browse files Browse the repository at this point in the history
update webvr-polyfill checks
  • Loading branch information
caseyyee authored Jan 5, 2018
2 parents 707ecd3 + 16c36bf commit c6e2baa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions Assets/WebGLTemplates/WebVR/webvr.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
if (displays.length > 0) {
vrDisplay = displays[displays.length - 1];

// check to see if we are polyfilled
if (vrDisplay.displayName.indexOf('polyfill') > 0) {
// Check to see if we are polyfilled.
var isPolyfilled = (vrDisplay.deviceId || '').indexOf('polyfill') > 0 ||
(vrDisplay.deviceName || '').indexOf('polyfill') > 0 ||
vrDisplay.hardwareUnitId;
if (isPolyfilled) {
showInstruction(document.querySelector('#novr'));
} else {
status.dataset.enabled = true;
Expand All @@ -39,8 +42,10 @@
onAnimate();
}

if (vrDisplay.capabilities.canPresent) {
entervrButton.dataset.enabled = 'true';
if (vrDisplay.capabilities && vrDisplay.capabilities.canPresent) {
entervrButton.dataset.enabled = true;
} else {
delete entervrButton.dataset.enabled;
}
});
} else {
Expand Down
13 changes: 9 additions & 4 deletions Build/webvr.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
if (displays.length > 0) {
vrDisplay = displays[displays.length - 1];

// check to see if we are polyfilled
if (vrDisplay.displayName.indexOf('polyfill') > 0) {
// Check to see if we are polyfilled.
var isPolyfilled = (vrDisplay.deviceId || '').indexOf('polyfill') > 0 ||
(vrDisplay.deviceName || '').indexOf('polyfill') > 0 ||
vrDisplay.hardwareUnitId;
if (isPolyfilled) {
showInstruction(document.querySelector('#novr'));
} else {
status.dataset.enabled = true;
Expand All @@ -39,8 +42,10 @@
onAnimate();
}

if (vrDisplay.capabilities.canPresent) {
entervrButton.dataset.enabled = 'true';
if (vrDisplay.capabilities && vrDisplay.capabilities.canPresent) {
entervrButton.dataset.enabled = true;
} else {
delete entervrButton.dataset.enabled;
}
});
} else {
Expand Down

0 comments on commit c6e2baa

Please sign in to comment.