google-ar / three.ar.js

A helper three.js library for building AR web experiences that run in WebARonARKit and WebARonARCore
https://developers.google.com/ar/develop/web/getting-started
Apache License 2.0
2.91k stars 365 forks source link

is it possible to access the video stream? #98

Closed MoWeg closed 6 years ago

MoWeg commented 6 years ago

Hi,

This project looks really nice! I wasn't able to find any FAQ Page that's why I'm posting my questions as an issue.

Looking through your examples I did not find any usage of the MediaDevices API to obtain the video stream which is probably rendered behind the three.js canvas.

Is there a convenient way to get the video stream?

If not, are the 3D model and the stream rendered on the same canvas element? ( This would possibly enable to canvas.captureStream(...))

I'm currently working on a small AR remote collaboration project of mine. It is a web application using three.js and WebRTC. I was thinking about using three.ar.js to get real tracking. Since I am running on a tight budget and the devices needed are pretty expensive, it would be good to know this stuff in advance.

Thanks and best regards

jsantell commented 6 years ago

The experimental AR APIs do not use getUserMedia, and since the underlying ARKit/ARCore use the camera, it's not possible for both AR and getUserMedia to use the camera at the same time.

The android implementation does expose pixel data to websites and needs to be handled as a texture however the developer prefers, whereas on iOS, the camera feed is rendered directly as the background, with no DOM representation. The ARView component here handles those differences, but you can check out the source to see how to access the camera pixel data and do with it what you'd like.

For future standards work, it currently looks like there'll be a permission-less option to render the camera feed without exposing camera data (like the iOS implementation on our experimental browser WebARonARKit), and in the future would like to expose the camera's pixel data (like the Android/WebARonARCore implementation) which would require user permission.

Hopefully this background information helps!