Skip to main content

MediaControlsState

Struct MediaControlsState 

Source
pub struct MediaControlsState {
Show 13 fields pub current_time: f64, pub duration: f64, pub volume: f32, pub muted: bool, pub paused: bool, pub fullscreen: bool, pub playback_rate: f32, pub hud_text: Option<String>, pub hud_ticks: u32, pub subtitle_tracks: Vec<SubtitleTrack>, pub active_track_idx: Option<usize>, pub current_quality_idx: usize, pub abr: AbrController,
}
Expand description

メディアプレイヤーの再生状態・コントロール計算

Fields§

§current_time: f64§duration: f64§volume: f32§muted: bool§paused: bool§fullscreen: bool§playback_rate: f32§hud_text: Option<String>§hud_ticks: u32§subtitle_tracks: Vec<SubtitleTrack>§active_track_idx: Option<usize>§current_quality_idx: usize§abr: AbrController

Implementations§

Source§

impl MediaControlsState

Source

pub const QUALITIES: [&'static str; 5]

Source

pub fn new(duration: f64) -> Self

Source

pub fn current_quality(&self) -> &'static str

現在選択されている画質文字列(例: “Auto”, “1080p HD”)

Source

pub fn quality_badge(&self) -> &'static str

操作バーに表示する画質バッジ文字列(例: “AUTO”, “HD”, “720”, “480”, “360”)

Source

pub fn cycle_quality(&mut self) -> (&'static str, usize, usize)

画質設定を順繰りに切り替え(Auto → 1080p HD → 720p HD → 480p → 360p → Auto) 切り替え後の (画質名, 1始まりインデックス, 総数) を返す

Source

pub fn effective_quality_index( &mut self, reps: &[StreamRepresentation], buffer_ahead_sec: f64, total_frames: u64, dropped_frames: u64, ) -> usize

ABR モードに応じた実効画質インデックスの取得

Source

pub fn toggle_fullscreen(&mut self) -> bool

全画面表示トグル

Source

pub fn set_subtitles(&mut self, vtt: WebVtt)

単一の字幕ドキュメント(WebVTT)を既定トラックとして登録

Source

pub fn add_subtitle_track(&mut self, track: SubtitleTrack)

新たな字幕トラックを追加登録

Source

pub fn cycle_subtitles(&mut self) -> Option<(String, usize, usize)>

字幕トラックを順繰りに切り替え(トラック1 → トラック2 → … → オフ → トラック1) 切り替え後の (トラック名, 1始まりのインデックス, トラック総数) を返す。オフになった場合は None を返す。

Source

pub fn active_subtitle_track(&self) -> Option<&SubtitleTrack>

現在選択されているアクティブ字幕トラックを取得

Source

pub fn toggle_subtitles(&mut self) -> bool

字幕表示のオン/オフ切り替え(オフなら先頭トラックを有効化)

Source

pub fn subtitles_enabled(&self) -> bool

字幕が有効化されているか

Source

pub fn current_subtitle_text(&self) -> Option<String>

現在の再生時刻に合致する字幕テキストを取得(無効時は None)

Source

pub fn current_track_badge(&self) -> String

操作バー等に表示する言語バッジ文字列(例: “JA”, “EN”, 有効だが未設定時は “CC”)

Source

pub fn set_hud(&mut self, text: &str, ticks: u32)

HUD(ヘッドアップディスプレイ)メッセージを設定(ticks: 表示フレーム数)

Source

pub fn tick_hud(&mut self) -> Option<&str>

HUD の残り表示時間を進め、現在表示すべきテキストを返す

Source

pub fn adjust_playback_rate(&mut self, step: i8) -> f32

再生速度の増減(0.25x〜2.0x、0.25ステップ)

Source

pub fn progress_ratio(&self) -> f32

再生進行度(0.0〜1.0)

Source

pub fn format_display(&self) -> String

“00:30 / 02:00” 形式の文字列表現

Source

pub fn seek_by_ratio(&mut self, ratio: f32)

進行度パーセント(0.0〜1.0)からシーク

Source

pub fn calculate_seek_time( click_x: i32, bar_x: i32, bar_width: i32, duration: f64, ) -> f64

シークバーのクリックX座標から目標秒数を計算

Source

pub fn effective_volume(&self) -> f32

実効音量(ミュート時は 0.0)

Source

pub fn set_volume(&mut self, vol: f32)

音量の設定(0.0〜1.0)

Source

pub fn toggle_mute(&mut self) -> bool

ミュートトグル

Source

pub fn toggle_play(&mut self) -> bool

再生/一時停止トグル

Trait Implementations§

Source§

impl Clone for MediaControlsState

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 MediaControlsState

Source§

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

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

impl PartialEq for MediaControlsState

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 MediaControlsState

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
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.