Skip to main content

SabrPlaybackSession

Struct SabrPlaybackSession 

Source
pub struct SabrPlaybackSession {
    pub video_id: String,
    pub cpn: String,
    pub current_url: String,
    pub po_token: Option<Vec<u8>>,
    pub context_token: Option<Vec<u8>>,
    pub backoff_ms: u32,
    pub current_media_time_ms: u64,
    pub buffered_media_time_ms: u64,
    pub next_sq: u64,
    pub segment_duration_ms: u64,
    pub last_request_time_ms: u64,
}
Expand description

長時間 YouTube 再生におけるセグメント自動取得と状態維持を担うセッション管理構造体。

Fields§

§video_id: String§cpn: String§current_url: String§po_token: Option<Vec<u8>>§context_token: Option<Vec<u8>>§backoff_ms: u32§current_media_time_ms: u64§buffered_media_time_ms: u64§next_sq: u64§segment_duration_ms: u64§last_request_time_ms: u64

Implementations§

Source§

impl SabrPlaybackSession

Source

pub fn new(video_id: &str, cpn: &str, initial_url: &str) -> Self

新規セッションを開始する。

Source

pub fn update_with_request(&mut self, url: &str, body: &[u8])

送信されたリクエスト(URL および protobuf body)からセッション状態(CPN, po_token, 再生ウィンドウ)を更新する。

Source

pub fn cached_po_token(&self) -> Option<&[u8]>

キャッシュされている po_token(Attestation 署名)を取得する。

Source

pub fn update_playback_head(&mut self, current_ms: u64)

再生ヘッドの進行を更新する。

Source

pub fn needs_refill(&self, buffer_threshold_ms: u64) -> bool

バッファ残量がしきい値(ミリ秒)を下回っているか判定する。

Source

pub fn process_response(&mut self, ump_data: &[u8]) -> Option<Vec<u8>>

UMP レスポンスを処理し、Part 37(NextRequestPolicy)のメタデータ更新と Part 21(メディア fMP4 チャンク)の抽出を行う。

Source

pub fn next_window(&self) -> PlaybackWindow

次に要求すべき再生ウィンドウ情報を生成する。

Source

pub fn encode_request_body(&self, po_token: Option<&[u8]>) -> Vec<u8> ⓘ

現在のセッション状態から次セグメント取得用の protobuf リクエスト本文を生成する。

Trait Implementations§

Source§

impl Clone for SabrPlaybackSession

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SabrPlaybackSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SabrPlaybackSession

Source§

impl PartialEq for SabrPlaybackSession

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SabrPlaybackSession

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.