AgoraIO-Extensions / agora-rtc-react

Agora RTC React SDK
https://agoraio-extensions.github.io/agora-rtc-react/
MIT License
31 stars 11 forks source link

useLocalScreenTrack #107

Closed EkaanshArora closed 1 year ago

EkaanshArora commented 1 year ago

What kind of problem does this feature solve?

Hey can we add a simple hook for creating a screen track for screenshare, I think we're missing this at the moment.

What does the proposed API look like?

const {isloading: boolean, localScreenTrack: track} = useLocalScreenTrack();

cc @guoxianzhe @divanov11

guoxianzhe commented 1 year ago

make it happened as below:

useLocalScreenTrack(
  ready = true,
  screenVideoTrackInitConfig: ScreenVideoTrackInitConfig,
  withAudio: "enable" | "disable" | "auto",
  client?: IAgoraRTCClient,
): {
  screenTrack: [ILocalVideoTrack, ILocalAudioTrack] |
ILocalVideoTrack | null;
  isLoading: boolean;
  error: AgoraRTCReactError | null;
}