Re: [mediacapture-record] Add replaceStream to MediaRecorder (#186)

Discussed this with @Pehrsons and we have some concerns with this API.

While browsers today appear limited to recording only one video track and one audio track, there's no such limitation in the spec, so we think we need to consider how to handle several tracks.

Say someone records a stream like this:
const stream = new MediaStream([videoTrack, englishAudioTrack, frenchAudioTrack]);
const recorder = new MediaRecorder(stream);
How would they replace just the french audio? Tracks in a MediaStream unfortunately are unordered.

So we'd like to propose this instead:
await recorder.replaceTrack(frenchAudioTrack, directorsCommentaryTrack);
In addition, we propose to no longer stop the recorder if a stream's track-set changes, because it no longer makes sense to react to those. Instead, we'd copy the track-set in `start()`, and only stop on the first track `ended`.

If the tracks' isolation properties differ, `replaceTrack` would reject with `SecurityError`.

If`stop()` followed by `start()` is called again then the stream can be examined anew.

GitHub Notification of comment by jan-ivar
Please view or discuss this issue at using your GitHub account

Received on Friday, 13 September 2019 23:33:56 UTC