- From: guest271314 via GitHub <sysbot+gh@w3.org>
- Date: Thu, 09 May 2019 15:59:45 +0000
- To: public-webrtc-logs@w3.org
guest271314 has just created a new issue for https://github.com/w3c/mediacapture-main: == Add replaceTrack method to MediaStream == Related: - https://github.com/w3c/mediacapture-record/issues/4 - https://github.com/w3c/mediacapture-record/issues/166 - https://github.com/w3c/mediacapture-main/issues/575 - https://github.com/w3c/webrtc-pc/issues/2171 Given a `MediaStream` instance either created using `new MediaStream()` and/or by `getUserMedia()`, `HTMLMediaElement.captureStream()`, add a `replaceTrack()` method directly to the existing `MediaStream` which behaves similarly to `RTCRtpSender.replaceTrack()` https://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-replacetrack > NOTE > > There is not an exact 1:1 correspondence between tracks sent by one RTCPeerConnection and received by the other. For one, IDs of tracks sent have no mapping to the IDs of tracks received. Also, replaceTrack changes the track sent by an RTCRtpSender without creating a new track on the receiver side; the corresponding RTCRtpReceiver will only have a single track, potentially representing **multiple sources of media stitched together**. Both addTransceiver and replaceTrack can be used to cause the same track to be sent multiple times, which will be observed on the receiver side as multiple receivers each with its own separate track. Thus it's more accurate to think of a 1:1 relationship between an RTCRtpSender on one side and an RTCRtpReceiver's track on the other side, matching senders and receivers using the RTCRtpTransceiver's mid if necessary. (emphasis added) The primary use case for adding a `replaceTrack` method to `MediaStream` is for the ability to record media (for example following a call to `HTMLMediaElement.captureStream()`) with `MediaRecorder` where the `src` attribute of the `HTMLMediaElement` is changed (currently `MediaRecorder` stops recording when a track is added to the `MediaStream` being recorded by means of `src` of `<video>` or `<audio>` element changing). This https://github.com/guest271314/MediaFragmentRecorder/blob/webrtc-replacetrack/MediaFragmentRecorder.html is currently possible using `RTCPeerConnection` (proof of concept) though should be possible without the end-user having to manually create two `RTCPeerConnection` instances to achieve the requirement. Instead, the end-user should simply be able to execute `<MediaStreamInstance>.replaceTrack(withTrack)` where internally `replaceTrack(withTrack)` achieves the same functionality of `RTCRtpSender.replaceTrack()` > multiple sources of media stitched together > which will be observed on the receiver side as multiple receivers each with its own separate track Filing this issue before filing a PR for changes to the respective specification(s). Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/586 using your GitHub account
Received on Thursday, 9 May 2019 15:59:47 UTC