Shaka Player Embedded
Classes | Public Member Functions | List of all members
shaka::media::ios::AvMediaPlayer Class Reference

#include <av_media_player.h>

Inheritance diagram for shaka::media::ios::AvMediaPlayer:
shaka::media::MediaPlayer

Classes

class  Impl
 

Public Member Functions

 AvMediaPlayer (ClientList *clients)
 
 ~AvMediaPlayer () override
 
const void * GetIosView ()
 
const void * GetAvPlayer ()
 
MediaCapabilitiesInfo DecodingInfo (const MediaDecodingConfiguration &config) const override
 
struct VideoPlaybackQuality VideoPlaybackQuality () const override
 
void AddClient (Client *client) const override
 
void RemoveClient (Client *client) const override
 
std::vector< BufferedRangeGetBuffered () const override
 
VideoReadyState ReadyState () const override
 
VideoPlaybackState PlaybackState () const override
 
std::vector< std::shared_ptr< MediaTrack > > AudioTracks () override
 
std::vector< std::shared_ptr< const MediaTrack > > AudioTracks () const override
 
std::vector< std::shared_ptr< MediaTrack > > VideoTracks () override
 
std::vector< std::shared_ptr< const MediaTrack > > VideoTracks () const override
 
std::vector< std::shared_ptr< TextTrack > > TextTracks () override
 
std::vector< std::shared_ptr< const TextTrack > > TextTracks () const override
 
std::shared_ptr< TextTrackAddTextTrack (TextTrackKind kind, const std::string &label, const std::string &language) override
 
bool SetVideoFillMode (VideoFillMode mode) override
 
uint32_t Width () const override
 
uint32_t Height () const override
 
double Volume () const override
 
void SetVolume (double volume) override
 
bool Muted () const override
 
void SetMuted (bool muted) override
 
void Play () override
 
void Pause () override
 
double CurrentTime () const override
 
void SetCurrentTime (double time) override
 
double Duration () const override
 
void SetDuration (double duration) override
 
double PlaybackRate () const override
 
void SetPlaybackRate (double rate) override
 
bool AttachSource (const std::string &src) override
 
bool AttachMse () override
 
bool AddMseBuffer (const std::string &mime, bool is_video, const ElementaryStream *stream) override
 
void LoadedMetaData (double duration) override
 
void MseEndOfStream () override
 
bool SetEmeImplementation (const std::string &key_system, eme::Implementation *implementation) override
 
void Detach () override
 
- Public Member Functions inherited from shaka::media::MediaPlayer
 MediaPlayer ()
 
virtual ~ MediaPlayer ()
 
 MediaPlayer (const MediaPlayer &)=delete
 
MediaPlayeroperator= (const MediaPlayer &)=delete
 
 MediaPlayer (MediaPlayer &&)=delete
 
MediaPlayeroperator= (MediaPlayer &&)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from shaka::media::MediaPlayer
static void SetMediaPlayerForSupportChecks (const MediaPlayer *player)
 
static const MediaPlayerGetMediaPlayerForSupportChecks ()
 

Detailed Description

A MediaPlayer implementation that uses iOS' AVPlayer to play src= content.

Definition at line 32 of file av_media_player.h.

Constructor & Destructor Documentation

§ AvMediaPlayer()

shaka::media::ios::AvMediaPlayer::AvMediaPlayer ( ClientList clients)
explicit

Definition at line 406 of file av_media_player.mm.

§ ~AvMediaPlayer()

shaka::media::ios::AvMediaPlayer::~AvMediaPlayer ( )
override

Definition at line 407 of file av_media_player.mm.

Member Function Documentation

§ AddClient()

void shaka::media::ios::AvMediaPlayer::AddClient ( Client client) const
overridevirtual

Adds a new client listener. The given object will be called when events are raised. Clients are called in the order they are registered. Calling this with an already-registered client will have no effect.

Implements shaka::media::MediaPlayer.

Definition at line 435 of file av_media_player.mm.

§ AddMseBuffer()

bool shaka::media::ios::AvMediaPlayer::AddMseBuffer ( const std::string &  mime,
bool  is_video,
const ElementaryStream stream 
)
overridevirtual

