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 and video to it. If the backend is configured to return the audio and video, they will be displayed as well.

  • We import necessary components from the @outspeed/react library.
  • useWebRTC: This hook is used to manage WebRTC connections. It provides methods like connect, getRemoteVideoTrack, and getLocalVideoTrack. Visit here to learn more about useWebRTC.
  • The useWebRTC hook is set up with a URL (functionURL) and options to enable audio and video. We can also use useCreateConfig to create a config, visit here.
    • audio: true: This selects the default audio input device, and stream it to the backend.
    • video: true: This selects the default video input device, and stream it to the backend.
  • Video Streams: Using RealtimeVideo component to view streams. Learn more about RealtimeVideo component here.

Resources