You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting up an RTC connection works. I get a stream with an active video and audio stream. However the stream doesn't get displayed on my screen, it's as if there is no component. When on my desktop (Ubuntu, firefox) however it does get displayed, also on an android phone using Google Chrome it gets displayed. The issue only occurs on my ipad. I have also tried Chrome on the iPad, this also doesn't work.
Instructions To reproduce
I have also opened this issue in the react-native-web-rtc repo as the same issue occurs there (as an application build).
import{useEffect,useRef,useState}from"react";import{Platform,SafeAreaView,View}from"react-native";letRTCView,RTCPeerConnection;if(Platform.OS==="web"){constWebRTC=require("react-native-webrtc-web-shim");RTCView=WebRTC.RTCView;RTCPeerConnection=WebRTC.RTCPeerConnection;}else{constWebRTC=require("react-native-webrtc");RTCView=WebRTC.RTCView;RTCPeerConnection=WebRTC.RTCPeerConnection;WebRTC.registerGlobals();}constMEDIA_SERVER_URL=process.env.EXPO_PUBLIC_MEDIA_SERVER_URL;interfaceWebRTCStreamProps{
streamKey: string;}exportdefaultfunctionWebRTCStream({ streamKey }: WebRTCStreamProps){const[stream,setStream]=useState(null);constpeerConnection=useRef<RTCPeerConnection|null>(null);useEffect(()=>{conststartStream=async()=>{try{peerConnection.current=newRTCPeerConnection();peerConnection.current.ontrack=(event)=>{conststream=event.streams[0];console.log("Stream active:",stream.active);console.log("Audio Tracks:",stream.getAudioTracks());console.log("Video Tracks:",stream.getVideoTracks());setStream(event.streams[0]);};// Fetch and POST SDP offerconstfetchSdpOffer=async()=>{if(!streamKey)return;conststreamUrl=`${MEDIA_SERVER_URL}/rtc/v1/whep/?app=live&stream=${streamKey}`;try{// Create SDP offerconstoffer=awaitpeerConnection.current.createOffer({offerToReceiveAudio: true,offerToReceiveVideo: true,});awaitpeerConnection.current.setLocalDescription(offer);constsdpOffer=peerConnection.current.localDescription.sdp;// POST the SDP offer to the serverconstresponse=awaitfetch(streamUrl,{method: "POST",headers: {"Content-Type": "application/sdp",},body: sdpOffer,});constanswer=awaitresponse.text();awaitpeerConnection.current.setRemoteDescription({type: "answer",sdp: answer,});}catch(error){console.error("Error with WebRTC connection:",error);}};fetchSdpOffer();// Clean up peer connection on unmountreturn()=>{if(peerConnection.current){peerConnection.current.close();}};}catch(error){console.error("Error initializing WebRTC:",error);}};startStream();},[streamKey]);console.log("Stream:",stream);console.log("media server url:",MEDIA_SERVER_URL);return(<Viewstyle={{maxWidth: "50%",flexGrow: 1}}>{stream&&<RTCViewstream={stream}/>}</View>);}
As mediaserver I am using srs with the conf/rtmp2rtc.conf config.
Versions (please complete the following information):
React Native Version: 0.74.5
React Native Web Version: ~0.19.10
react-native-webrtc: ^124.0.4
react-native-webrtc-web-shim: ^1.0.6
The text was updated successfully, but these errors were encountered:
Setting up an RTC connection works. I get a stream with an active video and audio stream. However the stream doesn't get displayed on my screen, it's as if there is no component. When on my desktop (Ubuntu, firefox) however it does get displayed, also on an android phone using Google Chrome it gets displayed. The issue only occurs on my ipad. I have also tried Chrome on the iPad, this also doesn't work.
Instructions To reproduce
I have also opened this issue in the
react-native-web-rtc
repo as the same issue occurs there (as an application build).As mediaserver I am using srs with the
conf/rtmp2rtc.conf
config.Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: