[Feature Review] Added mute stream event #1244
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Mute stream propagation] - Feature Review
This is a proposal of a new feature, that extends the current one that is already present in the code but it is not consistent in Erizo and P2P mode.
This aims to provide a client side event to inform the "frontend" of a state of the published/subscribed video.
This can be useful for the frontend developers to better handle the frontend layout, such as display an image or avatar when the stream is muted (currently displayed as a black video)
I'll try to explain my problematic with current implementation an examples:
My first thought was to extend updateStream, but It is sent to the controller only if a peerConnection is established (works for Erizo but could not work in p2p mode).
So I implemented a whole new message to send in socket.
Now, every time the stream is muted by publisher, the controller will also know, and if there are subscribers, it propagates the event so they can do something in frontend.
Also, if new clients subscribe this stream, they can inspect the Stream.muted object and can see that the stream is remotely muted (muted by publisher).
Also, everytime the publisher mute/unmute they will receive a Stream event: stream-mute-event with this arg:
meaning that the remote video, is not being sent by the publisher, and we maybe should display something informing the client.
Architecture
Stream.js
When muteAudio or muteVideo is called, all tracks of that kind are muted in local peerConnection, setting them enabled: false;
If is not P2P, the event updatestream is sent to the controller (as before).
Meanwhile another event ('internal-mute-event') is emitted to the room.
The room take care of listening this internal event and managing it with the updateMuteConfigFromStreamEvent function.
This will send an update to the Erizo Controller with the event updateMuteConfig, needed to send a message to all the clients that subscribes that video and to update the internal state of this stream in the controller structure, so that new subscribers will know at the connection to the room that particular stream is muted.
API Changes
There's no change in the APIs
How does it affect Erizo Client?
There is a new Stream event which can be binded by clients to know in realtime when the muting change in that stream.
It was added in the basicexample:
https://github.com/lynckia/licode/pull/1244/files#diff-8f3407c4abcebd856a0057760ef1fcffR110
How does it affect Erizo Controller / Erizo Agent / Erizo JS?
The controller has a new socket message to listen.