google-ar / WebARonARCore

An experimental Chromium modification in the form of an app for Android that lets developers build Augmented Reality (AR) experiences using web technologies on top of Google's ARCore.
https://developers.google.com/ar/develop/web/getting-started
Apache License 2.0
756 stars 115 forks source link

All pages trying to access the webcam either crash or do not load #36

Closed Utopiah closed 6 years ago

Utopiah commented 6 years ago

I tried with a Pixel2 to use a based QR code reader in JavaScript to load a generated link but without success. I guess the camera is locked to be used solely for AR?

judax commented 6 years ago

Yes, this is an Android limitation. Right now WebARonARCore is initializing ARCore at the beginning of the app initialization. In the future, specially if we move towards WebVR 2.0, this could change as the concept of session exists and the magic window mode (best suited for smartphone AR) is explicitly supported. I guess that you would like to open a page with gerUserMedia support but no AR right? Anyway, accessing the camera from 2 sources (WebRTC and ARCore) is not going to be possible very likely.

Specifically for QRCodes, we are adding support for marker detection in WebARonARCore so you may be lucky and use it for the same use case you are specifying.

Utopiah commented 6 years ago

Yes I wanted no AR, a traditional page yet with gerUserMedia(), then navigate to a page with AR.

OK no worries I can get around that it's just that this step was part of a process I tried yesterday and I was curious if the limitation was on my end or not, thanks for clarifying.

judax commented 6 years ago

Yeah. I can only state that we will try to do a better job implementing ARCore inside Chrome in the near future and it should be possible to use getUserMedia in pages that do not use AR. But I can clearly foresee is going to be "impossible" to enable getUserMedia and AR at the same time.

On the other hand, on Android at least, you should be able to render the camera feed to a canvas and then get the pixels from it. AFAIK, that's the standard way to get the pixels from the camera with getUserMedia. Anyway, as mentioned, there is already QRCode marker support in WebARonARCore already (even with pose estimation!). Check out this example: https://github.com/google-ar/three.ar.js/blob/master/examples/tango/marker.html

Utopiah commented 6 years ago

Great I'll try that example. Thanks