[][src]Trait hls_m3u8::Decryptable

pub trait Decryptable: Sealed {
#[must_use]    fn keys(&self) -> Vec<&DecryptionKey>;

#[must_use]    fn first_key(&self) -> Option<&DecryptionKey> { ... }
#[must_use] fn len(&self) -> usize { ... }
#[must_use] fn is_empty(&self) -> bool { ... } }

Signals that a type or some of the asssociated data might need to be decrypted.

Note

You are not supposed to implement this trait, therefore it is "sealed".

Required methods

#[must_use]fn keys(&self) -> Vec<&DecryptionKey>

Returns all keys, associated with the type.

Example

use hls_m3u8::tags::ExtXMap;
use hls_m3u8::types::{ByteRange, EncryptionMethod};
use hls_m3u8::Decryptable;

let map = ExtXMap::with_range("https://www.example.url/", ByteRange::from(2..11));

for key in map.keys() {
    if key.method == EncryptionMethod::Aes128 {
        // fetch content with the uri and decrypt the result
        break;
    }
}
Loading content...

Provided methods

#[must_use]fn first_key(&self) -> Option<&DecryptionKey>

Most of the time only a single key is provided, so instead of iterating through all keys, one might as well just get the first key.

#[must_use]fn len(&self) -> usize

Returns the number of keys.

#[must_use]fn is_empty(&self) -> bool

Returns true, if the number of keys is zero.

Loading content...

Implementors

impl Decryptable for MediaSegment[src]

impl Decryptable for ExtXMap[src]

Loading content...