GetStream / stream-video-js

GetStream JavaScript Video SDK
https://getstream.io/video/sdk/
Other
57 stars 19 forks source link

fix(react-native)!: apply media stream management initial state asyncronously #1345

Closed khushal87 closed 1 month ago

khushal87 commented 1 month ago

This PR focuses on removing the mediaDevicesInitialState prop from the StreamCall component to control the initial state of the camera and mic.

Instead, to voluntarily apply the mute status on the camera and mic, you can simply call call.camera.enable()/call.camera.disable() for the camera and call.microphone.enable()/call.microphone.disable() for the mic.

Eg:

initialAudioMuted={true} would change as call.microphone.disable();
initialCameraMuted={false) would change as call.camera.enable()

You can also apply the functions mentioned above on top of our backend settings. We apply our backend settings through the hook useApplyDefaultMediaStreamSettings, which you can override if you have a custom use case or use directly if you just want the default backend settings to be respected.

  useEffect(() => {
    call?.camera.disable();
    call?.microphone.disable();
  }, [call]);

This PR fixes the issue pointed out in #1236 as well.