pub struct MediaInfo {
pub content_id: String,
pub content_type: String,
pub stream_type: StreamType,
pub duration: Option<f64>,
pub metadata: Option<MediaMetadata>,
}Expand description
Description of media to be loaded onto the Cast device.
Fields§
§content_id: StringThe URL or content identifier.
content_type: StringMIME type (e.g., “video/mp4”, “application/x-mpegURL”).
stream_type: StreamTypeWhether this is buffered (VOD) or live content.
duration: Option<f64>Total duration in seconds (if known).
metadata: Option<MediaMetadata>Optional metadata (title, images, etc.).
Implementations§
Source§impl MediaInfo
impl MediaInfo
Sourcepub fn new(
content_id: impl Into<String>,
content_type: impl Into<String>,
) -> Self
pub fn new( content_id: impl Into<String>, content_type: impl Into<String>, ) -> Self
Create a new MediaInfo with the minimum required fields.
Sourcepub fn stream_type(self, stream_type: StreamType) -> Self
pub fn stream_type(self, stream_type: StreamType) -> Self
Set the stream type.
Sourcepub fn maybe_duration(self, duration: Option<f64>) -> Self
pub fn maybe_duration(self, duration: Option<f64>) -> Self
Set the duration if Some, no-op if None.
Avoids the let mut + if let dance when the duration is optional:
let dur: Option<f64> = Some(120.0);
let media = MediaInfo::new("url", "video/mp4").maybe_duration(dur);Sourcepub fn metadata(self, metadata: MediaMetadata) -> Self
pub fn metadata(self, metadata: MediaMetadata) -> Self
Set the metadata.
Sourcepub fn maybe_metadata(self, metadata: Option<MediaMetadata>) -> Self
pub fn maybe_metadata(self, metadata: Option<MediaMetadata>) -> Self
Set the metadata if Some, no-op if None.
Trait Implementations§
impl StructuralPartialEq for MediaInfo
Auto Trait Implementations§
impl Freeze for MediaInfo
impl RefUnwindSafe for MediaInfo
impl Send for MediaInfo
impl Sync for MediaInfo
impl Unpin for MediaInfo
impl UnsafeUnpin for MediaInfo
impl UnwindSafe for MediaInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more