A self-hosted, lightweight video casting application that allows you to instantly upload and stream videos from your phone or computer directly to your smart TV.
This project is divided into two main components:
- Rust Server (
cast-server): Built withaxumandtokio. It serves a WebSocket connection to the TV receiver, handles video and subtitle uploads, and hosts the receiver interface. - React Client (
client): A beautiful, modern web interface (built with React and Vite) to upload videos, upload subtitles, and trigger casting to the TV.
- Instant Video Casting: Cast uploaded videos to your TV receiver screen via WebSockets.
- On-the-Fly Subtitle Conversion: Supports both
.srtand.vttsubtitle files. Uploading.srtfiles will automatically trigger on-the-fly conversion to WebVTT format for optimal browser compatibility. - Subtitle Management: Check subtitle status (loaded or missing) for each video in the list, upload new tracks, or replace existing ones from the sender app.
- Open the "Receiver" web interface on your TV (
http://<YOUR_LOCAL_IP>:3000/receiver). - Open the React client on your phone or laptop.
- Upload a video, which is safely stored on the server.
- (Optional) Upload a subtitle file (
.srtor.vtt) under the video file in the video list. - Click Cast to TV. The server sends a WebSocket message to the TV receiver containing both the video URL and subtitle URL.
- The TV receiver catches the WebSocket event and instantly begins playback with captions!
1. Install Rust and Cargo (for the server) To install Rust, run the following command in your terminal (macOS/Linux):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shFor Windows, download and run rustup-init.exe from rustup.rs.
2. Install Node.js (for the client) You can download the official installer from the Node.js website. Alternatively, if you're on macOS/Linux, using nvm (Node Version Manager) is recommended:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install nodecd cast-server
cargo runThe server will start on http://0.0.0.0:3000.
The TV receiver interface is available at http://<YOUR_LOCAL_IP>:3000/receiver.
cd client
npm install
npm run dev- Address already in use: Make sure no other instances of the server are running. You can kill existing instances by finding the PID or using a command like
killall cast-server. - Playback Blocked: Modern browsers block autoplay videos with audio. If the TV displays "Playback Blocked", simply click or tap anywhere on the screen (or press OK on your TV remote) to allow playback.