Spaces:
Running
Running
|
Download STRUCTURE.md from urstark/NovaStream: direct link, hf CLI and curl.
- Browser
- Download file 2.89 kB
-
https://huggingface.co/spaces/urstark/NovaStream/resolve/main/STRUCTURE.md
- Command line
-
hf download hf://spaces/urstark/NovaStream/STRUCTURE.md
-
curl -L -o STRUCTURE.md https://huggingface.co/spaces/urstark/NovaStream/resolve/main/STRUCTURE.md
2.89 kB
| # ποΈ Project Structure | |
| NovaStream is built on a hybrid architecture, combining a highly interactive React frontend with a robust Node.js streaming proxy backend. | |
| Below is an overview of the core file structure and components: | |
| ```text | |
| NovaStream/ | |
| βββ server.cjs # Core Node.js Express server | |
| β # Handles /api/metadata, /api/stream, FFmpeg transmuxing, and file probing | |
| βββ package.json # Project dependencies and npm scripts | |
| βββ vite.config.js # Vite configuration for building the React frontend | |
| βββ eslint.config.js # Linter configuration | |
| βββ index.html # Entry point for the frontend application | |
| βββ Dockerfile # Configuration for containerizing the application | |
| βββ LICENSE # GPL-3.0 Open Source License | |
| βββ README.md # Project overview, features, and setup guide | |
| β | |
| βββ public/ # Static assets | |
| β | |
| βββ src/ # React Frontend Source Code | |
| βββ App.jsx # Main Application component (UI, Player Logic, State Management) | |
| βββ App.css # Glassmorphism & Cinematic styling, animations | |
| βββ main.jsx # React DOM rendering entry point | |
| ``` | |
| ## βοΈ Backend Architecture (`server.cjs`) | |
| The backend is responsible for bypassing cross-origin restrictions (CORS) and handling unsupported browser video formats (like MKV) through real-time processing. | |
| ### Key Endpoints: | |
| - `GET /api/metadata`: Probes the provided video URL using HTTP HEAD requests or `ffprobe`. Detects file size, duration, container type, and extracts internal audio track metadata. | |
| - `GET /api/stream`: The core streaming engine. | |
| - If the file is a standard MP4/WebM, it acts as a direct byte-range proxy. | |
| - If the file is an MKV or requires transcoding, it spawns an `ffmpeg` child process. It pipes fragmented MP4 directly to the Express response, supporting real-time seeking, audio track switching, and optional HEVC-to-H.264 transcoding. | |
| ## π¨ Frontend Architecture (`src/App.jsx`) | |
| The frontend is a monolithic yet organized React component that manages the entire lifecycle of the media player. | |
| ### Key Capabilities: | |
| - **State Management**: Handles player states (Play/Pause, Volume, Fullscreen), stream metadata, bookmarks, history, and buffering telemetry. | |
| - **Subtitle Processing**: The `srtToVtt` utility function converts uploaded SRT subtitle files into WebVTT format entirely on the client side. | |
| - **Speedometer & Telemetry**: Uses video buffering API (`video.buffered`) to calculate download speeds and buffer health in real-time. | |
| - **Sandbox Player**: Utilizes `URL.createObjectURL` to allow users to play large local files securely without uploading them to the server. | |