A React-based web application for video streaming with broadcaster and viewer capabilities, built using the @video/video-client-web SDK.
- Live video broadcasting
- Real-time video playback
- Camera and microphone controls
- Screen sharing capabilities
- Video quality settings
- Viewer authentication
- Time-limited streams
- Node.js (v16 or higher)
- NPM or Yarn
- Access to the
@video/video-client-webSDK
- Clone the repository
- Install dependencies:
npm install- Create a
.envfile in the root directory with the following variables:
BACKEND_ENDPOINT= https://platform.nativeframe.com
PROJECT_ID=your_project_id (This can be found at platform.nativeframe.com, from the Projects page select the project you want to use, the ID is avaiable in the top right corner of the page.)
SERVICE_ACCOUNT_JWT=your_jwt (This can be found at platform.nativeframe.com, from the Project page select the project you want to use, then select API keys, you can either create a new JWK key and generate a JWT or use an existing one.)
KID=your_kid (This can be found at platform.nativeframe.com, from the Project page select the project you want to use, then select API keys, the KID is available to be copied from the JWK row, ensure you have selected the KID that matches the JWT you are using.)
- Configure the NPM registry for
@videopackages by adding the following to your.npmrc:
@video:registry=https://npm.nativeframe.comStart both the client and server:
npm startThis will concurrently run:
- React frontend on
http://localhost:3000 - Express backend on
http://localhost:3001
/src- React frontend application/components- React components for Encoder and Player/hooks- Custom React hooks for video client functionality/utils- Utility functions and API calls
/server- Express backend server/utils- Server-side utilities for stream management and authentication
The Encoder component provides broadcasting capabilities with:
- Camera/microphone controls
- Screen sharing
- Quality settings
- Broadcast controls
The ManifestPlayer component offers viewing capabilities with:
- Playback controls
- Volume controls
- Quality selection
- Fullscreen mode
POST /api/streams/create- Create a new streamGET /api/streams/active- Get active stream IDGET /api/streams/:streamId/manifest- Get stream manifest URL
POST /api/auth/broadcaster- Get broadcaster tokenPOST /api/auth/viewer- Get viewer token
- This is a development setup and may require additional security measures for production
- Ensure proper error handling and user feedback in production environments