webVR hangs inside cordova iOS app

  • When accessing the tour via mobile Safari, webVR works fine. But when I package the tour into an app using cordova, the app hangs when clicking on the VR icon.

    What do you think is causing the problem? I'm not seeing any errors on the console output.

  • Got an update on this:

    Using the mobile inspector, I traced the error to cordova's version of document.addEventListener.

    Code
    document.addEventListener = function(evt, handler, capture) {  var e = evt.toLowerCase();


    Error is on the call to toLowerCase because evt is undefined. Perhaps webvr.js is attaching some undefined event?
    When I wrap this in an if statement checking for undefined, webvr works normally.

    Einmal editiert, zuletzt von engwan (25. Mai 2016 um 10:32)

  • Hi,

    thanks - right, there is a bug in the webvr.js that relates to iOS.

    There a code line like this:

    Code
    document.addEventListener(device.browser.events.fullscreenchange, on_fullscreen_change);

    but the 'fullscreenchange' is undefined because there is no HTML5 fullscreen API support in iOS.

    This will be fixed in the next release.

    I think normal browsers are just converting the first argument to a string, so the event name would be 'undefined' and that wouldn't have any effect.


    If it's possible to edit the Cordova code I would recommend changing:

    Code
    var e = evt.toLowerCase();

    to:

    Code
    var e = (""+evt).toLowerCase();

    Then this the argument will be always converted to a String and even invalid usage cases will be handled well.

    Best regards,
    Klaus

  • Hi,

    I had the same issue with a Cordova app running a WebVR pano on iOS.
    The fix mentioned above did work and the VR button did activate the VR mode, but then the app would just render a blank screen instead of the expected stereoscopic view.
    I know that since iOS 7 Webview-based apps cannot run in fullscreen mode, could it be the issue here ? I tried to emulate fullscreen by hiding the nav and status bars, but the tour still won't display in stereo. Nothing shows in the krpano console or in the safari remote debugger either...

    engwan did you manage to display the tour eventually ?

    Thanks !

  • Hi,

    I had the same issue with a Cordova app running a WebVR pano on iOS.
    The fix mentioned above did work and the VR button did activate the VR mode, but then the app would just render a blank screen instead of the expected stereoscopic view.
    I know that since iOS 7 Webview-based apps cannot run in fullscreen mode, could it be the issue here ? I tried to emulate fullscreen by hiding the nav and status bars, but the tour still won't display in stereo. Nothing shows in the krpano console or in the safari remote debugger either...

    engwan did you manage to display the tour eventually ?

    Thanks !

    Yeah, the tour works in VR after I made that change. It was the only change I made.

    Haven't encountered what you described so I can't tell.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!