question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabled MediaStreamTrack sends no data

See original GitHub issue

Expected behavior

When a MediaStreamTrack is muted, it should continue sending either black frames if video, or silent frames if audio. This is the default implementation in Chrome/Webkit/etc., and is also mandated by the standard. In https://w3c.github.io/mediacapture-main/#life-cycle-and-media-flow:

Applications are able to enable or disable a MediaStreamTrack to prevent it from rendering media from the source. A muted track will however, regardless of the enabled state, render silence and blackness. A disabled track is logically equivalent to a muted track, from a consumer point of view.

Also:

Enabled/disabled on the other hand is available to the application to control (and observe) via the enabled attribute.

The result for the consumer is the same in the sense that whenever MediaStreamTrack is muted or disabled (or both) the consumer gets zero-information-content, which means silence for audio and black frames for video. In other words, media from the source only flows when a MediaStreamTrack object is both unmuted and enabled. For example, a video element sourced by a muted or disabled MediaStreamTrack (contained in a MediaStream ), is playing but rendering blackness.

Observed behavior

when using react-native-webrtc, we noticed that disabling a track causes it to cease sending any information whatsoever. This is because of the following changes:

https://github.com/react-native-webrtc/react-native-webrtc/commit/1d831e17c1279a8051bc2b047c1297eede480656#diff-bf46ca521b9b533fee2c317a9d034e01 for iOS, and https://github.com/react-native-webrtc/react-native-webrtc/commit/47b3d5a7e85bc06466dd0b3c5f3c8b2528e9ae5d#diff-0c50b3d88b89df8825cac7857642bc29 on android.

It isn’t clear to me why these changes were made based on git history (I couldn’t find an issue that referenced the changes), but it’s definitely not compliant with with media capture spec.

Steps to reproduce the problem

Disable a MediaStreamTrack Note that no frame data is sent for that track.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
saghulcommented, Feb 28, 2020

No progress and no workaround that I’m aware of.

0reactions
stale[bot]commented, Oct 4, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MediaStreamTrack.enabled - Web APIs - MDN Web Docs
When enabled, a track's data is output from the source to the destination; otherwise, empty frames are output. In the case of audio,...
Read more >
Media Capture and Streams - W3C
A muted or disabled MediaStreamTrack renders either silence (audio), black frames (video), or a zero-information-content equivalent. For example ...
Read more >
webRTC - disable media sent to remote peer but not local media
The problem is that you are using the same MediaStreamTrack instance for both local display and streaming.
Read more >
how to detect if remote video is disabled - Google Groups
How can i detect that there is actually no new video data ? Hope somebody can help me with that. Alessandro Toppi's profile...
Read more >
MediaStreamTrack
Chrome Edge Firefox MediaStreamTrack Chrome Full support Yes Edge Full support Yes Firefox Full support 22 applyConstraints Chrome Full support 63 Edge Full support 12...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found