dolbyio-samples / rts-app-react-publisher-viewer

A Real Time Streaming App example for dolby.io
MIT License
15 stars 9 forks source link

Issue 271 reimplement local file management in publisher #272

Closed jackshen closed 1 year ago

jackshen commented 1 year ago

Issue: https://github.com/dolbyio-samples/rts-app-react-publisher-viewer/issues/271

This PR changes how local files are set in state and used in publisher.

Previously, object URLs were created from files and stored in application-level local state. This was used to iteratively render video tiles, where the object URL was provided as the video's src. This was a temporary implementation where the iterative rendering was duplicated from the existing solution being used by device and screenshare videos.

The new solution merges the management of videos and mediastreams of local files into the existing solution, useMultiMediaDevices. As this hook has become more generic in handling screenshare and local files in addition to devices, it has been renamed to useMultiMediaStreams. Furthermore, this is a generic solution for providing the Millicast SDK with the correct mediastreams for each video source. This means the user can now correctly see local file videos in the Viewer app.

As part of this PR, the deprecated and unused hook useMediaDevices has been completely removed.