a235c36888
* try to reconnect using fresh token * add handlers to start, restart and terminate |
||
---|---|---|
assets | ||
config | ||
lib | ||
priv | ||
rel | ||
scripts | ||
test | ||
.credo.exs | ||
.dockerignore | ||
.env.example | ||
.formatter.exs | ||
.gitignore | ||
.iex.exs | ||
Dockerfile | ||
fiex | ||
fly.toml | ||
LICENSE | ||
mix.exs | ||
mix.lock | ||
observer | ||
README.md |
Algora TV
The interactive livestreaming & video sharing service for developers.
Website
·
Discord
·
Twitter
·
YouTube
·
Issues
Getting Started
To get a local copy up and running, follow these steps.
Prerequisites
- Elixir and Erlang/OTP
- We recommend using asdf to install and manage different Elixir and Erlang/OTP versions.
- Keep in mind that each Elixir version supports specific Erlang/OTP versions. See the compatibility table here.
- Make sure you have at least Elixir 1.12 installed to run Algora TV.
- PostgreSQL
- FFmpeg
- OBS Studio (recommended for testing livestreaming features)
Setting up the project
-
Clone the repo and go to the project folder
git clone https://github.com/algora-io/tv.git; cd tv
-
Fetch dependencies
mix deps.get
-
Initialize your
.env
filecp .env.example .env
-
Create your database
sudo -u postgres psql
CREATE USER algora WITH PASSWORD 'password'; CREATE DATABASE tv; GRANT ALL PRIVILEGES ON DATABASE tv TO algora;
-
Paste your connection string into your
.env
fileDATABASE_URL="postgresql://algora:password@localhost:5432/tv"
-
Set up your database and run migrations
env $(cat .env | xargs -L 1) mix ecto.setup
-
Start your development server
env $(cat .env | xargs -L 1) iex -S mix phx.server
Setting up external services
Some features of Algora TV rely on external services. If you're not planning on using these features, feel free to skip setting them up.
GitHub
GitHub is used for authenticating users.
Create a GitHub OAuth app and set
- Homepage URL: http://localhost:4000
- Authorization callback URL: http://localhost:4000/oauth/callbacks/github
Once you have obtained your client ID and secret, add them to your .env
file.
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET="..."
Tigris
Tigris is used for storing and delivering livestreams and other media.
Create a public Tigris bucket to obtain your secrets and add them to your .env
file.
AWS_ENDPOINT_URL_S3="https://fly.storage.tigris.dev"
AWS_REGION="auto"
AWS_ACCESS_KEY_ID="tid_..."
AWS_SECRET_ACCESS_KEY="tsec_..."
BUCKET_MEDIA="..."
Architecture
Overview
graph
Streamers{Streamers} --> Fly
Fly[Fly<br>Elixir App] --> RTMP
Fly --> Web[Phoenix<br>Web Server]
Fly --> Db[Fly<br>Postgres]
RTMP[Membrane<br>RTMP Server] -->|First mile delivery| Tigris[Tigris<br>Object Storage]
Viewers{Viewers} -->|Last mile delivery| Tigris
Viewers --> Fly
Livestream pipeline
graph
Encoder{Encoder<br>e.g. OBS} -->|RTMP| Source[FLV Demuxer]
Source -->|video| H264Parser[H264 Parser]
Source -->|audio| AACParser[AAC Parser]
H264Parser --> H264Payloader[H264 Payloader]
AACParser --> AACPayloader[AAC Payloader]
H264Payloader --> CMAFMuxerVideo[CMAF Muxer]
AACPayloader --> CMAFMuxerAudio[CMAF Muxer]
CMAFMuxerVideo --> fMP4
CMAFMuxerAudio --> fMP4
fMP4[Fragmented MP4] -->|HLS| Tigris{Tigris Object Storage}
License
Distributed under the AGPLv3 License. See LICENSE
for more information.
Acknowledgements
Special thanks to these amazing projects which help power Algora TV: