-
Notifications
You must be signed in to change notification settings - Fork 115
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
Legacy getRemoteStreams() in Unified Plan #1890
Comments
On second thought, a receiver that is not "active" yet will not have any remote streams associated with it, so maybe the original "All streams of all receivers" will work anyway. |
I'm leaving the issue open for now in case there is something worth discussing, e.g. is the receiver's set of associated streams guaranteed to reflect the notion of "getRemoteStreams()", but feel free to close this issue if I'm not mistaken. |
getRemoteStreams isn't just legacy, it's been removed from the spec. Also leaving the issue open in case there are comments needed, but (strictly with my formal WG hat on) intending to close it after a while as "none of our business" |
getRemoteStreams() is not in the spec but we should zoom out and look at the use case it highlights, and discuss whether or not there is a legitimate need to know which are the "active" receivers.
"What are the active receivers?" was something the application used to be able to easily figure out at step 3 upon the promise resolving (in Chrome). With correct ontrack and onmute wiring the application can figure out which receivers are currently "active" (unless remote onmute can fire for other reasons?), but it's not as easy as "getReceivers() and look at direction/currentDirection". So before we close this - from a usability and shimmability standpoint: Do we care? |
It may be possible for the application to maintain its own set of "active receivers", that it adds to from ontrack and removes from on onmute, but it is not as convenient as "getRemoteStreams()", and getReceivers()/RTCRtpReceiver does not seem feature complete if there is no way to tell whether or not it is "active". |
A good question wrt "what are the active receivers" is "why do you want to know?". The answers to pc.getReceivers().filter(r => { if (!r.stream.ended) return r; }) pc.getReceivers().filter(r => { if (!r.stream.muted) return r; }) pc.getReceivers().filter(r => { if (r.getStreams()) return r; }) should all be able to be different, and only the last one seems like it's relevant to getRemoteStreams(). I suggest removing the discussion of getRemoteStreams() from the question of active receivers; they seem orthogonal to me. |
(note: I think we should have a getStreams() method on RTCRTPReceiver, which returns the streams that have been created based on the stream IDs that the receiver has been signalled in this media section. There is currently no way to get at the information about the stream IDs that have been signalled, and the mapping from receiver to stream can't be performed by just looking at the IDs (I think), so accessing this internal state needs a new API.) |
Currently, the receiver's streams is an internal slot, but it is exposed in the ontrack event. I agree this information should be exposed, else we force people to listen to ontrack & friends to maintain their own version of this "slot". Because transceivers are reusable I would argue that if you give me a PC I should be able to inspect its state without having had to listen to a history of events to piece together what its state are from ontrack & friends. This would be useful for any utils. |
I'll file a new issue |
Chrome's legacy getRemoteStreams() is currently, under Plan B, defined as:
This works because inactive receivers are removed. In Unified Plan, this does not work because transceivers stick around forever. We can look at their currentDirection though:
currentDirection is chosen, as opposed to direction, because otherwise merely offering to receive would count as a receiver being "active". This does not jive with current definitions of getRemoteStreams().
There is a problem here though. The receiver's currentDirection is not updated at setRemoteDescription(offer), but rather at setLocalDescription(answer). We get a changing behavior:
In order for the browser or application to know what receivers are "active" we need to expose what direction was offered/answered by the remote end.
Questions:
The text was updated successfully, but these errors were encountered: