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...
学习ing2017-06-10 09:50:52
stream.getTracks()[0].stop();
stream is the instance in getUserMedia onSuccess callback
Please refer to the documentation
女神的闺蜜爱上我2017-06-10 09:50:52
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 */
});