[mediacapture-main] I got an issue for capture audio from other applications while using GetDisplayMedia for screen sharing in a React Native app. (#1002)

priyankgandhi0 has just created a new issue for https://github.com/w3c/mediacapture-main:

== I got an issue for capture audio from other applications while using GetDisplayMedia for screen sharing in a React Native app. ==
I've implemented screen sharing using WebRTC in my React Native app, but I'm encountering an issue where the audio from other apps, such as YouTube, is not being captured during screen broadcasting.

Below is the React Native code snippet I'm using for screen sharing:

`const screenShareStreamRef = useRef();
    const [screenShareStream, setScreenShareStream] = useState(null);
    const screenShareVideoProducer = useRef();
    const screenShareAudioProducer = useRef();


    let audioTrack, videoTrack, screenstream;
      const startScreenStream = async () => {
        try {
          const displayStream = await mediaDevices.getDisplayMedia({ video: true });
          videoTrack = displayStream.getVideoTracks()[0];
      
          const audioStream = await mediaDevices.getUserMedia({ audio: true });
          audioTrack = audioStream.getAudioTracks()[0];
      
          // Combine video and audio tracks into a single MediaStream
          screenstream = new MediaStream([videoTrack, audioTrack]);
      
          screenShareStreamRef.current = screenstream;
          setScreenShareStream(screenstream);
                
        } catch (error) {
          console.error(error);
        }
    })`


For both iOS and Android, I've followed the setup provided in this guide: [Link to the setup guide](https://getstream.io/video/docs/reactnative/advanced/screensharing/setup/react-native/)

Additionally, for iOS, I've added the necessary files into the project, as mentioned in the guide: [Link to the files](https://github.com/GetStream/stream-video-js/tree/main/sample-apps/react-native/dogfood/ios/Broadcast%20Extension/)

I'm looking for insights or solutions on how to capture audio from other apps during screen sharing. Any help would be appreciated. Thank you!

Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/1002 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 6 May 2024 05:44:24 UTC