Skip to content

Frontend

Course: WebRTC Basic implementation, advance discussion - chapter 6

  • Create a frontend repo
Terminal window
npm create vite@latest
  • Add two routes, one for a sender and one for a receiver
import { useState } from 'react'
import './App.css'
import { Route, BrowserRouter, Routes } from 'react-router-dom'
import { Sender } from './components/Sender'
import { Receiver } from './components/Receiver'
function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/sender" element={<Sender />} />
<Route path="/receiver" element={<Receiver />} />
</Routes>
</BrowserRouter>
)
}
export default App
  • Remove strict mode in main.tsx to get rid of a bunch of webrtc connections locally (not really needed)
  • Create components for sender
$1b
  • Create the component for receiver
$1d

Final code - https://github.com/100xdevs-cohort-2/week-23-webrtc

Can you change the code so that

  1. A single producer can produce to multiple people?
  2. Add room logic.
  3. Add two way communication.
  4. Replace p2p logic with an SFU (mediasoup)