1

I am using webcam and microphone for my app. I want to release both the devices when I finish with the video and audio part. Webcam light is on, till the time I explicitly stop sharing it or refresh the page.

I tried implementing answers given in this question but without any luck - Stop/Close webcam which is opened by navigator.getUserMedia

var MediaStream = window.MediaStream;

if (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {
    MediaStream = webkitMediaStream;
}

/*global MediaStream:true */
if (typeof MediaStream !== 'undefined' && !('stop' in MediaStream.prototype)) {
    MediaStream.prototype.stop = function() {
        this.getAudioTracks().forEach(function(track) {
            track.stop();
        });

        this.getVideoTracks().forEach(function(track) {
            track.stop();
        });
    };
}

I am not sure what's wrong.

Community
  • 1
  • 1
Rahul Patil
  • 5,656
  • 6
  • 37
  • 65
  • This seems like a possible Firefox bug and so worth reporting at https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&format=__default__ to get a response. (FWIW I wrote a few more details on reporting Firefox/Gecko web-platform-feature bugs at http://stackoverflow.com/questions/33059442/how-as-a-programmer-to-report-bugs-i-find-in-core-gecko-browser-engine-behavio/33059443#33059443) – sideshowbarker Jan 04 '16 at 23:45
  • which version of firefox are you using, for me it is working perfectly fine [fiddle](http://jsfiddle.net/mido22/965nnr9u/1/) – mido Jan 05 '16 at 02:36
  • I am using FF 43.0.1 – Rahul Patil Jan 05 '16 at 04:43
  • Are you looking at the camera's hardware light or the browser's camera indicator? 43 has [a bug about the latter](https://bugzilla.mozilla.org/show_bug.cgi?id=1192170) which is fixed in 44, but it would only be an issue if your polyfill kicks in, which it shouldn't. Have you tried using the official [adapter.js](https://github.com/webrtc/adapter) polyfill instead? – jib Jan 15 '16 at 03:49

0 Answers0