Skip to content

Commit

Permalink
test immersive session support
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben committed Dec 19, 2023
1 parent 7e62cd4 commit aaf320a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/big-vr-play-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ class BigVrPlayButton extends BigPlayButton {
const sessionInit = {optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking']};
const self = this;

window.navigator.xr.requestSession('immersive-vr', sessionInit).then(self.onSessionStarted).catch();
window.navigator.xr.isSessionSupported('immersive-vr').then((supportsImmersiveVR) => {
if (supportsImmersiveVR) {
window.navigator.xr.requestSession('immersive-vr', sessionInit)
.then(self.onSessionStarted)
.catch((e) => {
this.log('Failed to start immersive session');
});
}
});
}

super.handleClick(event);
Expand Down

0 comments on commit aaf320a

Please sign in to comment.