Closed kayy closed 8 months ago
The following patch modifies the ReplaceTrackSample.cs in that stream2 is created on the fly. After 1-2 seconds it freezes.
Maybe this was intentionally and by design, but in this case this should be documented and MediaStream.AddTrack should behave the same way. ReplaceTrackSample_stream2-local.patch
memo: WRS-478
@kayy I am sorry to reply lately. I checked the sample code. As you said, this behaviour is by design.
I would like to add comments to MediaStream class and Camera.CaptureStreamTrack method.
@kayy Can I close this issue?
@kayy Can I close this issue?
Yes. Adding some comments is fine
Package version
3.0.0-pre.5
Environment
Steps To Reproduce
Current Behavior
After a few seconds the stream gets frozen
Expected Behavior
The stream remains active
Anything else?
The initial track created with MediaStream.AddTrack is cached internally in a HashSet cacheTracks. Thus this will run without any issues.
Replacing a track breaks this behaviour. Thus the caller need to hold a reference to avoid disposing the track.
Underlying use case: Dynamic resizing of tracks in response to size changes in the HTML part. Calling ReplaceTrack method avoids renegotiation and the tracks are created on the fly without any need to to take care them.