jeeliz/jeelizWeboji

detach and reattach camera/canvas

KeiPG opened this issue · 3 comments

KeiPG commented

Hello @xavierjs ,
hope you can help us again.
We need to be able to use the camera in other parts of our project.Is there a way to to detach and reattach the camera to the JFT?
We are hoping you would be able to tell us how we could do this.

Many Thanks ,
Kei

Hi KeiPG,

I have added the JEEFACETRANSFERTAPI.get_video() method so that you can get the <video> element linked to the camera video feed.

Then you can pause Weboji to save resources, hide the canvas using CSS and use this video element for another use.

I advise to not do multiple getUserMedia request on the same page, many implementations of mediaStream API are not good. You should keep 1 getUserMedia request and use the same <video> element.

If you need front/back camera or different resolution it would be better to do a multi-page app (even if it is not encouraged by React and all these kind of shit) to force the browser to free the camera access.

Best,
Xavier

KeiPG commented

hi xavier
sorry for the late reply i have been quite ill and haven't got around to it. thanks for the all the help and we might need to ask a few more question of you soon if you dont mind. but seriously thank you for all the help you have provided us.

kind regards KeiPG

No worries, I was closing the issue since I had added a stuff to fix it.
Feel free to ask questions about the library here (or links to the demos you did with it).

Best,
Xavier