2
0
Эх сурвалжийг харах

VREffect and VRControls: Catch error retreiving VR Displays (#9825)

This can happen if the page is inside an iframe that doesn't have an `allowvr` attribute set or if permission is otherwise denied.
Brian Chirls 8 жил өмнө
parent
commit
56a96d8880

+ 5 - 1
examples/js/controls/VRControls.js

@@ -37,7 +37,11 @@ THREE.VRControls = function ( object, onError ) {
 
 	if ( navigator.getVRDisplays ) {
 
-		navigator.getVRDisplays().then( gotVRDisplays );
+		navigator.getVRDisplays().then( gotVRDisplays ).catch ( function () {
+
+			console.warn( 'THREE.VRControls: Unable to get VR Displays' );
+
+		} );
 
 	}
 

+ 5 - 1
examples/js/effects/VREffect.js

@@ -42,7 +42,11 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	if ( navigator.getVRDisplays ) {
 
-		navigator.getVRDisplays().then( gotVRDisplays );
+		navigator.getVRDisplays().then( gotVRDisplays ).catch ( function () {
+
+			console.warn( 'THREE.VREffect: Unable to get VR Displays' );
+
+		} );
 
 	}