A comprehensive online streaming player management tool built to run on Cloudflare Workers. This platform allows users to browse, manage, and watch online streaming content with full administrative capabilities.
- Anonymous Access: Users can browse and watch streams without authentication
- Player Management: Full CRUD operations for streaming players (Create, Read, Update, Delete)
- HLS Support: Advanced HLS streaming support with quality control and audio track selection
- Cover Image Management:
- Upload custom cover images
- Auto-capture frames from video streams
- Multi-frame selection for optimal covers
- Admin Panel: Secure administrative interface for content management
- Responsive Design: Mobile-friendly interface with modern UI/UX
- Real-time Streaming: Optimized for live streaming content
- Framework: Next.js 15 with App Router (SSR)
- Runtime: Cloudflare Workers
- Database: Cloudflare D1 (SQLite)
- ORM: Drizzle ORM
- Video Player: Artplayer with HLS.js integration
- Styling: Tailwind CSS
- Authentication: JWT-based admin authentication
- Language: TypeScript
-
Clone the repository
git clone <repository-url> cd players
-
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env.local # Edit .env.local with your configuration -
Initialize the database
# Create D1 database wrangler d1 create live-player # Run migrations pnpm run db:init:dev
-
Start development server
pnpm dev
-
Database operations
# Generate migrations pnpm run db:generate # Run migrations pnpm run db:migrate # Open Drizzle Studio pnpm run db:studio
-
Build and deploy to Cloudflare
pnpm run deploy
-
Initialize production database
pnpm run db:init
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── api/ # API endpoints
│ │ ├── admin/ # Admin panel
│ │ └── player/ # Player pages
│ ├── components/ # React components
│ │ ├── PlayerModal.tsx # Player management modal
│ │ ├── CoverSelector.tsx # Cover image selection
│ │ └── Player.tsx # Video player component
│ ├── lib/
│ │ ├── db/ # Database schema and utilities
│ │ ├── auth.ts # Authentication logic
│ │ └── videoCapture.ts # Video frame capture utilities
│ └── styles/
├── migrations/ # Database migrations
├── public/ # Static assets
└── scripts/ # Utility scripts
- Create and manage multiple streaming players
- Support for various video formats (MP4, HLS, etc.)
- Custom player configurations and settings
- Upload: Direct image file uploads
- Auto-capture: Extract frames from video streams
- Multi-frame selection: Choose from 8 captured frames
- HLS optimization: Efficient frame extraction from HLS streams
- Secure JWT-based authentication
- Role-based access control
- Protected admin routes
-- Players table
CREATE TABLE players (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
pId TEXT UNIQUE NOT NULL,
description TEXT,
url TEXT NOT NULL,
coverUrl TEXT,
coverImage BLOB,
announcement TEXT,
createdAt TEXT DEFAULT CURRENT_TIMESTAMP,
updatedAt TEXT DEFAULT CURRENT_TIMESTAMP
);# JWT Secret
JWT_SECRET=your_jwt_secret_here
# Admin Credentials (optional)
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin_password# wrangler.toml
name = "streaming-platform"
compatibility_date = "2024-01-15"
[[d1_databases]]
binding = "DB"
database_name = "live-player"
database_id = "your_database_id"GET /api/players- List all playersPOST /api/players- Create new playerPUT /api/players/[id]- Update playerDELETE /api/players/[id]- Delete playerPOST /api/players/[id]/cover- Upload cover image
POST /api/auth/login- Admin loginPOST /api/auth/logout- Admin logoutGET /api/auth/user- Get current user
- Navigate to the homepage to see all available players
- Click on any player to start watching
- Use player controls for quality selection and audio tracks
- Access
/auth/adminto log in - Manage players through the admin interface
- Upload cover images or capture from video streams
- Configure player settings and announcements
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Artplayer - Modern HTML5 video player
- HLS.js - HLS streaming support
- Drizzle ORM - Type-safe database operations
- Cloudflare Workers - Edge computing platform