Skip to content

feat: add data channel to report muted state#84

Merged
WofWca merged 1 commit intomainfrom
wofwca/muted-state-datachannel
Feb 4, 2026
Merged

feat: add data channel to report muted state#84
WofWca merged 1 commit intomainfrom
wofwca/muted-state-datachannel

Conversation

@WofWca
Copy link
Copy Markdown
Member

@WofWca WofWca commented Jan 27, 2026

This addressed the "remote video" part of #62.

TODO:

I have tested this with a Desktop <-> Desktop call, and the remote's avatar is correctly shown when they enable / disable video, even if they disabled it before the call has started.

This change is backwards-compatible, i.e. the remote does not have to support this data channel and report its muted state - it's optional.

@WofWca
Copy link
Copy Markdown
Member Author

WofWca commented Jan 27, 2026

@Amzd I suggest this protocol for communicating the muted state in a way other than replaceTrack(null) (which is not reliable).

@Amzd
Copy link
Copy Markdown

Amzd commented Jan 27, 2026

This can work for iOS. Should be fine. Can you add more detail on why replaceTrack doesn't work? That api would still be preferred even with the datachannel since otherwise the webapp keeps sending black frames(wasting bandwidth), right?

@WofWca
Copy link
Copy Markdown
Member Author

WofWca commented Jan 27, 2026

That api would still be preferred even with the datachannel since otherwise the webapp keeps sending black frames(wasting bandwidth), right?

Yes, if replaceTrack worked properly (or at least as we expect it), we wouldn't need a data channel.

Can you add more detail on why replaceTrack doesn't work?

I think you mentioned that it's not nice that the last frame is being shown for a second or two after you disable the video.
Additionally, the muted state is apparently not always received by the remote.

I will add comments in the code.

@Amzd
Copy link
Copy Markdown

Amzd commented Jan 27, 2026

Okay so replaceTrack issues:

  • last frame remains on screen when turned off (because it stops sending black frames)
  • the muted state is not always received by the remote

Both of these issues are fixed by the datachannel of this PR, and replaceTrack(null) still brings the advantage of saving the bandwidth of the black frames so I think it would be nice to have both the datachannel and the replaceTrack.

@WofWca WofWca force-pushed the wofwca/muted-state-datachannel branch 2 times, most recently from b60b1fd to 382abf8 Compare February 4, 2026 13:30
@WofWca WofWca changed the title WIP: feat: add data channel to report muted state feat: add data channel to report muted state Feb 4, 2026
@WofWca WofWca force-pushed the wofwca/muted-state-datachannel branch from 382abf8 to 5ff2675 Compare February 4, 2026 13:32
@WofWca WofWca marked this pull request as ready for review February 4, 2026 13:33
@WofWca

This comment was marked as duplicate.

@WofWca
Copy link
Copy Markdown
Member Author

WofWca commented Feb 4, 2026

Umm we just tested the track.muted state again on 481f543, and the muted state is not in fact received by the callee when the caller is iOS. Video was disabled initially. Then the caller enabled and disabled the video, and track.muted remained to be false. Tested with document.querySelector('video').srcObject.getTracks().map(t => [t.kind, t.muted]). IDK if it's the changes that we did to calls-webapp after this comment was made #79 (comment) or the Chromium's inner randomness.
Anyways, this MR should cover this issue.

@WofWca WofWca force-pushed the wofwca/muted-state-datachannel branch from 5ff2675 to edbe8fc Compare February 4, 2026 14:44
@WofWca
Copy link
Copy Markdown
Member Author

WofWca commented Feb 4, 2026

We have tested this MR with the iOS implementation. Works.

@WofWca WofWca requested a review from Amzd February 4, 2026 15:19
@WofWca WofWca merged commit 4ee9b9a into main Feb 4, 2026
1 check passed
@WofWca WofWca deleted the wofwca/muted-state-datachannel branch February 4, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants