Skip to main content

MediaSourceCore

Struct MediaSourceCore 

Source
pub struct MediaSourceCore {
    pub ready_state: MediaSourceReadyState,
    pub duration: f64,
    pub source_buffers: Vec<SourceBufferCore>,
    pub live_seekable_range: Option<(f64, f64)>,
    next_buffer_id: usize,
}
Expand description

MediaSource の純粋コア実装

Fields§

§ready_state: MediaSourceReadyState§duration: f64§source_buffers: Vec<SourceBufferCore>§live_seekable_range: Option<(f64, f64)>§next_buffer_id: usize

Implementations§

Source§

impl MediaSourceCore

Source

pub fn new() -> Self

Source

pub fn is_type_supported(mime_type: &str) -> bool

対象の MIME タイプとコーデック・追加パラメータが実際に復号できるか。 【2026-10-17】従来は WebM・MP3 も「対応」と答えていたが、VP8/VP9/AV1/Opus と MP3 の デコーダは無い。YouTube のプレーヤーはここで選ぶ形式を決めるので、復号できるもの (fMP4 の H.264 = avc1/avc3 と AAC-LC = mp4a.40.2 / mp4a.67)だけを返す。 【2026-10-18】YouTube が画質・上限判定のために付与する追加パラメータ(width=99999、 height=99999、framerate=999、channels=99、bitrate=999999999 等)や未知パラメータも検証する。

Source

pub fn open(&mut self)

ストリームオープン(URL.createObjectURL または video.src 割り当て時)

Source

pub fn add_source_buffer(&mut self, mime_type: &str) -> Result<usize, MseError>

SourceBuffer の追加(addSourceBuffer)

Source

pub fn remove_source_buffer(&mut self, id: usize) -> Result<(), MseError>

SourceBuffer の削除(removeSourceBuffer)

Source

pub fn get_source_buffer_mut( &mut self, id: usize, ) -> Option<&mut SourceBufferCore>

SourceBuffer の取得

Source

pub fn end_of_stream(&mut self) -> Result<(), MseError>

ストリームの終了(endOfStream)

Source

pub fn set_live_seekable_range( &mut self, start: f64, end: f64, ) -> Result<(), MseError>

ライブ配信用のシーク可能範囲を設定する(setLiveSeekableRange(start, end))。

Source

pub fn clear_live_seekable_range(&mut self) -> Result<(), MseError>

ライブ配信用のシーク可能範囲を解除する(clearLiveSeekableRange())。

Trait Implementations§

Source§

impl Default for MediaSourceCore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.