Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Passing saved audio tracks down to unique tile components in Daily video chat React app
// In Tile.js
* When video track changes, update video srcObject
useEffect(() => {
videoEl.current &&
(videoEl.current.srcObject = new MediaStream([props.videoTrack]));
}, [props.videoTrack]);
* When audio track changes, update audio srcObject
useEffect(() => {
audioEl.current &&
(audioEl.current.srcObject = new MediaStream([props.audioTrack]));
}, [props.audioTrack]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment