-
Notifications
You must be signed in to change notification settings - Fork 56
Add experimental device utils #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: a9100d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
87b8126 to
a9100d7
Compare
299b5ba to
99fa131
Compare
|
Still WIP here — lots of very exciting stuff! Just need to get all the kinks ironed out. |
1097226 to
2b1e872
Compare
Lock session to initiator Add getMic and getCamera utils fix activeDevice$ to use latest Add createAudioSink API Add example for cleaning up sink Fix lint errors add retainIdleTrack option Fix issue w/ camera not having a device with id "default" Persist device selection and deprioritize some devices Remove getDevice export Fix bug in cleanup logic Fix build script Allow for specifying fallbackTrack$ Add transformationMiddleware Update exports Add delay(0) for React StrictMode
Add permissions utility
Previously when using switchMap there was an issue with acquiring a screenshare because the fallbackTrack would be unsubscribed from immediately, while the screenshare track could take as long as the user wants to make their selection. This resulted in frames in the fallback track stopping, and could prevent the track from being pulled successfully in some cases.
Since BehaviorSubject emits the current value to new subscribers immediately, we should use value when initializing the previousValueRef to prevent unnecessary emissions if the initial value is something other than undefined.
9a59887 to
494c00c
Compare
threepointone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so good. I'm going to land and release this so we can play with it.
Description
This PR adds new helpers for acquiring tracks via mic, camera, and screen-share. The existing
resilientTrack$is great and still used internally, but there was still quite a bit of management involved in using it.It also adds a recommended helper for playing audio from many tracks on a single audio element since there's some funky cross-browser behavior issues we want to handle for people so they don't need to know/care about it.
Example Code
Broadcast and Source Enablement API's
In order to help explain the relationship between the public API's (circular nodes in the chart below) and the internal data flow, I've created this chart!
We're using error$ as the API to expose errors so that the other observables for emitting tracks can reliably continue forever without completing/erroring.
flowchart TD SourceContent[Source Content] FallbackContent[Fallback Content] IsSourceEnabled$((isSourceEnabled$)) IsBroadcasting$((isBroadcasting$)) LocalMonitorTrack((localMonitorTrack$)) BroadcastTrack((broadcastTrack$)) Error[Error] Error$((error$)) EmitError[Emit Error] Cancelled[Cancelled] DisableSource[Disable Source] IsSourceEnabled$ -- No --> FallbackContent IsSourceEnabled$ -- Yes --> Error Error -- Yes --> EmitError Error$ ----> EmitError EmitError ----> DisableSource Error -- No --> Cancelled Cancelled -- Yes --> DisableSource Cancelled -- No --> SourceContent DisableSource ----> IsSourceEnabled$ LocalMonitorTrack ----> IsSourceEnabled$ BroadcastTrack ----> IsBroadcasting$ IsBroadcasting$ -- Yes --> IsSourceEnabled$ IsBroadcasting$ -- No --> FallbackContentLocking sessions to initiator
We're also now (by default) locking sessions to the user who created the session via a cookie w/ a JWT in it. This option can be disabled by setting
lockSessionToInitiatorto false: