Search the Community
Showing results for tags 'android browser'.
-
Hi everyone~ I have been working on a scene which uses different camera in different device, FreeCamera will be attached to the scene if the scene is displayed on a standalone pc browser, as for mobile browser, VRDeviceOrientationFreeCamera is attached when mobile browser is in landscape; DeviceOrientationCamera when portrait orientation. The ideal results are as shown below: (mobile landscape orientation) (mobile portrait orientation) above results are the ideal results, which are the results on chrome, opera and firefox mobile browser. However, when I open the page using android default browser, about half of the page blank, in both landscape and portrait orientation, as shown below: (landscape) (portrait) it looks like the canvas has been "shrinked" into half of the page, no distort of the scene, and is actually in fullscreen mode while not visually fullscreen. Below are the code of how I make the scene full screen and switch between browser: Code for fullscreen: function goFullscreen(){ var docElm = document.documentElement; if (docElm.requestFullscreen) { engine.switchFullscreen(true); docElm.requestFullscreen(); } else if(docElm.msRequestFullscreen){ engine.switchFullscreen(true); docElm.msRequestFullscreen(); } else if (docElm.mozRequestFullScreen) { engine.switchFullscreen(true); docElm.mozRequestFullScreen(); } else if (docElm.webkitRequestFullScreen) { engine.switchFullscreen(true); docElm.webkitRequestFullScreen(); } } Code to switch between vr camera and device orientation camera when using mobile to display the page: var is_mobile = function() { return (/Android|iPhone|iPad|iPod|BlackBerry/i).test(navigator.userAgent || navigator.vendor || window.opera); }; function isLandscape(){ return screen.width >screen.height; } window.addEventListener("resize", function() { if (!is_mobile()){ return; } if (isLandscape()){ scene.activeCamera = vrCamera; vrCamera.attachControl(canvas,false); }else{ scene.activeCamera = devOrienCamera; devOrienCamera.attachControl(canvas,false); } engine.resize(); }); I am not sure if it is the default android browser's issue or there is something else I need to take note while making the scene fullscreen... If anyone had encounter the similar situation feel free to share :). and thank you for your time~