command
module
Version:
v0.0.0-...-e328feb
Opens a new window with list of versions in this module.
Published: Aug 24, 2023
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
STAUVISE
GO - An Audio/Video Streaming Service
This service implements these main features:
- Stream media files.
- Create and manage users.
- Create and manage categories.
- Create and manage videos.
Supported transport protocols
Supported file extensions
-
Video Formats:
- mp4 (MPEG-4 Part 14)
- mov (QuickTime Movie)
- avi (Audio Video Interleave)
- mkv (Matroska Video)
- flv (Flash Video)
- webm (WebM Video)
-
Audio Formats:
- mp3 (MPEG Audio Layer III)
- aac (Advanced Audio Coding)
- wav (Waveform Audio File Format)
- flac (Free Lossless Audio Codec)
- ogg (Ogg Vorbis Audio)
-
Other Formats:
- ts (Transport Stream)
- m2ts (Blu-ray BDAV MPEG-2 Transport Stream)
- 3gp (3GPP Multimedia File)
- wmv (Windows Media Video)
Infrastructure:
- App context: AppContext (library packages common components)
- ffmpeg:
ffmpeg
- Token authentication:
PASETO
- Database migrations:
golang-migrate
- Generate CRUD operations from SQL:
GORM
- Database:
PostgreSQL
- Database documentation:
dbdocs
- Generate SQL schema:
dbml2sql
- Web framework:
Gin
- Containerize:
docker
| docker compose
1. Quick start
-
Setup ENV:
make build
make outenv # Show ENV on terminal
make outenvfile # Extract ENV into .env
# Replace ENV variables in `.env` with your configuration
-
Run in background (all in one):
make up
-
Run on current terminal:
# Start PostgreSQL database
make updb
# Run server
make server
2. Setup local development
-
Migrate
brew install golang-migrate
-
DB Docs
npm install -g dbdocs
dbdocs login
-
DBML CLI
npm install -g @dbml/cli
dbml2sql --version
-
ffmpeg
brew install ffmpeg
-
Swagger
go install github.com/swaggo/swag/cmd/swag@latest
Setup infrastructure
-
Start PostgreSQL container:
make updb
-
Run DB migration up all versions:
make migrateup
-
Run DB migration up 1 version:
make migrateup1
-
Run DB migration down all versions:
make migratedown
-
Run DB migration down 1 version:
make migratedown1
Documentation
How to generate code
-
List ENV variables on terminal:
make outenv
-
Extract ENV variables into .env
file:
make outenvfile
-
Generate schema SQL file with DBML:
make dbschema
-
Create a new DB migration:
make new_migration name=<migration_name>
-
Generate swagger documents:
make swagger
How to run
Method |
Path |
Description |
Notes |
POST |
/api/v1/users/register |
Register a new user |
Receives user details |
POST |
/api/v1/auth/login |
Login to get access token |
Receives username and password |
GET |
/api/v1/users/me |
Retrieve user profile |
Requires valid access token |
POST |
/api/v1/categories |
Create a new category |
Receives category details |
GET |
/api/v1/categories |
Retrieve all categories |
Requires valid access token |
GET |
/api/v1/videos/streams/{id}/{id}.m3u8 |
Stream video segments |
Requires valid video ID |
GET |
/api/v1/videos |
Retrieve videos |
Supports pagination |
GET |
/api/v1/videos/{id} |
Retrieve video by ID |
Requires valid video ID |
GET |
/api/v1/videos/{id}/segments |
Retrieve video segments |
Requires valid video ID, supports pagination |
POST |
/api/v1/videos |
Create a new video |
Receives video details and file |
4. Notes
- To test streaming media use: HLS Demo
- Input format:
{host}/api/v1/videos/streams/{video_path}
(video_path: "path" in getting video details response)
- For example:
http://localhost:8080/api/v1/videos/streams/1692794790339777000/1692794790339777000.m3u8
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
|
|
|
|
pkg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.