Skip to content

A real-time wireless camera streaming platform built with Next.js, Socket.io, and WebRTC. Stream camera feeds from any device wirelessly to a central admin dashboard with full control and OBS integration.

Notifications You must be signed in to change notification settings

Tomkoooo/tstream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

tStream - Wireless Camera Streaming Platform

A real-time wireless camera streaming platform built with Next.js, Socket.io, and WebRTC. Stream camera feeds from any device wirelessly to a central admin dashboard with full control and OBS integration.

TStream Demo Next.js WebRTC Socket.io

โœจ Features

๐ŸŽฅ Multi-Camera Streaming

  • Stream from unlimited devices simultaneously
  • Real-time video and audio transmission
  • Automatic quality adaptation based on network conditions
  • Support for mobile phones, tablets, laptops, and webcams

๐ŸŽ›๏ธ Admin Dashboard

  • Central control panel for all connected cameras
  • Real-time stream statistics (FPS, bitrate, packet loss)
  • Individual camera controls and settings
  • Participant management with kick functionality

๐ŸŽจ Video Controls

  • Transform Options: Horizontal/vertical flip, 90ยฐ rotation
  • Audio Selection: Choose which camera's audio to monitor
  • Fullscreen Mode: Individual camera fullscreen viewing
  • Stream Settings: Adjustable resolution, FPS, and bitrate

๐Ÿ“บ OBS Integration

  • Individual Camera Views: Separate URLs for each camera
  • Browser Source Compatible: Direct integration with OBS Studio
  • Transform Support: Flip and rotation settings preserved
  • Clean Interface: Minimal UI for professional streaming

๐Ÿ”ง Advanced Features

  • WebRTC P2P: Low-latency peer-to-peer connections
  • Automatic Reconnection: Handles network interruptions gracefully
  • STUN/TURN Support: Works behind NAT and firewalls
  • Responsive Design: Works on desktop and mobile devices

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Modern web browser with WebRTC support

Installation

  1. Clone the repository

    git clone https://github.com/tomkoooo/tstream.git
    cd tstream
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open your browser

    • Navigate to http://localhost:8080
    • Create a room as admin
    • Share the join link with camera devices

๐Ÿ“– Usage Guide

๐Ÿ  Creating a Room

  1. Go to the main page
  2. Click "Create Room"
  3. Set room name and password
  4. Share the generated link with participants

๐Ÿ“ฑ Joining as a Camera

  1. Open the shared link on your device
  2. Enter the room password
  3. Allow camera and microphone access
  4. Configure stream settings (resolution, FPS, bitrate)
  5. Click "Start Streaming"

๐Ÿ‘จโ€๐Ÿ’ผ Admin Controls

Main Dashboard:

  • View all connected cameras in a grid layout
  • Monitor real-time statistics for each stream
  • Select which camera's audio to listen to
  • Control individual camera settings

Per-Camera Actions:

  • Fullscreen: Open camera in fullscreen mode
  • OBS View: Generate individual URL for OBS Studio
  • Transform: Flip horizontally/vertically, rotate 90ยฐ
  • Audio Select: Choose as primary audio source
  • Reconnect: Restart connection if issues occur
  • Kick: Remove participant from room

๐ŸŽฌ OBS Studio Integration

  1. In admin dashboard, click โ‹ฎ โ†’ "Individual View (OBS)"
  2. Copy the generated URL
  3. In OBS Studio:
    • Add Browser Source
    • Paste the URL
    • Set resolution (e.g., 1920x1080)
    • The camera feed will appear with applied transforms

โš™๏ธ Configuration

Environment Variables

Create a .env.local file in the root directory:

# Base URL for the application
NEXT_PUBLIC_BASE_URL=http://localhost:8080

# WebRTC Configuration
NEXT_PUBLIC_STUN_SERVERS=stun:stun.l.google.com:19302,stun:stun1.l.google.com:19302

# Optional: Custom TURN servers for better NAT traversal
NEXT_PUBLIC_TURN_SERVER_URL=turn:your-turn-server.com:3478
NEXT_PUBLIC_TURN_USERNAME=username
NEXT_PUBLIC_TURN_CREDENTIAL=password

Stream Quality Settings

Recommended Settings by Use Case:

Use Case Resolution FPS Bitrate
Mobile/Preview 480p 15 500 kbps
Standard Quality 720p 30 2000 kbps
High Quality 1080p 30 4000 kbps
Ultra Quality 1080p 60 6000 kbps

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Client Device โ”‚    โ”‚   Next.js App   โ”‚    โ”‚  Admin Dashboardโ”‚
โ”‚   (Camera)      โ”‚โ—„โ”€โ”€โ–บโ”‚  + Socket.io    โ”‚โ—„โ”€โ”€โ–บโ”‚   (Control)     โ”‚
โ”‚                 โ”‚    โ”‚   Server        โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚                       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    WebRTC P2P Connection

Tech Stack

  • Frontend: Next.js 15.3.3, React 19, TypeScript
  • Styling: Tailwind CSS 4, DaisyUI 5
  • Real-time: Socket.io 4.8.1
  • WebRTC: Native browser APIs
  • Backend: Node.js with Socket.io server

๐Ÿ› ๏ธ Development

Project Structure

tstream/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ admin/[roomId]/     # Admin dashboard
โ”‚   โ”‚   โ”œโ”€โ”€ join/[roomId]/      # Client streaming page
โ”‚   โ”‚   โ”œโ”€โ”€ camera/[participantId]/ # Individual camera view
โ”‚   โ”‚   โ””โ”€โ”€ api/socket/         # Socket.io API endpoint
โ”‚   โ””โ”€โ”€ components/             # Reusable React components
โ”œโ”€โ”€ server.js                   # Socket.io server
โ”œโ”€โ”€ public/                     # Static assets
โ””โ”€โ”€ package.json

Available Scripts

# Development server
npm run dev

# Production build
npm run build

# Start production server
npm start

# Lint code
npm run lint

WebRTC Flow

  1. Room Creation: Admin creates room with Socket.io
  2. Client Join: Camera devices join room with password
  3. Stream Start: Client starts camera stream
  4. Admin Connection: Admin initiates WebRTC offer to streaming client
  5. P2P Established: Direct video/audio transmission begins
  6. Statistics: Real-time monitoring of connection quality

๐Ÿ”ง Troubleshooting

Common Issues

No Video Stream:

  • Check camera permissions in browser
  • Verify network connectivity
  • Try reconnecting from admin panel

Connection Failed:

  • Ensure STUN/TURN servers are accessible
  • Check firewall settings
  • Verify room password is correct

Poor Quality:

  • Reduce resolution/bitrate in stream settings
  • Check network bandwidth
  • Try different STUN/TURN servers

Audio Issues:

  • Verify microphone permissions
  • Check audio source selection in admin panel
  • Ensure browser supports audio streaming

Debug Mode

Enable debug logging by opening browser console. The app provides detailed logs for:

  • Socket.io connections
  • WebRTC signaling
  • Stream statistics
  • Error conditions

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Use TypeScript for type safety
  • Follow existing code style
  • Add proper error handling
  • Include debug logging for new features
  • Test on multiple devices/browsers

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • WebRTC for real-time communication
  • Socket.io for reliable signaling
  • Next.js for the application framework
  • DaisyUI for beautiful UI components
  • Tailwind CSS for styling utilities

๐Ÿ“ž Support


Made with โค๏ธ for seamless wireless streaming

About

A real-time wireless camera streaming platform built with Next.js, Socket.io, and WebRTC. Stream camera feeds from any device wirelessly to a central admin dashboard with full control and OBS integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published