Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High Level m3u8 interface #29

Open
Luro02 opened this issue Sep 21, 2019 · 3 comments
Open

High Level m3u8 interface #29

Luro02 opened this issue Sep 21, 2019 · 3 comments
Labels
E-hard Effort: hard. A task that requires a lot of work. P-low Priority: low. This task has a low priority. T-enhancement Type: enhancement. New feature or request
Milestone

Comments

@Luro02
Copy link
Collaborator

Luro02 commented Sep 21, 2019

It'd be nice to have some kind of high level struct, that does all the parsing, for example to download chunks and decrypt them correctly. For downloading one should use reqwest and for decrypting aes.

The API could look something like this;

use hls_m3u8::Client;

let client = Client::new(&input_str); // internally reqwest is used
client.with_request(|req| { // this function will be applied to each request.
    // this can be used to add additional headers to the request
    // (some servers could for example require cookies)
    req
});

client.with_custom(|url| { // -> impl Future<Output = Result<Vec<u8>, E>>
   // returns the raw data from the url
    async {
        // do async reqwest here...
    }
});

{
    let cache = client.get_mut_cache() -> &mut Cache;
    cache.set_size(1024*1024*1024); // maximum cached packages are 1GiB
    cache.set_max_packages(50);
    cache.clear(); // empties the cache
} // drop &mut Cache

// Chunks should be loaded in the background, depending on the configuration
// The next chunk can be fetched like this
client.next().await?; // returns next chunk, either from the cache or directly downloaded
@Luro02 Luro02 added T-enhancement Type: enhancement. New feature or request E-hard Effort: hard. A task that requires a lot of work. P-low Priority: low. This task has a low priority. labels Sep 21, 2019
@Luro02 Luro02 added this to the 0.4 milestone Feb 3, 2020
@Luro02
Copy link
Collaborator Author

Luro02 commented Apr 10, 2020

I think this should be put in a separate crate that is built on top of this one. Maybe called hls_m3u8-client?

@gquintard
Copy link

Hi,

Sorry if it's the wrong issue to comment on, but would be nice to be able to get back an enum telling what kind of manifest this is. Or maybe it already exist and I didn't find it?

@Luro02
Copy link
Collaborator Author

Luro02 commented Apr 26, 2020

would be nice to be able to get back an enum telling what kind of manifest this is.

I agree, before I knew anything about m3u8 files I had a similar thought, but now I am pretty certain that you will most likely get a MasterPlaylist first (the links to the MediaPlaylist files are inside the MasterPlaylist)

Or maybe it already exist and I didn't find it?

No such a method does not currently exist.

Sorry if it's the wrong issue to comment on,

I made an issue for it, see #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard Effort: hard. A task that requires a lot of work. P-low Priority: low. This task has a low priority. T-enhancement Type: enhancement. New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants