html5 - How to turn off the local camera when using the getUserMedia method?
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-10 09:48:52
0
2
1110

I used the navigator.mediaDevices.getUserMedia() method to open the local camera. I need to close it after taking the photo, but how to close it? Help...

女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(2)
学习ing
stream.getTracks()[0].stop();

stream is the instance in getUserMedia onSuccess callback

Please refer to the documentation

女神的闺蜜爱上我
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
      var track = stream.getTracks()[0];  // if only one media track
        // ...
       track.stop();
}).catch(function(err) {
  /* handle the error */
});
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template