1
0
mirror of https://github.com/algora-io/tv.git synced 2024-11-16 00:58:59 +02:00
Open source Twitch for developers
Go to file
2024-09-24 19:56:50 +03:00
assets fix logo path 2024-09-21 21:27:57 +03:00
config feat: PWA (#103) 2024-09-20 18:09:59 +03:00
lib reformat 2024-09-21 22:02:24 +03:00
priv update PWA manifest 2024-09-21 19:26:01 +03:00
rel pipe crash dumps into stderr 2024-08-16 20:45:29 +03:00
scripts implement in-video ads & analytics (#59) 2024-08-15 18:02:56 +03:00
test update test cases 2024-08-22 23:51:10 +03:00
.credo.exs add vector search for vods (#28) 2024-05-01 23:34:05 +03:00
.dockerignore implement in-video ads & analytics (#59) 2024-08-15 18:02:56 +03:00
.env.example add oauth flow for restream (#37) 2024-05-22 17:03:18 +03:00
.formatter.exs initial commit 2024-02-29 22:31:42 +03:00
.gitignore implement in-video ads & analytics (#59) 2024-08-15 18:02:56 +03:00
.iex.exs implement in-video ads & analytics (#59) 2024-08-15 18:02:56 +03:00
Dockerfile init root dir for hf cache 2024-05-12 14:41:55 +03:00
fiex add script for opening an IEx shell into the server 2024-03-06 19:26:07 +03:00
fly.toml remove vm specs 2024-05-23 14:21:20 +03:00
LICENSE update license 2024-09-24 19:56:50 +03:00
mix.exs add LL-HLS support (#54) 2024-09-17 15:05:43 +03:00
mix.lock add LL-HLS support (#54) 2024-09-17 15:05:43 +03:00
observer add observer script 2024-08-15 18:10:46 +03:00
README.md update setup docs (#79) 2024-09-20 17:28:32 +03:00

Logo

Algora TV

The interactive livestreaming & video sharing service for developers.
Website · Discord · Twitter · YouTube · Issues

Open Bounties Rewarded Bounties

New feature: Earn with Livestream Billboards!

Algora Live Billboards allow for in-video ads, helping devs earn money while livestreaming and giving devtools companies a novel channel to reach new audiences. Learn more

https://github.com/user-attachments/assets/6f706a4b-210f-4ec8-a817-2a72cea0954a

Getting Started

To get a local copy up and running, follow these steps.

Prerequisites

  • Elixir and Erlang/OTP
  • PostgreSQL
  • FFmpeg
  • ImageMagick
  • OBS Studio (recommended for testing livestreaming features)

Setting up the project

  1. Clone the repo and go to the project folder

    git clone https://github.com/algora-io/tv.git; cd tv
    
  2. Fetch dependencies

    mix deps.get
    

    Note: If you're using an Apple machine with an ARM-based chip, you need to install the Rust compiler and run mix compile.rambo

  3. Initialize your .env file

    cp .env.example .env
    
  4. Create your database

    sudo -u postgres psql
    
    CREATE USER algora WITH PASSWORD 'password';
    CREATE DATABASE tv;
    GRANT ALL PRIVILEGES ON DATABASE tv TO algora;
    
  5. Paste your connection string into your .env file

    DATABASE_URL="postgresql://algora:password@localhost:5432/tv"
    
  6. Run migrations and seed your database

    env $(cat .env | xargs -L 1) mix ecto.setup
    
  7. 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

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: