Ar.js: Camera not active in Ionic-iOS

Created on 9 May 2019  路  11Comments  路  Source: jeromeetienne/AR.js

Describe the bug
When using aframe in an Ionic based application, the camera is not started. Also the following error is given in the console log:

[Error] Not allowed to load local resource: blob:blobinternal:///480951e5-1001-423b-837f-2f6d1572d469

Some more details about the project, by default on iOS there is no webrtc when using Ionic. We use the iosrtc plugin to solve this. I can open the camera when using the rtc api (getUserMedia etc).

Ionic/iOS uses wkwebview, this view does have issues with getting local files. (see https://ionicframework.com/docs/v3/wkwebview/). I suspect this is related to the problem, but am not sure..

When plotting a simple box, I can see the box, but not the camera view.

To Reproduce
Steps to reproduce the behavior:
Build the cordova/ionic app at https://github.com/abroekhuis/ionic-aframe. Run on a recent iOS device and view console log using Safari Development options.

Expected behavior
Working camera

Desktop (please complete the following information):

  • OS: Cordova/Ionic on iOS
  • Browser: WkWebview plugin from Ionic (https://ionicframework.com/docs/v3/wkwebview/)

Smartphone (please complete the following information):

  • OS: Cordova/Ionic on iOS 12.2
  • Browser: WkWebview plugin from Ionic (https://ionicframework.com/docs/v3/wkwebview/)
integration

Most helpful comment

@janpio yeah, it works, I am using the latest SDK with my S8+ (up to date with Android 9).
On Android we did have to use an iframe for viewing the camera image, without it, only a narrow band is shown on a small part of the screen. Perhaps this can be solved with aframe/ar, but haven't yet found out how.
I've updated the example at https://github.com/abroekhuis/ionic-aframe.

All 11 comments

WebViews are not supported in AR.js.

@janpio too bad :(. It works great on Android though. And with the iosrtc plugin, rtc is available on iOS as well.
Any pointers to what is going wrong, and is needed to get it to work in a webview?

Perhaps not the right place to ask, are there any known alternatives for this?

It works great on Android though.

Oh really? Which Android version?

@janpio yeah, it works, I am using the latest SDK with my S8+ (up to date with Android 9).
On Android we did have to use an iframe for viewing the camera image, without it, only a narrow band is shown on a small part of the screen. Perhaps this can be solved with aframe/ar, but haven't yet found out how.
I've updated the example at https://github.com/abroekhuis/ionic-aframe.

AR.js with webView ? That's great @abroekhuis ! but no idea how to solve this issue, sorry... :smile:

@janpio Any pointers on where I should look for the enabling of the camera?

No idea, sorry.

Have you tried using Ionic's Capacitor plug-in with their Camera API? I have not tested, but it sounds like a possible solution. Please let us know if this works.
https://www.joshmorony.com/using-the-camera-api-in-a-pwa-with-capacitor/
and to install the plug-in:
https://capacitor.ionicframework.com/docs/pwa-elements/

@abroekhuis I'm working on iosrtc+ar.js as well, are you still?

@benallfree No, we opted to move to a native solution, in which we can properly use arkit and 3d models. We tried with AR.ja/AFrame, but, sadly enough, kept running into issues. :(

please continue discussing this, along with other JS framework-related stuff, at: https://github.com/AR-js-org/AR.js/issues/17

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bug-Reaper picture Bug-Reaper  路  51Comments

mpacary picture mpacary  路  25Comments

nicolocarpignoli picture nicolocarpignoli  路  23Comments

mercem picture mercem  路  43Comments

freinbichler picture freinbichler  路  27Comments