pub struct Player { /* private fields */ }Expand description
Re-exports the AVPlayer framework surface for this item.
Safe wrapper around AVPlayer.
Implementations§
Source§impl Player
impl Player
Sourcepub fn from_file_path(path: impl AsRef<Path>) -> Result<Self, AVPlayerError>
pub fn from_file_path(path: impl AsRef<Path>) -> Result<Self, AVPlayerError>
Create a player from a file path.
Sourcepub fn from_remote_url(url: impl AsRef<str>) -> Result<Self, AVPlayerError>
pub fn from_remote_url(url: impl AsRef<str>) -> Result<Self, AVPlayerError>
Create a player from a remote URL.
Sourcepub fn from_asset(asset: &Asset) -> Result<Self, AVPlayerError>
pub fn from_asset(asset: &Asset) -> Result<Self, AVPlayerError>
Create a player that plays the supplied asset.
Sourcepub fn from_item(item: &PlayerItem) -> Result<Self, AVPlayerError>
pub fn from_item(item: &PlayerItem) -> Result<Self, AVPlayerError>
Create a player from an already-configured item.
Sourcepub fn status(&self) -> Result<PlayerStatus, AVPlayerError>
pub fn status(&self) -> Result<PlayerStatus, AVPlayerError>
Calls the AVPlayer framework counterpart for status.
Sourcepub fn error(&self) -> Result<Option<String>, AVPlayerError>
pub fn error(&self) -> Result<Option<String>, AVPlayerError>
Calls the AVPlayer framework counterpart for error.
Sourcepub fn rate(&self) -> Result<f32, AVPlayerError>
pub fn rate(&self) -> Result<f32, AVPlayerError>
Calls the AVPlayer framework counterpart for rate.
Sourcepub fn current_time(&self) -> Result<Time, AVPlayerError>
pub fn current_time(&self) -> Result<Time, AVPlayerError>
Calls the AVPlayer framework counterpart for current_time.
Sourcepub fn duration(&self) -> Result<Time, AVPlayerError>
pub fn duration(&self) -> Result<Time, AVPlayerError>
Calls the AVPlayer framework counterpart for duration.
Sourcepub fn current_item(&self) -> Option<PlayerItem>
pub fn current_item(&self) -> Option<PlayerItem>
Calls the AVPlayer framework counterpart for current_item.
Sourcepub fn seek_to(&self, time: Time) -> Result<(), AVPlayerError>
pub fn seek_to(&self, time: Time) -> Result<(), AVPlayerError>
Calls the AVPlayer framework counterpart for seek_to.
Sourcepub fn add_periodic_time_observer<F>(
&self,
interval: Time,
queue_label: Option<&str>,
callback: F,
) -> Result<PeriodicTimeObserver, AVPlayerError>
pub fn add_periodic_time_observer<F>( &self, interval: Time, queue_label: Option<&str>, callback: F, ) -> Result<PeriodicTimeObserver, AVPlayerError>
Calls the AVPlayer framework counterpart for add_periodic_time_observer.
Sourcepub fn add_boundary_time_observer<F>(
&self,
times: &[Time],
queue_label: Option<&str>,
callback: F,
) -> Result<BoundaryTimeObserver, AVPlayerError>
pub fn add_boundary_time_observer<F>( &self, times: &[Time], queue_label: Option<&str>, callback: F, ) -> Result<BoundaryTimeObserver, AVPlayerError>
Calls the AVPlayer framework counterpart for add_boundary_time_observer.
Source§impl Player
impl Player
Sourcepub fn time_control_status(
&self,
) -> Result<PlayerTimeControlStatus, AVPlayerError>
pub fn time_control_status( &self, ) -> Result<PlayerTimeControlStatus, AVPlayerError>
Calls the AVPlayer framework counterpart for time_control_status.
Sourcepub fn reason_for_waiting_to_play(
&self,
) -> Result<Option<String>, AVPlayerError>
pub fn reason_for_waiting_to_play( &self, ) -> Result<Option<String>, AVPlayerError>
Calls the AVPlayer framework counterpart for reason_for_waiting_to_play.
Sourcepub fn waiting_reason(
&self,
) -> Result<Option<PlayerWaitingReason>, AVPlayerError>
pub fn waiting_reason( &self, ) -> Result<Option<PlayerWaitingReason>, AVPlayerError>
Calls the AVPlayer framework counterpart for waiting_reason.
Sourcepub fn action_at_item_end(&self) -> Result<PlayerActionAtItemEnd, AVPlayerError>
pub fn action_at_item_end(&self) -> Result<PlayerActionAtItemEnd, AVPlayerError>
Calls the AVPlayer framework counterpart for action_at_item_end.
Sourcepub fn set_action_at_item_end(
&self,
action: PlayerActionAtItemEnd,
) -> Result<(), AVPlayerError>
pub fn set_action_at_item_end( &self, action: PlayerActionAtItemEnd, ) -> Result<(), AVPlayerError>
Calls the AVPlayer framework counterpart for set_action_at_item_end.
Sourcepub fn volume(&self) -> Result<f32, AVPlayerError>
pub fn volume(&self) -> Result<f32, AVPlayerError>
Calls the AVPlayer framework counterpart for volume.
Sourcepub fn set_volume(&self, volume: f32)
pub fn set_volume(&self, volume: f32)
Calls the AVPlayer framework counterpart for set_volume.
Sourcepub fn is_muted(&self) -> Result<bool, AVPlayerError>
pub fn is_muted(&self) -> Result<bool, AVPlayerError>
Calls the AVPlayer framework counterpart for is_muted.
Sourcepub fn automatically_waits_to_minimize_stalling(
&self,
) -> Result<bool, AVPlayerError>
pub fn automatically_waits_to_minimize_stalling( &self, ) -> Result<bool, AVPlayerError>
Calls the AVPlayer framework counterpart for automatically_waits_to_minimize_stalling.
Sourcepub fn set_automatically_waits_to_minimize_stalling(&self, enabled: bool)
pub fn set_automatically_waits_to_minimize_stalling(&self, enabled: bool)
Calls the AVPlayer framework counterpart for set_automatically_waits_to_minimize_stalling.
Sourcepub fn applies_media_selection_criteria_automatically(
&self,
) -> Result<bool, AVPlayerError>
pub fn applies_media_selection_criteria_automatically( &self, ) -> Result<bool, AVPlayerError>
Calls the AVPlayer framework counterpart for applies_media_selection_criteria_automatically.
Sourcepub fn set_applies_media_selection_criteria_automatically(&self, enabled: bool)
pub fn set_applies_media_selection_criteria_automatically(&self, enabled: bool)
Calls the AVPlayer framework counterpart for set_applies_media_selection_criteria_automatically.
Sourcepub fn eligible_for_hdr_playback(&self) -> Result<bool, AVPlayerError>
pub fn eligible_for_hdr_playback(&self) -> Result<bool, AVPlayerError>
Calls the AVPlayer framework counterpart for eligible_for_hdr_playback.
Sourcepub fn audiovisual_background_playback_policy(
&self,
) -> Result<PlayerAudiovisualBackgroundPlaybackPolicy, AVPlayerError>
pub fn audiovisual_background_playback_policy( &self, ) -> Result<PlayerAudiovisualBackgroundPlaybackPolicy, AVPlayerError>
Calls the AVPlayer framework counterpart for audiovisual_background_playback_policy.
Sourcepub fn set_audiovisual_background_playback_policy(
&self,
policy: PlayerAudiovisualBackgroundPlaybackPolicy,
) -> Result<(), AVPlayerError>
pub fn set_audiovisual_background_playback_policy( &self, policy: PlayerAudiovisualBackgroundPlaybackPolicy, ) -> Result<(), AVPlayerError>
Calls the AVPlayer framework counterpart for set_audiovisual_background_playback_policy.
Sourcepub fn network_resource_priority(
&self,
) -> Result<PlayerNetworkResourcePriority, AVPlayerError>
pub fn network_resource_priority( &self, ) -> Result<PlayerNetworkResourcePriority, AVPlayerError>
Calls the AVPlayer framework counterpart for network_resource_priority.
Sourcepub fn set_network_resource_priority(
&self,
priority: PlayerNetworkResourcePriority,
) -> Result<(), AVPlayerError>
pub fn set_network_resource_priority( &self, priority: PlayerNetworkResourcePriority, ) -> Result<(), AVPlayerError>
Calls the AVPlayer framework counterpart for set_network_resource_priority.
Sourcepub fn observe_rate_changes<F>(
&self,
queue_label: Option<&str>,
callback: F,
) -> Result<PlayerRateDidChangeObserver, AVPlayerError>
pub fn observe_rate_changes<F>( &self, queue_label: Option<&str>, callback: F, ) -> Result<PlayerRateDidChangeObserver, AVPlayerError>
Calls the AVPlayer framework counterpart for observe_rate_changes.
Sourcepub fn set_media_selection_criteria(
&self,
media_characteristic: &MediaCharacteristic,
criteria: Option<&PlayerMediaSelectionCriteria>,
) -> Result<(), AVPlayerError>
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.
Sourcepub fn media_selection_criteria(
&self,
media_characteristic: &MediaCharacteristic,
) -> Result<Option<PlayerMediaSelectionCriteria>, AVPlayerError>
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
impl Player
Sourcepub fn set_video_output(&self, output: Option<&PlayerVideoOutput>)
pub fn set_video_output(&self, output: Option<&PlayerVideoOutput>)
Calls the AVPlayer framework counterpart for set_video_output.
Sourcepub fn video_output(&self) -> Option<PlayerVideoOutput>
pub fn video_output(&self) -> Option<PlayerVideoOutput>
Calls the AVPlayer framework counterpart for video_output.