I'm trying to build a new mediastream in the chrome browser. My approach is:
find an existing mediastream object already created, clone it, remove all it's tracks, and then call it's addTrack method to add video tracks and audio tracks from other media streams.
The first time I try to add a media track, I get the following exception being thrown:
Uncaught DOMException: Failed to execute 'addTrack' on 'MediaStream': The MediaStream is finished.code: 11
message: "Failed to execute 'addTrack' on 'MediaStream': The MediaStream is finished."name: "
InvalidStateError"stack: "Error: Failed to execute 'addTrack' on 'MediaStream': The MediaStream is finished.↵
at Error (native)↵
at buildLocalMediaStream (http://localhost:8080/easyrtc/easyrtc.js:1785:24)↵
at <anonymous>:2:17↵
at Object.InjectedScript._evaluateOn (<anonymous>:732:137)↵
at Object.InjectedScript._evaluateAndWrap (<anonymous>:665:34)↵
at Object.InjectedScript.evaluate (<anonymous>:579:21)"__proto__: DOMException easyrtc.js:1785buildLocalMediaStream easyrtc.js:1785(anonymous function) VM736:2InjectedScript._evaluateOn VM734:732InjectedScript._evaluateAndWrap VM734:665InjectedScript.evaluate VM734:579
The mediastream whose tracks I'm borrowing is still displayed in a video object, so it's definitely live.
I've tried adding clones of the tracks, but that doesn't make any difference.
Any thoughts?
Eric.