exception when populating a new mediastream in the chrome browser

129 views
Skip to first unread message

Eric Davies

unread,
Nov 10, 2014, 9:27:42 PM11/10/14
to discuss...@googlegroups.com
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.

Philipp Hancke

unread,
Nov 10, 2014, 9:46:12 PM11/10/14
to discuss...@googlegroups.com
The last time I saw that error, changing the order of addTrack/removeTrack helped. The MS seemed to go to ended/finished once the number of tracks went to zero.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Davies

unread,
Nov 10, 2014, 11:16:30 PM11/10/14
to discuss...@googlegroups.com
Yes, that was it! Thank you Philipp.
Reply all
Reply to author
Forward
0 new messages