Shaka Player Embedded
Classes | Public Member Functions | Protected Member Functions | List of all members
shaka::media::ProxyMediaPlayer Class Referenceabstract

#include <proxy_media_player.h>

Inheritance diagram for shaka::media::ProxyMediaPlayer:
shaka::media::MediaPlayer shaka::media::DefaultMediaPlayer

Classes

class  Impl
 

Public Member Functions

 ProxyMediaPlayer ()
 
 ~ProxyMediaPlayer () 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
 
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
 
virtual MediaCapabilitiesInfo DecodingInfo (const MediaDecodingConfiguration &config) const =0
 
virtual std::vector< std::shared_ptr< MediaTrack > > AudioTracks ()=0
 
virtual std::vector< std::shared_ptr< const MediaTrack > > AudioTracks () const =0
 
virtual std::vector< std::shared_ptr< MediaTrack > > VideoTracks ()=0
 
virtual std::vector< std::shared_ptr< const MediaTrack > > VideoTracks () const =0
 
virtual std::vector< std::shared_ptr< TextTrack > > TextTracks ()=0
 
virtual std::vector< std::shared_ptr< const TextTrack > > TextTracks () const =0
 
virtual std::shared_ptr< TextTrackAddTextTrack (TextTrackKind kind, const std::string &label, const std::string &language)=0
 

Protected Member Functions

ClientListGetClientList () const
 

Additional Inherited Members

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

Detailed Description

Defines a MediaPlayer instance that proxies to one or more MediaPlayer instances based on what content is being loaded. This will store the defaults for the Set* methods and pass them to the chosen MediaPlayer once content is loaded.

Note this does not forward AddClient/RemoveClient calls to the MediaPlayer. Instead, subclasses should use the GetClientList method and call methods on that.

Definition at line 39 of file proxy_media_player.h.

Constructor & Destructor Documentation

§ ProxyMediaPlayer()

shaka::media::ProxyMediaPlayer::ProxyMediaPlayer ( )

Definition at line 59 of file proxy_media_player.cc.

§ ~ProxyMediaPlayer()

shaka::media::ProxyMediaPlayer::~ProxyMediaPlayer ( )
override

Definition at line 60 of file proxy_media_player.cc.

Member Function Documentation

§ AddClient()

void shaka::media::ProxyMediaPlayer::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 70 of file proxy_media_player.cc.

§ AddMseBuffer()

bool shaka::media::ProxyMediaPlayer::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 241 of file proxy_media_player.cc.

§ AttachMse()

bool shaka::media::ProxyMediaPlayer::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 231 of file proxy_media_player.cc.

§ AttachSource()

bool shaka::media::ProxyMediaPlayer::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 221 of file proxy_media_player.cc.

§ CurrentTime()

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

Implements shaka::media::MediaPlayer.

Definition at line 172 of file proxy_media_player.cc.

§ Detach()

void shaka::media::ProxyMediaPlayer::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 274 of file proxy_media_player.cc.

§ Duration()

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

Implements shaka::media::MediaPlayer.

Definition at line 188 of file proxy_media_player.cc.

§ GetBuffered()

std::vector< BufferedRange > shaka::media::ProxyMediaPlayer::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 78 of file proxy_media_player.cc.

§ GetClientList()

MediaPlayer::ClientList * shaka::media::ProxyMediaPlayer::GetClientList ( ) const
protected
Returns
The current ClientList used to fire events.

Definition at line 281 of file proxy_media_player.cc.

§ Height()

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

Implements shaka::media::MediaPlayer.

Definition at line 118 of file proxy_media_player.cc.

§ LoadedMetaData()

void shaka::media::ProxyMediaPlayer::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 255 of file proxy_media_player.cc.

§ MseEndOfStream()

void shaka::media::ProxyMediaPlayer::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 249 of file proxy_media_player.cc.

§ Muted()

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

Implements shaka::media::MediaPlayer.

Definition at line 139 of file proxy_media_player.cc.

§ Pause()

void shaka::media::ProxyMediaPlayer::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 164 of file proxy_media_player.cc.

§ Play()

void shaka::media::ProxyMediaPlayer::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 156 of file proxy_media_player.cc.

§ PlaybackRate()

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

Implements shaka::media::MediaPlayer.

Definition at line 204 of file proxy_media_player.cc.

§ PlaybackState()

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

Implements shaka::media::MediaPlayer.

Definition at line 94 of file proxy_media_player.cc.

§ ReadyState()

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

Implements shaka::media::MediaPlayer.

Definition at line 86 of file proxy_media_player.cc.

§ RemoveClient()

void shaka::media::ProxyMediaPlayer::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 74 of file proxy_media_player.cc.

§ SetCurrentTime()

void shaka::media::ProxyMediaPlayer::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 180 of file proxy_media_player.cc.

§ SetDuration()

void shaka::media::ProxyMediaPlayer::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 196 of file proxy_media_player.cc.

§ SetEmeImplementation()

bool shaka::media::ProxyMediaPlayer::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 262 of file proxy_media_player.cc.

§ SetMuted()

void shaka::media::ProxyMediaPlayer::SetMuted ( bool  muted)
overridevirtual

Sets whether the audio is muted.

Implements shaka::media::MediaPlayer.

Definition at line 147 of file proxy_media_player.cc.

§ SetPlaybackRate()

void shaka::media::ProxyMediaPlayer::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 212 of file proxy_media_player.cc.

§ SetVideoFillMode()

bool shaka::media::ProxyMediaPlayer::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 103 of file proxy_media_player.cc.

§ SetVolume()

void shaka::media::ProxyMediaPlayer::SetVolume ( double  volume)
overridevirtual

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

Implements shaka::media::MediaPlayer.

Definition at line 131 of file proxy_media_player.cc.

§ VideoPlaybackQuality()

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

Implements shaka::media::MediaPlayer.

Definition at line 62 of file proxy_media_player.cc.

§ Volume()

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

Implements shaka::media::MediaPlayer.

Definition at line 123 of file proxy_media_player.cc.

§ Width()

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

Implements shaka::media::MediaPlayer.

Definition at line 113 of file proxy_media_player.cc.


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