Crate monolib

Source
Expand description

A library implementing the lonely radio audio streaming protocol

Example usage (play for 10 seconds):

extern crate monolib;
use std::thread::{sleep, spawn};
use std::time::Duration;
use monolib::lonelyradio_types::{Settings, Encoder};

spawn(|| monolib::run("someserver:someport", Settings {encoder: Encoder::Flac, cover: -1}, "my_playlist"));
while monolib::get_metadata().is_none() {}
let seconds = md.length / md.sample_rate as u64 / 2;
println!("Playing: {} - {} - {} ({}:{:02})", md.artist, md.album, md.title, seconds / 60, seconds % 60);
sleep(Duration::from_secs(10));
monolib::stop();

Re-exports§

pub use lonelyradio_types;

Modules§

c
Functions, providing C-like API

Enums§

State
Player state

Functions§

get_metadata
get_state
get_track
Download track as samples
get_volume
list_playlists
run
Starts playing at “server:port”
set_volume
stop
Stops playback
toggle
Play/pauses playback