Giter Site home page Giter Site logo

simliai / simli-webrtc-radio-next-js-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simliai/simli-radio-next-js-demo

0.0 0.0 0.0 222 KB

Stream incoming audio from a radio broadcast to Simli's API /LipsyncStream to process and return lipsynced video and audio frames to be displayed on frontend

JavaScript 25.68% Python 11.10% TypeScript 61.12% CSS 2.10%

simli-webrtc-radio-next-js-demo's Introduction

simli-next-js-demo

In this demo we are using websockets to stream incoming audio from a radio broadcast to ws://api.simli.ai/LipsyncStream which returns lipsynced video and audio frames to be displayed on frontend

Websocket schema: Click here

sequenceDiagram
    participant Client
    participant Frontend
    participant AudioServer
    participant LipsyncServer

    Client->>Frontend: Open webpage
    activate Frontend
    Frontend->>Frontend: Render UI
    Frontend->>Frontend: User clicks on Start button
    Frontend->>Frontend: AudioContext and VideoContext initialized
    Frontend->>Frontend: WebSocket connection created for audio
    Frontend->>Frontend: WebSocket connection created for lipsync
    Frontend->>AudioServer: Connects to audio server
    activate AudioServer
    AudioServer->>AudioServer: WebSocket connection opened
    AudioServer->>Frontend: Connection established
    deactivate AudioServer
    Frontend->>LipsyncServer: Connects to lipsync server
    activate LipsyncServer
    LipsyncServer->>LipsyncServer: WebSocket connection opened
    LipsyncServer->>Frontend: Connection established
    deactivate LipsyncServer
    Frontend->>LipsyncServer: Sends metadata
    Frontend->>Frontend: Start main loop for audio and video playback
    Frontend->>AudioServer: Receive audio broadcast data
    AudioServer->>Frontend: Audio data
    Frontend->>LipsyncServer: Send Audio data to lipsync
    LipsyncServer->>Frontend: Lipsync data
    Frontend->>Frontend: Process lipsync data to frames and audio
    Frontend->>Frontend: Update audio queue
    Frontend->>Frontend: Update video queue
    Frontend->>Frontend: Play audio frames queue
    Frontend->>Frontend: Play video frames queue
    deactivate Frontend
Loading

Usage

Terminal 1: (AudioServer)

Linux

  1. Install FFMPEG
sudo apt install ffmpeg
  1. Install python modules
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. run radio broadcast websocket server
python app.py

Windows

  1. Install FFMPEG
winget install ffmpeg
  1. Install python modules
pip install -r requirements.txt
  1. run radio broadcast websocket server
python app.py

Terminal 2: (Frontend)

Open another terminal

  1. Install packages
npm install
  1. Create .env and add Simli API Key
NEXT_PUBLIC_SIMLI_API_KEY=YOUR-SIMLI-API-KEY
  1. Start
npm run dev

simli-webrtc-radio-next-js-demo's People

Contributors

anasmations avatar larsh0103 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.