Skip to main content

Player

Struct Player 

Source
pub struct Player { /* private fields */ }
Expand description

Re-exports the AVPlayer framework surface for this item. Safe wrapper around AVPlayer.

Implementations§

Source§

impl Player

Source

pub fn from_file_path(path: impl AsRef<Path>) -> Result<Self, AVPlayerError>

Create a player from a file path.

Source

pub fn from_remote_url(url: impl AsRef<str>) -> Result<Self, AVPlayerError>

Create a player from a remote URL.

Source

pub fn from_asset(asset: &Asset) -> Result<Self, AVPlayerError>

Create a player that plays the supplied asset.

Source

pub fn from_item(item: &PlayerItem) -> Result<Self, AVPlayerError>

Create a player from an already-configured item.

Source

pub fn status(&self) -> Result<PlayerStatus, AVPlayerError>

Calls the AVPlayer framework counterpart for status.

Source

pub fn error(&self) -> Result<Option<String>, AVPlayerError>

Calls the AVPlayer framework counterpart for error.

Source

pub fn rate(&self) -> Result<f32, AVPlayerError>

Calls the AVPlayer framework counterpart for rate.

Source

pub fn current_time(&self) -> Result<Time, AVPlayerError>

Calls the AVPlayer framework counterpart for current_time.

Source

pub fn duration(&self) -> Result<Time, AVPlayerError>

Calls the AVPlayer framework counterpart for duration.

Source

pub fn current_item(&self) -> Option<PlayerItem>

Calls the AVPlayer framework counterpart for current_item.

Source

pub fn play(&self)

Calls the AVPlayer framework counterpart for play.

Source

pub fn pause(&self)

Calls the AVPlayer framework counterpart for pause.

Source

pub fn set_rate(&self, rate: f32)

Calls the AVPlayer framework counterpart for set_rate.

Source

pub fn seek_to(&self, time: Time) -> Result<(), AVPlayerError>

Calls the AVPlayer framework counterpart for seek_to.

Source

pub fn add_periodic_time_observer<F>( &self, interval: Time, queue_label: Option<&str>, callback: F, ) -> Result<PeriodicTimeObserver, AVPlayerError>
where F: FnMut(Time) + Send + 'static,

Calls the AVPlayer framework counterpart for add_periodic_time_observer.

Source

pub fn add_boundary_time_observer<F>( &self, times: &[Time], queue_label: Option<&str>, callback: F, ) -> Result<BoundaryTimeObserver, AVPlayerError>
where F: FnMut() + Send + 'static,

Calls the AVPlayer framework counterpart for add_boundary_time_observer.

Source§

impl Player

Source

pub fn time_control_status( &self, ) -> Result<PlayerTimeControlStatus, AVPlayerError>

Calls the AVPlayer framework counterpart for time_control_status.

Source

pub fn reason_for_waiting_to_play( &self, ) -> Result<Option<String>, AVPlayerError>

Calls the AVPlayer framework counterpart for reason_for_waiting_to_play.

Source

pub fn waiting_reason( &self, ) -> Result<Option<PlayerWaitingReason>, AVPlayerError>

Calls the AVPlayer framework counterpart for waiting_reason.

Source

pub fn action_at_item_end(&self) -> Result<PlayerActionAtItemEnd, AVPlayerError>

Calls the AVPlayer framework counterpart for action_at_item_end.

Source

pub fn set_action_at_item_end( &self, action: PlayerActionAtItemEnd, ) -> Result<(), AVPlayerError>

Calls the AVPlayer framework counterpart for set_action_at_item_end.

Source

pub fn volume(&self) -> Result<f32, AVPlayerError>

Calls the AVPlayer framework counterpart for volume.

Source

pub fn set_volume(&self, volume: f32)

Calls the AVPlayer framework counterpart for set_volume.

Source

pub fn is_muted(&self) -> Result<bool, AVPlayerError>

Calls the AVPlayer framework counterpart for is_muted.

Source

pub fn set_muted(&self, muted: bool)

Calls the AVPlayer framework counterpart for set_muted.

Source

pub fn automatically_waits_to_minimize_stalling( &self, ) -> Result<bool, AVPlayerError>

Calls the AVPlayer framework counterpart for automatically_waits_to_minimize_stalling.

Source

pub fn set_automatically_waits_to_minimize_stalling(&self, enabled: bool)

Calls the AVPlayer framework counterpart for set_automatically_waits_to_minimize_stalling.

Source

pub fn applies_media_selection_criteria_automatically( &self, ) -> Result<bool, AVPlayerError>

Calls the AVPlayer framework counterpart for applies_media_selection_criteria_automatically.

Source

pub fn set_applies_media_selection_criteria_automatically(&self, enabled: bool)

Calls the AVPlayer framework counterpart for set_applies_media_selection_criteria_automatically.

Source

pub fn eligible_for_hdr_playback(&self) -> Result<bool, AVPlayerError>

Calls the AVPlayer framework counterpart for eligible_for_hdr_playback.

Source

pub fn audiovisual_background_playback_policy( &self, ) -> Result<PlayerAudiovisualBackgroundPlaybackPolicy, AVPlayerError>

Calls the AVPlayer framework counterpart for audiovisual_background_playback_policy.

Source

pub fn set_audiovisual_background_playback_policy( &self, policy: PlayerAudiovisualBackgroundPlaybackPolicy, ) -> Result<(), AVPlayerError>

Calls the AVPlayer framework counterpart for set_audiovisual_background_playback_policy.

Source

pub fn network_resource_priority( &self, ) -> Result<PlayerNetworkResourcePriority, AVPlayerError>

Calls the AVPlayer framework counterpart for network_resource_priority.

Source

pub fn set_network_resource_priority( &self, priority: PlayerNetworkResourcePriority, ) -> Result<(), AVPlayerError>

Calls the AVPlayer framework counterpart for set_network_resource_priority.

Source

pub fn observe_rate_changes<F>( &self, queue_label: Option<&str>, callback: F, ) -> Result<PlayerRateDidChangeObserver, AVPlayerError>
where F: Fn(PlayerRateDidChangeEvent) + Send + 'static,

Calls the AVPlayer framework counterpart for observe_rate_changes.

Source

pub fn set_media_selection_criteria( &self, media_characteristic: &MediaCharacteristic, criteria: Option<&PlayerMediaSelectionCriteria>, ) -> Result<(), AVPlayerError>

Calls the AVPlayer framework counterpart for set_media_selection_criteria.

Source

pub fn media_selection_criteria( &self, media_characteristic: &MediaCharacteristic, ) -> Result<Option<PlayerMediaSelectionCriteria>, AVPlayerError>

Calls the AVPlayer framework counterpart for media_selection_criteria.

Source§

impl Player

Source

pub fn set_video_output(&self, output: Option<&PlayerVideoOutput>)

Calls the AVPlayer framework counterpart for set_video_output.

Source

pub fn video_output(&self) -> Option<PlayerVideoOutput>

Calls the AVPlayer framework counterpart for video_output.

Trait Implementations§

Source§

impl Debug for Player

Source§

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

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

impl Drop for Player

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Player

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