Adds a new MSE buffer to pull frames from. This can be called after normal playback has started, but that doesn't have to be supported. This will be called for each SourceBuffer object created. If the source content is multiplexed, this will be called twice for the same input stream, but will be given separate audio/video buffers.

Parameters
mimeThe full MIME type given from JavaScript.
is_videoTrue if this is for a video stream, false for audio.
streamThe stream containing the encoded frames.
Returns
True on success, false on error or unsupported.

Implements shaka::media::MediaPlayer.

Definition at line 579 of file av_media_player.mm.

§ AddTextTrack()

std::shared_ptr< TextTrack > shaka::media::ios::AvMediaPlayer::AddTextTrack ( TextTrackKind  kind,
const std::string &  label,
const std::string &  language 
)
overridevirtual

Adds a new text track to the player. This can return nullptr if this isn't supported.

Parameters
kindThe kind of the new track.
labelA string label for the track.
languageThe language of the new track.
Returns
The new track object, or nullptr on error or if unsupported.

Implements shaka::media::MediaPlayer.

Definition at line 484 of file av_media_player.mm.

§ AttachMse()

bool shaka::media::ios::AvMediaPlayer::AttachMse ( )
overridevirtual

Starts MSE-based playback. At a later time, AddMseBuffer will be called to give streams to pull from.

Returns
True on success, false if MSE playback isn't supported.

Implements shaka::media::MediaPlayer.

Definition at line 576 of file av_media_player.mm.

§ AttachSource()

bool shaka::media::ios::AvMediaPlayer::AttachSource ( const std::string &  src)
overridevirtual

Starts playback using the given src= URL. The player should read data from the given URL and play its content.

Parameters
srcThe URL to read from.
Returns
True on success, false on invalid URL or if src= isn't supported.

Implements shaka::media::MediaPlayer.

Definition at line 573 of file av_media_player.mm.

§ AudioTracks() [1/2]

std::vector< std::shared_ptr< MediaTrack > > shaka::media::ios::AvMediaPlayer::AudioTracks ( )
overridevirtual
Returns
The current audio tracks in the media.

Implements shaka::media::MediaPlayer.

Definition at line 463 of file av_media_player.mm.

§ AudioTracks() [2/2]

std::vector< std::shared_ptr< const MediaTrack > > shaka::media::ios::AvMediaPlayer::AudioTracks ( ) const
overridevirtual
Returns
The current audio tracks in the media.

Implements shaka::media::MediaPlayer.

Definition at line 466 of file av_media_player.mm.

§ CurrentTime()

double shaka::media::ios::AvMediaPlayer::CurrentTime ( ) const
overridevirtual
Returns
The current time of the video, or 0 if nothing is loaded.

Implements shaka::media::MediaPlayer.

Definition at line 538 of file av_media_player.mm.

§ DecodingInfo()

MediaCapabilitiesInfo shaka::media::ios::AvMediaPlayer::DecodingInfo ( const MediaDecodingConfiguration config) const
overridevirtual

Checks whether the given content can be played. In general, for MSE playback, this shouldn't check whether it can be demuxed, this should only check whether the streams can be decoded. The Demuxer should handle whether it can be demuxed.

The return value must be the same throughout playback and should be the same for all MediaPlayer implementations that are used. Since type support checking is done before a specific MediaPlayer is selected, it is expected that all MediaPlayer instances return the same value. If this isn't the case, it can cause runtime decoder errors since filtering is done early.

Parameters
configThe configuration to check support for.
Returns
The capabilities for the given configuration.

Implements shaka::media::MediaPlayer.

Definition at line 416 of file av_media_player.mm.

§ Detach()

void shaka::media::ios::AvMediaPlayer::Detach ( )
overridevirtual

Stops playback from the current media. This should stop using the current ElementaryStream objects and halt playback.

Implements shaka::media::MediaPlayer.

Definition at line 589 of file av_media_player.mm.

§ Duration()

double shaka::media::ios::AvMediaPlayer::Duration ( ) const
overridevirtual
Returns
The current duration of the media, or Infinity if unknown.

Implements shaka::media::MediaPlayer.

Definition at line 550 of file av_media_player.mm.

§ GetAvPlayer()

