W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > May 2019

Re: [mediacapture-main] Add replaceTrack method to MediaStream (#586)

From: guest271314 via GitHub <sysbot+gh@w3.org>
Date: Tue, 14 May 2019 05:13:42 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-492081429-1557810821-sysbot+gh@w3.org>
@alvestrand In brief, the `MediaRecorder` specification stops recording when a `MediaStreamTrack` is added or removed from a `MediaStream` whether the tracks are added by `src` attribute of `HTMLMediaElement` is changed and the `MediaStream` returned by `captureStream()` has tracks added and `addtrack` event is dispatched or `addTrack()` and/or `removeTrack()` is called directly on the `MediaStream` which does not dispatch `addtrack` event.

The difference is that "replaceTrack()" defined as a method of `MediaStream` should behave similarly to or the same as `RTCRtpSender.replaceTrack()` without explicitly using `RTCPeerConnection()` where the recorded `MediaStreamTrack` "potentially representing multiple sources of media stitched together" remains the same as to `MediaRecorder` resulting in `MediaRecorder` not stopping recording. e.g., 
let mediaStream = new MediaStream([videoTrack, audioTrack]);
// do stuff
let nextVideoTrack = nextVideoTrack; // MediaStreamTrack 

videoCapturedStream.onaddtrack = e => {



Adding `replaceTrack()` to `MediaStream` would provide the ability to switch media resource stream and allow `MediaRecorder` specification (which adding ability to switch between multiple live video and audio tracks and not stop the recorder instance might require adjustments that this proposal) to not have to be adjusted, while adding functionality to all specifications and API's which use `MediaStream`.

GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/586#issuecomment-492081429 using your GitHub account
Received on Tuesday, 14 May 2019 05:13:45 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:47 UTC