Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does addTrack require the streams argument? #288

Closed
jan-ivar opened this issue Sep 1, 2015 · 3 comments
Closed

Does addTrack require the streams argument? #288

jan-ivar opened this issue Sep 1, 2015 · 3 comments

Comments

@jan-ivar
Copy link
Member

jan-ivar commented Sep 1, 2015

In 5.1 the processing model for addTrack, there's no mention of the streams argument. Is streams required? E.g. Does this work or cause an error (which error)?

navigator.mediaDevices.getUserMedia({ video: true })
.then(stream => {
  var track = stream.getVideoTracks()[0];
  stream.removeTrack(track);
  new RTCPeerConnection().addTrack(track);
})

Interestingly, #processing-remote-mediastreamtracks tolerates reception of stream-less tracks:

  1. If streams is an empty list, create a new MediaStream object and add it to streams.

But if the code I wrote above fails, then step 5 seems redundant.
If the code I wrote above does not fail, then I have a larger question.

The larger question is: Can a live track be consumed outside of a stream (assuming PeerConnection is a consumer)?

The MediaStream and Capture spec suggests no, defining “consumer” to be solely of a stream.

Yet the WebRTC spec seems to play fast and loose with this rule, talking about tracks with "inputs" and "outputs" with no mention of streams:

  • "The concepts of an input and output to a given MediaStreamTrack ..."
  • "The RTP media API lets a web application send and receive MediaStreamTracks over a peer-to-peer connection. Tracks, when added to a RTCPeerConnection, result in signaling; when this signaling is forwarded to a remote peer, it causes corresponding tracks to be created on the remote side."

I think some clarification in the spec here would help.

@stefhak
Copy link
Contributor

stefhak commented Oct 22, 2015

My understanding is that your code should not fail (it should be OK to send just a track).
But I agree to that the spec should be clarified.

@stefhak
Copy link
Contributor

stefhak commented Oct 23, 2015

@stefhak
Copy link
Contributor

stefhak commented Oct 28, 2015

Not much input given on the list, but the input given seems to agree that it should be OK to do addTrack without have a stream argument. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants