[webrtc-pc] CaptureStream adds mediaTracks with delay, we need a callback?

IvRRimum has just created a new issue for 
https://github.com/w3c/webrtc-pc:

== CaptureStream adds mediaTracks with delay, we need a callback? ==
When calling video.captureStream() getTracks() returns empty array, 
but after 1.5 seconds, it returns tracks as expected.

Error produced if no tracks are added: 
http://stackoverflow.com/questions/40472743/webrtc111-error-domexception-internalerror-cannot-create-an-offer-with-no-lo

Adding this for doc purposes, as others might find this confusing.

Solution:

setInterval(function(){
      // We wait till the mediaTracks are added to mediaStream
      console.log(stream.getTracks());
      // Further actions with the mediaStream
}, 1000);

Thanks!

Please view or discuss this issue at 
https://github.com/w3c/webrtc-pc/issues/923 using your GitHub account

Received on Tuesday, 8 November 2016 13:28:42 UTC