Expand description
§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
Modules§
- playlist
- High level representations of extended M3U playlists.
- steering_
manifest steering-manifest
- A representation of a HLS steering manifest.
- tags
- Representations of extended M3U playlist tags.
Structs§
- Byte
Range - Represents a range of bytes in a given resource.
- Byte
Range With Offset - Represents a range of bytes in a given resource.
- Content
Protection Configuration - Represents required content protection robustness for a given
key_format
- Content
Steering - Identifies a
steering_manifest::SteeringManifest
. - Date
Range - A duration of time with specific attributes.
- Date
Range Cue - When to trigger an action associated with a given
DateRange
. - Delta
Update Info - Information about the server’s playlist delta update capabilities.
- Preload
Hint - A hint that the client should request a resource before it is available to be delivered.
- Rendition
Report - Information about an associated Rendition that is as up-to-date as the Playlist that contains the report.
- Resolution
- A video resolution in pixels.
- Session
Data - Arbitrary session data.
- Stream
Inf - Metadata for a given stream.
- Supplemental
Codec - Describes media samples with both a backward-compatible base layer and a newer enhancement layer.
Enums§
- Attribute
Value - Audio
Channel Information - Information about the audio channels in a given rendition.
- Date
Range CuePosition - The relative time at which a given
DateRange
action is to be triggered. - Definition
Type - Encryption
Method - Information about the encryption method of a given
MediaSegment
. - Float
OrInteger - Hdcp
Level - The High-bandwidth Digital Content Protection level.
- InStream
Id - Specifies a Rendition within the segments in the
MediaPlaylist
. - KeyFormat
- Specifies how a given encryption key is represented.
- Playlist
Type - If
Event
, Media Segments can only be added to the end of the Media Playlist. IfVod
, the Media Playlist cannot change. - Preload
Hint Type - Whether a given resource is a
PartialSegment
or aMediaInitializationSection
. - Rendition
Playback Priority - The priority in which a given rendition should be chosen over another rendition.
- Session
Data Value - Whether the data is stored inline or identified by a URI.
- UriFormat
- The format of the data value.
- Video
Channel Specifier - Indicates whether some video content is stereoscopic or not.
- Video
Range