Re: [mediacapture-record] MediaRecorder needs to define effect of adding / removing tracks in its input MediaStream (#4)

@Pehrsons 

> I still think we need a way to support changes to the track set, since there's no way to plug video tracks in and out under a video track at will, like you can with web audio for audio tracks.
> 
> The simplest use case showing that this is needed is recording a captured video element like @guest271314 mentions, since that wouldn't survive a change of `src` or changing the selected tracks.
> 
> The best proposal (clearly I'm biased, but I don't recall seeing any other proposals either) I've seen for fixing this is defining a mode for individually playable chunks [1][2][3], as this would make the track problem an MSE problem (where changing the track set is permitted AIUI). I.e., on a track set change you'd finish the existing chunk and start gathering into a new chunk. It would also fix #119 natively, and #67, in the process.
> 
> If there was a way to plug video tracks like I mentioned in the beginning, I could live without supporting track set changes. The only way currently is canvas capture but it has major drawbacks such as running on main thread, not staying in sync with audio, not rendering in background tabs or when hidden, etc. FWIW I think individually playable chunks could still be worthwhile just for the sake of #119 and #67.
> 
> As for a next step.. get the discussion going to see where people stand?
> 
> [1] [#67 (comment)](https://github.com/w3c/mediacapture-record/issues/67#issuecomment-238851324)
> [2] [#67 (comment)](https://github.com/w3c/mediacapture-record/issues/67#issuecomment-247283783)
> [3] [#119 (comment)](https://github.com/w3c/mediacapture-record/issues/119#issuecomment-283608154)

Composed code that utilizes `RTCPeerConnection()`, `RTCRtpSender.replaceTrack()` which achieves the requirement at Firefox and Chromium. For Firefox implementation played the first track `0.2` seconds, caught and handled `SecurityError` when `MediaRecorder.start()` is called, then replayed the first track in the array (see https://bugzilla.mozilla.org/show_bug.cgi?id=1544234#c4).

The functionality of `RTCRtpSender.replaceTrack()` appears to be capable of being incorporated into `MediaRecorder`, e.g., `MediaRecorder.replaceTrack(withTrack)`. Am tentatively considering filing a PR for such a change to this specification (see https://github.com/w3c/mediacapture-record/issues/147#issuecomment-480580164; https://github.com/w3c/webrtc-pc/issues/2171) though without necessitating explicitly using `RTCPeerConnection()`. 

-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-record/issues/4#issuecomment-482938413 using your GitHub account

Received on Sunday, 14 April 2019 09:39:26 UTC