hls-playlist

Crates.iohls-playlist
lib.rshls-playlist
version0.2.0
sourcesrc
created_at2024-05-21 20:22:09.232581
updated_at2024-06-26 03:02:56.202288
descriptionA library for serializing and deserializing HLS playlists (aka extended M3U playlists).
homepage
repositoryhttps://github.com/raibu-stream/hls-playlist
max_upload_size
id1247173
size159,332
Logan Wemyss (VixieTSQ)

documentation

README

HLS Playlist

A library for serializing and deserializing HLS playlists (aka extended M3U playlists).

As specified by this updated version of RFC 8216.

Usage

Playlists

use hls_playlist::playlist::{MediaPlaylist, MediaSegment};
use hls_playlist::{FloatOrInteger};

let playlist = MediaPlaylist {
    segments: vec![
        MediaSegment {
            uri: "https://example.com/1.mp4".into(),
            duration_seconds: FloatOrInteger::Float(5.5),
            title: String::new(),
            byte_range_or_bitrate: None,
            is_discontinuity: false,
            encryption: None,
            media_initialization_section: None,
            absolute_time: None,
            is_gap: false,
            parts: vec![]
        }
    ],
    ..MediaPlaylist::default()
};

let mut output = Vec::new();
playlist.serialize(&mut output).unwrap();

assert_eq!(String::from_utf8(output).unwrap(), "#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:0
#EXTINF:5.5
https://example.com/1.mp4
");

Tags

use hls_playlist::tags::Tag;

let mut output = vec![];

Tag::M3u.serialize(&mut output).unwrap();
Tag::XStart { offset_seconds: 10.0, is_precise: false }.serialize(&mut output).unwrap();

assert_eq!(String::from_utf8(output).unwrap(), "#EXTM3U
#EXT-X-START:TIME-OFFSET=10
");

Features

  • steering-manifest: Enables support for serializing and deserializing steering manifests.

Roadmap

This library is 100% finished and feature-complete as far as serialization goes. I'd like to implement deserialization sometime in the future.

  • Serialize steering manifest
  • Serialize tags
  • Serialize playlist
  • Deserialize steering manifest
  • Deserialize tags
  • Deserialize playlist
Commit count: 9

cargo fmt