screen share in react-native-webrtc

1.9k views Asked by At

I am developing a react-native app with webrtc functionality for video calling. thank to https://github.com/react-native-webrtc/react-native-webrtc I am able to achieve join room, leave room.

but it am still struggling on screen share on react-native-webrtc. I have used following code

const getDisplayMedia = useCallback(async (streamId)=>{
    if(Platform.OS == 'android'){
      const stream = await mediaDevices.getDisplayMedia()
      const videoTrackSender = remotePeerConnection[streamId].getSenders()
      if(videoTrackSender){
      videoTrackSender.replaceTrack(stream.getVideoTracks()[0]
      }
  },[])

But react-native-webrtc does not have pc.getSenders() method or pc.replaceTrack() method.

I have also tied pc.addTrack and pc.removeTrack methods but these are not implemented as yet.

is there any way to share screen in react-native using react-native-webrtc.

0

There are 0 answers