Skip to content

Commit

Permalink
Disable Sensors if loading example within an iframe -- details in REA…
Browse files Browse the repository at this point in the history
…DME in next commit. For #27
  • Loading branch information
jsantell committed Jul 11, 2018
1 parent b2fd5b0 commit c196e15
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@
console.log('creating CardboardVRDisplay with options', config);
var vrDisplay = new CardboardVRDisplay(config);

// If loading this inside of an iframe (see iframe.html),
// force using the `devicemotion` sensor fusion, rather than
// newer Generic Sensors due to an issue with sensors
// in iframes in Chrome < m69:
// https://bugs.chromium.org/p/chromium/issues/detail?id=849501
if (window.self !== window.top) {
vrDisplay.poseSensor_.useDeviceMotion();
}

navigator.getVRDisplays = function () {
return new Promise(function (resolve) {
resolve([vrDisplay]);
Expand Down

0 comments on commit c196e15

Please sign in to comment.