guest271314
2019-10-11
Problem
Video:
Must use HTMLMediaElement
and captureStream()
, or WebRTC
to get a MediaStream
representation of the media resource including a video track.
Audio:
Must use HTMLMediaElement
and captureStream()
, WebRTC
or Web Audio API to get a MediaStream
representation of the media resource including a video track.
Solution
Add mediaStream()
and mediaStreamTrack()
to Body
mixin of Fetch
async function fetchMediaStreamTrack(audioSrc) {
const request = await fetch(audioSrc);
const mediaStreamTrack = await request.mediaStreamTrack();
}
async function fetchMediaStreamTrack(videoSrc) {
const request = await fetch(videoSrc);
const mediaStream = await request.mediaStream();
}
This addition means that HTMLVideoElement
, HTMLAudioElement
, WebRTC transceiver, Web Audio API are not directly and exclusively needed (at the front-end) to stream media (fetch()
is defined in Worker
, Worklet
).