const void * shaka::media::ios::AvMediaPlayer::GetAvPlayer ( )

Definition at line 412 of file av_media_player.mm.

§ GetBuffered()

std::vector< BufferedRange > shaka::media::ios::AvMediaPlayer::GetBuffered ( ) const
overridevirtual

Gets the ranges of buffered content in the media. For MSE playback, this should use the ElementaryStream objects passed to this object; for src= playback, this type will internally handle buffering.

Implements shaka::media::MediaPlayer.

Definition at line 442 of file av_media_player.mm.

§ GetIosView()

const void * shaka::media::ios::AvMediaPlayer::GetIosView ( )

Definition at line 409 of file av_media_player.mm.

§ Height()

uint32_t shaka::media::ios::AvMediaPlayer::Height ( ) const
overridevirtual
Returns
The current height of the video frames, in pixels.

Implements shaka::media::MediaPlayer.

Definition at line 500 of file av_media_player.mm.

§ LoadedMetaData()

void shaka::media::ios::AvMediaPlayer::LoadedMetaData ( double  duration)
overridevirtual

For MSE playback, this indicates that the init segments for the input streams have been received and have the given estimated duration. If there is more than one input stream, this is called once they all have been loaded.

Parameters
durationThe estimated duration of the stream based on the init segments; can be infinity if unknown.

Implements shaka::media::MediaPlayer.

Definition at line 583 of file av_media_player.mm.

§ MseEndOfStream()

void shaka::media::ios::AvMediaPlayer::MseEndOfStream ( )
overridevirtual

For MSE playback, this indicates that the last segment has been handled and the current buffered end represents the end of all the content.

Implements shaka::media::MediaPlayer.

Definition at line 584 of file av_media_player.mm.

§ Muted()

bool shaka::media::ios::AvMediaPlayer::Muted ( ) const
overridevirtual
Returns
Whether the audio is muted.

Implements shaka::media::MediaPlayer.

Definition at line 519 of file av_media_player.mm.

§ Pause()

void shaka::media::ios::AvMediaPlayer::Pause ( )
overridevirtual

Pauses playback of the current content. If this is called before AttachSource/AttachMse, this should not start playing when content is given.

Implements shaka::media::MediaPlayer.

Definition at line 535 of file av_media_player.mm.

§ Play()

void shaka::media::ios::AvMediaPlayer::Play ( )
overridevirtual

Starts playback of the current content. If this is called before AttachSource/AttachMse, this should start playing when content is given.

Implements shaka::media::MediaPlayer.

Definition at line 532 of file av_media_player.mm.

§ PlaybackRate()

double shaka::media::ios::AvMediaPlayer::PlaybackRate ( ) const
overridevirtual
Returns
The current playback rate of the video, or 1 if nothing is loaded.

Implements shaka::media::MediaPlayer.

Definition at line 560 of file av_media_player.mm.

§ PlaybackState()

VideoPlaybackState shaka::media::ios::AvMediaPlayer::PlaybackState ( ) const
overridevirtual
Returns
The current VideoPlaybackSate of the media.

Implements shaka::media::MediaPlayer.

Definition at line 460 of file av_media_player.mm.

§ ReadyState()

VideoReadyState shaka::media::ios::AvMediaPlayer::ReadyState ( ) const
overridevirtual
Returns
The current VideoReadyState of the media.

Implements shaka::media::MediaPlayer.

Definition at line 457 of file av_media_player.mm.

§ RemoveClient()

void shaka::media::ios::AvMediaPlayer::RemoveClient ( Client client) const
overridevirtual

Removes a client listener. The given client will no longer be called when events happen.

Implements shaka::media::MediaPlayer.

Definition at line 438 of file av_media_player.mm.

§ SetCurrentTime()

void shaka::media::ios::AvMediaPlayer::SetCurrentTime ( double  time)
overridevirtual

Seeks to a new position in the currently-playing stream. Does nothing if no content is loaded.

Parameters
timeThe presentation time to seek to.

Implements shaka::media::MediaPlayer.

Definition at line 545 of file av_media_player.mm.

§ SetDuration()

void shaka::media::ios::AvMediaPlayer::SetDuration ( double  duration)
overridevirtual

