-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-sdk)!: Universal Device Management API (#1127)
Removes the React-specific device management API and replaces it with the universal API that Plain-JS and React Native uses. ### New features - Introduced/improved the following `useCallStateHooks()`: ```ts const { useMicrophoneState, useCameraState, useSpeakerState, useScreenShareState } = useCallStateHooks(); const { microphone, // a shortcut to `call.microphone` -> `call.microphone.toggle()` vs. `microphone.toggle()` isMute, // mic mute state devices, // a list of available microphones to the system selectedDevice, // current mic in use isSpeakingWhileMuted, // true when current user is speaking, while being muted for the others mediaStream, // the current `MediaStream` instance } = useMicrophoneState(); // the other hooks follow a similar pattern ``` - Added `usePersistedDevicePreferences()`: Allows integrators to opt-in to our SDK-default device preferences management - Exposes `useRequestPermission()`: A hook that makes it easier to work with permission requests ### Breaking Changes #### Core SDK - `StreamVideoLocalParticipant` type is removed, as now `audioDeviceId`, `videoDeviceId`, and `audioOutputDeviceId` are managed by the universal device management API - `call.state.localParticipant` now has `StreamVideoParticipant` type - `call.setAudioOutputDevice`, `call.setAudioDevice` and `call.setVideoDevice` are replaced with `call.speakers.select`, `call.microphone.select` and `call.camera.select` APIs #### React SDK - `useAudioPublisher` hook is removed, use `call.microphone.*` APIs. - `useVideoPublisher` hook is removed, use `call.camera.*` APIs - `useToggleAudioMuteState` hook is now replaced with `call.microphone.toggle()` - `useToggleVideoMuteState` hook is now replaced with `call.camera.toggle()` - `useToggleScreenShare` hook is now replaced with `call.screenShare.toggle()` - `<MediaDevicesProvider />` and `useMediaDevices()` hook are removed from the SDK. Respectively, `<StreamCall />` doesn't accept a `mediaDevicesProviderProps` prop anymore. Device initialization can now be done through the exposed `call` instance APIs: ```ts const call = client.call('my-call-type', 'my-call-id'); call.microphone.select(initialAudioInputDeviceId); // replacement for `initialAudioInputDeviceId` call.microphone.enable(); // replacement for `initialAudioEnabled = true` call.camera.select(initialVideoInputDeviceId); // replacement for `initialVideoInputDeviceId` call.camera.enable(); // replacement for `initialVideoEnabled = true` ``` - `useDevices()`, `useVideoDevices()`, `useAudioInputDevices()`, and `useAudioOutputDevices()` are removed. Replacement APIs: ```ts const { useMicrophoneState, useCameraState, useSpeakerState } = useCallStateHooks(); const { devices: mics } = useMicrophoneState(); const { devices: cameras } = useCameraState(); const { devices: speakers } = useSpeakerState(); ```
- Loading branch information
Showing
102 changed files
with
961 additions
and
3,106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.