#hls #m3u8 #parser #live-streaming #protocols #http

hls_parse

A library for parsing m3u8 files (Apple's HTTP Live Streaming (HLS) protocol)

5 releases

0.1.4 Mar 29, 2022
0.1.3 Mar 23, 2022
0.1.2 Mar 22, 2022
0.1.1 Mar 22, 2022
0.1.0 Mar 22, 2022

#7 in #m3u8

MIT license

750KB
600 lines

hls_parse

crates.io

A Rust library for parsing m3u8 playlists (HTTP Live Streaming) link.

Installation

To use this library, add the following dependency to Cargo.toml:

[dependencies]
hls_parse = "0.1.2"

Also available on crates.io

Examples

use hls_parse::protocol::HLS;
let m3u8 = "#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXTINF:9.009,
http://media.example.com/first.ts
#EXTINF:9.009,
http://media.example.com/second.ts
#EXTINF:3.003,
http://media.example.com/third.ts
#EXT-X-ENDLIST";
let base_url = "http://media.example.com".to_string();
let mut hls = HLS::new();
hls.set_base_url(&base_url);
hls.parse(&m3u8);

Dependencies

~10MB
~161K SLoC