Sets the duration of the media.

Parameters
durationThe duration, in seconds, to set to.

Implements shaka::media::MediaPlayer.

Definition at line 557 of file av_media_player.mm.

§ SetEmeImplementation()

bool shaka::media::ios::AvMediaPlayer::SetEmeImplementation ( const std::string &  key_system,
eme::Implementation implementation 
)
overridevirtual

Sets the EME implementation instance used to decrypt media. This will be set early in playback and won't be changed while playing. This will be called with nullptr to clear the EME implementation.

Parameters
key_systemThe name of the key system this is for.
implementationThe implementation used to decrypt frames.
Returns
True on success, false on error or unsupported.

Implements shaka::media::MediaPlayer.

Definition at line 585 of file av_media_player.mm.

§ SetMuted()

void shaka::media::ios::AvMediaPlayer::SetMuted ( bool  muted)
overridevirtual

Sets whether the audio is muted.

Implements shaka::media::MediaPlayer.

Definition at line 526 of file av_media_player.mm.

§ SetPlaybackRate()

void shaka::media::ios::AvMediaPlayer::SetPlaybackRate ( double  rate)
overridevirtual

Sets the playback rate of the video. Does nothing if no content is loaded.

Parameters
rateThe new playback rate.

Implements shaka::media::MediaPlayer.

Definition at line 567 of file av_media_player.mm.

§ SetVideoFillMode()

bool shaka::media::ios::AvMediaPlayer::SetVideoFillMode ( VideoFillMode  mode)
overridevirtual

Sets how to resize video frames within the drawing region.

Parameters
modeThe new method to resize the video frames.
Returns
True on success, false on error or if the mode isn't supported.

Implements shaka::media::MediaPlayer.

Definition at line 490 of file av_media_player.mm.

§ SetVolume()

void shaka::media::ios::AvMediaPlayer::SetVolume ( double  volume)
overridevirtual

Sets the volume [0, 1] to render audio at.

Implements shaka::media::MediaPlayer.

Definition at line 514 of file av_media_player.mm.

§ TextTracks() [1/2]

std::vector< std::shared_ptr< TextTrack > > shaka::media::ios::AvMediaPlayer::TextTracks ( )
overridevirtual
Returns
The current text tracks in the media.

Implements shaka::media::MediaPlayer.

Definition at line 477 of file av_media_player.mm.

§ TextTracks() [2/2]

std::vector< std::shared_ptr< const TextTrack > > shaka::media::ios::AvMediaPlayer::TextTracks ( ) const
overridevirtual
Returns
The current text tracks in the media.

Implements shaka::media::MediaPlayer.

Definition at line 480 of file av_media_player.mm.

§ VideoPlaybackQuality()

VideoPlaybackQuality shaka::media::ios::AvMediaPlayer::VideoPlaybackQuality ( ) const
overridevirtual
Returns
The current video playback statistics.

Implements shaka::media::MediaPlayer.

Definition at line 432 of file av_media_player.mm.

§ VideoTracks() [1/2]

std::vector< std::shared_ptr< MediaTrack > > shaka::media::ios::AvMediaPlayer::VideoTracks ( )
overridevirtual
Returns
The current video tracks in the media.

Implements shaka::media::MediaPlayer.

Definition at line 470 of file av_media_player.mm.

§ VideoTracks() [2/2]

std::vector< std::shared_ptr< const MediaTrack > > shaka::media::ios::AvMediaPlayer::VideoTracks ( ) const
overridevirtual
Returns
The current video tracks in the media.

Implements shaka::media::MediaPlayer.

Definition at line 473 of file av_media_player.mm.

§ Volume()

double shaka::media::ios::AvMediaPlayer::Volume ( ) const
overridevirtual
Returns
The current volume [0, 1].

Implements shaka::media::MediaPlayer.

Definition at line 507 of file av_media_player.mm.

§ Width()

uint32_t shaka::media::ios::AvMediaPlayer::Width ( ) const
overridevirtual
Returns
The current width of the video frames, in pixels.

Implements shaka::media::MediaPlayer.

Definition at line 493 of file av_media_player.mm.


The documentation for this class was generated from the following files: