VinceG / vue-web-cam

Webcam component for VueJs.
MIT License
257 stars 110 forks source link

Stop camera doesn't turn off the camera #12

Closed iamajvillalobos closed 5 years ago

iamajvillalobos commented 5 years ago

The stop() method doesn't seem to turn off the camera. See this video https://drive.google.com/file/d/1ASBcPxJ1i1GrU0sCjNgrEloTi46TciCL/view?usp=sharing

VinceG commented 5 years ago

@iamarmanjon Thank You. This should now be fixed in v1.2.5

iamajvillalobos commented 5 years ago

Trying this on my project and also on the demo. But it seems the closing of the tracks is inconsistent. I'm not sure actually if this is a problem with the HTML5 API. Because alternatively, I tried to close the tracks myself. Finding the video tag, getting the srcObject and closing the tracks myself. It works inconsistently too.

Here's a video again for demonstration: https://drive.google.com/file/d/1R-OimOPm49yRLP-nlsjKqJ2oZ758He5U/view?usp=sharing

VinceG commented 5 years ago

@iamarmanjon I had the same issue while testing, it seems the very first time when the page loads and you try to stop it the webcam doesn't seem to stop. If you start and stop it again without refreshing it'll stop.

In both cases it stops the track and empties the video srcObject. I am not entirely sure what else needs to happen in order to properly stop it. The API i used in the component is a copy paste from the HTML5 API shown here: https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/stop#Example

I am open for suggestions or help in trying to fix this.

iamajvillalobos commented 5 years ago

Thanks for putting some time into it. I will do some research on my end too. Will update you.

cesswhite commented 5 years ago

Any solution for that?

sbaudino commented 5 years ago

I have the same issue. Any research?

guinaldi commented 5 years ago

Any solution on this? Tried to stop the tracks manually too but no success... I notice some strange behavior on opening chrome DevTools. Sometimes turns off the webcam after i call the stop function on tracks.

VinceG commented 5 years ago

@guinaldi Can you try calling the stop twice ?

ghostvar commented 5 years ago

may you can try this one, its works as expected. i am make own camera component based this in my project.

https://webrtc.github.io/samples/src/content/devices/input-output/