Git Product home page Git Product logo

kawa's Introduction

kawa

kawa is an ffmpeg-based radio streamer.

Compiling

Install the dependencies:

  • ffmpeg
  • rustc (stable)
  • cargo (stable)
$ cargo build --release
# cargo install

Usage

Start by copying example_config.toml to the location of your choice and reading through it. Batteries are not included - kawa needs to be paired with your own software to find songs to stream. You will have to provide an external API that kawa can query for songs to play and notify as new songs being played.

API

Kawa provides an HTTP API for management the queue. Kawa will play songs from the queue until it is exhausted, then request new tracks from [queue].random_song_api.

GET /np

Response

{ track blob }

GET /listeners

Response

[
    {
        "mount": "stream256.opus",
        "path": "/stream256.opus?user=minus",
        "headers": [
            {
                "name": "User-Agent",
                "value": "Music Player Daemon 0.20.9"
            },
            ...
        ]
    },
    ...
]

GET /queue

Response

[
    { track blob },
    ...
]

POST /queue/head

Inserts a track at the top of the queue.

Request

{ track blob }

Note: track blob is an arbitrary JSON blob that Kawa will hold on to for you. At a minimum it must include "path", the path to the audio source on the filesystem. Additionally, a unique "queue_id" field will be added whenever the blob is retrieved and can be used for manipulation of the queue.

Response

{
    "success": true,
    "reason": null
}

POST /queue/tail

Inserts a track at the bottom of the queue. See /queue/head.

DELETE /queue/head

Unqueues the track at the top of the queue.

Response

{
    "success": true,
    "reason": null
}

DELETE /queue/tail

Unqueues the track at the bottom of the queue. See /queue/tail.

POST /queue/clear

Removes all tracks from the queue.

Response

{
    "success": true,
    "reason": null
}

POST /skip

Immediately skips to the next track in the queue.

Response

{
    "success": true,
    "reason": null
}

kawa's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kawa's Issues

ICY Metadata

Since the current metadata situation sucks, try adding in ICY metadata.

User agent modes

Even though mpv and other players more or less work fine, ffmpeg complains about the chained file approach we have to take due to mpd. We should alter operational modes based on the user agents to ensure all clients have a better experience.

Track changes on Opus cause stream interruption on Chrome

While playing back OGG/Opus streams, a new track will bring the playback to a stop.
To workaround this problem, I have a JS listener on error that tries to restart the stream.

These are the errors that get printed to the console if you log them:

PIPELINE_ERROR_DECODE: Failed to send audio packet for decoding: timestamp=93126542 duration=960000 size=19 side_data_size=0 is_key_frame=1 encrypted=0 discard_padding (ms)=(0, 0)
PIPELINE_ERROR_DECODE: Failed to send audio packet for decoding: timestamp=93126542 duration=960000 size=19 side_data_size=0 is_key_frame=1 encrypted=0 discard_padding (ms)=(0, 0)
PIPELINE_ERROR_DECODE: Failed to send audio packet for decoding: timestamp=1028188 duration=960000 size=19 side_data_size=0 is_key_frame=1 encrypted=0 discard_padding (ms)=(0, 0)

Using latest kawa, tested in multiple radios

Trust timestamps less

Really weird timestamps currently screw up kawa badly (way too slow/fast). We should probably switch to approximation via samples/sample rate, maybe only if we detect something really weird though.

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.