@outspeed/react-native
Connecting to a WebRTC backend
The useWebRTC hook simplify the process of connecting to Outspeed’s WebRTC backend.
We assume you have already deployed your backend. If not, please follow this tutorial to deploy your backend with
outspeed-client
.The code shown establishes a peer connection with the backend and streams local audio to it.
- We import necessary components from the
@outspeed/react-native
and@outspeed/core
libraries. useWebRTC
: This hook is used to manage WebRTC connections. Visit here to learn more aboutuseWebRTC
.- The
useWebRTC
hook is set up with a URL (functionURL
) and option to enable audio.audioConstraints: {}
: This selects the default audio input device and streams the audio to the backend. You can also specify any MediaTrackConstraints to customize the audio input.
- Streaming: Using
RealtimePlayer
component to stream. Learn more aboutRealtimePlayer
component here.
Resources
Was this page helpful?