Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit56a96d8

Browse files
brianchirlsmrdoob
authored andcommitted
VREffect and VRControls: Catch error retreiving VR Displays (mrdoob#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.
1 parent18a33bd commit56a96d8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

‎examples/js/controls/VRControls.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ THREE.VRControls = function ( object, onError ) {
3737

3838
if(navigator.getVRDisplays){
3939

40-
navigator.getVRDisplays().then(gotVRDisplays);
40+
navigator.getVRDisplays().then(gotVRDisplays).catch(function(){
41+
42+
console.warn('THREE.VRControls: Unable to get VR Displays');
43+
44+
});
4145

4246
}
4347

‎examples/js/effects/VREffect.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ THREE.VREffect = function ( renderer, onError ) {
4242

4343
if(navigator.getVRDisplays){
4444

45-
navigator.getVRDisplays().then(gotVRDisplays);
45+
navigator.getVRDisplays().then(gotVRDisplays).catch(function(){
46+
47+
console.warn('THREE.VREffect: Unable to get VR Displays');
48+
49+
});
4650

4751
}
4852

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp