Search code examples
html5-videowebrtcgetusermediamediastream

how to get running mediaStream


I've created a webCam Stream with

navigator.getUserMedia({ "video": true }, function(stream){
    videoTag.src = window.URL.createObjectURL(stream);
    videoTag.play();
}

Can I access the MediaStream object in stream in global scope?*

(something like navigator.getAllMediaStreams[0])

*edit: ...without adding logic to the getUserMedia function. My problem case is a qr-decoder-library, that gets the stream for me and I don't want to change the third party code


Solution

  • There is no list of active media streams kept by the browser.

    You can save the stream to for example window.stream.