瀏覽代碼

Updated jsm WebVR.js

Takahiro 5 年之前
父節點
當前提交
645c66d517
共有 1 個文件被更改,包括 14 次插入2 次删除
  1. 14 2
      examples/jsm/vr/WebVR.js

+ 14 - 2
examples/jsm/vr/WebVR.js

@@ -171,14 +171,26 @@ var WEBVR = {
 
 		}
 
-		if ( 'xr' in navigator && 'supportsSession' in navigator.xr ) {
+		if ( 'xr' in navigator && 'isSessionSupported' in navigator.xr ) {
 
 			var button = document.createElement( 'button' );
 			button.style.display = 'none';
 
 			stylizeElement( button );
 
-			navigator.xr.supportsSession( 'immersive-vr' ).then( showEnterXR ).catch( showXRNotFound );
+			navigator.xr.isSessionSupported( 'immersive-vr' ).then( funciton ( supported ) {
+
+				if ( supported ) {
+
+					showEnterXR();
+
+				} else {
+
+					showXRNotFound();
+
+				}
+
+			} );
 
 			return button;