[Camera.Reactive] How can we close the camera in Camera.Reactive?
Question
Forge component by Fábio Fantato

Hi All,

I'm using the forge of Camera.Reactive, but I can't find how to close the web camera after using. The camera is still open even after I change screen.

I tried this forum's solution which uses javascript, but it doesn't work for me.

https://www.outsystems.com/forums/discussion/60151/close-reactive-camera/

How can we close the camera in Camera.Reactive?

Hi Yusuke Oki,

Please enclose in container and use the visibility option and define where u want to show or collapse the container that contains Camera Reactive component.

Regards,

Faiz Khan. 


Hi Faiz Khan,


Thank you for your replying.


I've tried to enclose in container and define visibility option.

However, After a reactive camera component is visible at once, even if the camera component becomes invisible, my laptop's web camera remains working. 


What I'd like to do is turning off my laptop's web camera after a camera component becoming invisible.


Regards,


Yusuke

Hi Yusuki,
I can turn the camera off with this script.

var mediaStream = video.srcObject;

var tracks = mediaStream.getTracks();

tracks[0].stop();

tracks.forEach(function(track) { track.stop()})

Please run this script through some button action.

Thanks.


Hi Suriya


Thank you for your replying.


I had tried the javascript you shared, but it didn't work basically.

However, after running the javascript and opening developer tools of Web browsers(Chrome and Microsoft Edge) in a few times, I can turns off my pc camera.


Do you have any ideas about this situation?


Best Regards, 


Yusuke

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.