Shaka Player Embedded
Classes | Public Member Functions | List of all members
shaka::media::MseMediaPlayer Class Referencefinal

#include <mse_media_player.h>

Inheritance diagram for shaka::media::MseMediaPlayer:
shaka::media::MediaPlayer shaka::media::DecoderThread::Client

Public Member Functions

 MseMediaPlayer (ClientList *clients, VideoRenderer *video_renderer, AudioRenderer *audio_renderer)
 
 ~MseMediaPlayer () override
 
void SetDecoders (Decoder *video_decoder, Decoder *audio_decoder)
 
MediaCapabilitiesInfo DecodingInfo (const MediaDecodingConfiguration &config) const override
 
struct VideoPlaybackQuality VideoPlaybackQuality () const override
 
void AddClient (MediaPlayer::Client *client) const override
 
void RemoveClient (MediaPlayer::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 Height () const override
 
uint32_t Width () 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

Defines the default MediaSource-based MediaPlayer. This can only handle MSE playback and uses custom playback tracking.

Definition at line 38 of file mse_media_player.h.

Constructor & Destructor Documentation

§ MseMediaPlayer()

shaka::media::MseMediaPlayer::MseMediaPlayer ( ClientList clients,
VideoRenderer video_renderer,
AudioRenderer audio_renderer 
)

Definition at line 29 of file mse_media_player.cc.

§ ~MseMediaPlayer()

shaka::media::MseMediaPlayer::~MseMediaPlayer ( )
override

Definition at line 86 of file mse_media_player.cc.

Member Function Documentation

§ AddClient()

void shaka::media::MseMediaPlayer::AddClient ( MediaPlayer::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 135 of file mse_media_player.cc.

§ AddMseBuffer()

bool shaka::media::MseMediaPlayer::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 290 of file mse_media_player.cc.

§ AddTextTrack()

std::shared_ptr< TextTrack > shaka::media::MseMediaPlayer::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 195 of file mse_media_player.cc.

§ AttachMse()

bool shaka::media::MseMediaPlayer::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 277 of file mse_media_player.cc.

§ AttachSource()

bool shaka::media::MseMediaPlayer::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 273 of file mse_media_player.cc.

§ AudioTracks() [1/2]

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

Implements shaka::media::MediaPlayer.

Definition at line 162 of file mse_media_player.cc.

§ AudioTracks() [2/2]

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

Implements shaka::media::MediaPlayer.

Definition at line 167 of file mse_media_player.cc.

§ CurrentTime()

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

Implements shaka::media::MediaPlayer.

Definition at line 246 of file mse_media_player.cc.

§ DecodingInfo()

MediaCapabilitiesInfo shaka::media::MseMediaPlayer::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 98 of file mse_media_player.cc.

§ Detach()

void shaka::media::MseMediaPlayer::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 339 of file mse_media_player.cc.

§ Duration()

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

Implements shaka::media::MediaPlayer.

Definition at line 254 of file mse_media_player.cc.

§ GetBuffered()

std::vector< BufferedRange > shaka::media::MseMediaPlayer::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 143 of file mse_media_player.cc.

§ Height()

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

Implements shaka::media::MediaPlayer.

Definition at line 206 of file mse_media_player.cc.

§ LoadedMetaData()

void shaka::media::MseMediaPlayer::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 308 of file mse_media_player.cc.

§ MseEndOfStream()

void shaka::media::MseMediaPlayer::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 314 of file mse_media_player.cc.

§ Muted()

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

Implements shaka::media::MediaPlayer.

Definition at line 230 of file mse_media_player.cc.

§ Pause()

void shaka::media::MseMediaPlayer::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 242 of file mse_media_player.cc.

§ Play()

void shaka::media::MseMediaPlayer::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 238 of file mse_media_player.cc.

§ PlaybackRate()

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

Implements shaka::media::MediaPlayer.

Definition at line 262 of file mse_media_player.cc.

§ PlaybackState()

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

Implements shaka::media::MediaPlayer.

Definition at line 158 of file mse_media_player.cc.

§ ReadyState()

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

Implements shaka::media::MediaPlayer.

Definition at line 153 of file mse_media_player.cc.

§ RemoveClient()

void shaka::media::MseMediaPlayer::RemoveClient ( MediaPlayer::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 139 of file mse_media_player.cc.

§ SetCurrentTime()

void shaka::media::MseMediaPlayer::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 250 of file mse_media_player.cc.

§ SetDecoders()

void shaka::media::MseMediaPlayer::SetDecoders ( Decoder video_decoder,
Decoder audio_decoder 
)

Definition at line 91 of file mse_media_player.cc.

§ SetDuration()

void shaka::media::MseMediaPlayer::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 258 of file mse_media_player.cc.

§ SetEmeImplementation()

bool shaka::media::MseMediaPlayer::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 331 of file mse_media_player.cc.

§ SetMuted()

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

Sets whether the audio is muted.

Implements shaka::media::MediaPlayer.

Definition at line 234 of file mse_media_player.cc.

§ SetPlaybackRate()

void shaka::media::MseMediaPlayer::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 266 of file mse_media_player.cc.

§ SetVideoFillMode()

bool shaka::media::MseMediaPlayer::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 202 of file mse_media_player.cc.

§ SetVolume()

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

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

Implements shaka::media::MediaPlayer.

Definition at line 226 of file mse_media_player.cc.

§ TextTracks() [1/2]

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

Implements shaka::media::MediaPlayer.

Definition at line 184 of file mse_media_player.cc.

§ TextTracks() [2/2]

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

Implements shaka::media::MediaPlayer.

Definition at line 189 of file mse_media_player.cc.

§ VideoPlaybackQuality()

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

Implements shaka::media::MediaPlayer.

Definition at line 131 of file mse_media_player.cc.

§ VideoTracks() [1/2]

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

Implements shaka::media::MediaPlayer.

Definition at line 173 of file mse_media_player.cc.

§ VideoTracks() [2/2]

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

Implements shaka::media::MediaPlayer.

Definition at line 178 of file mse_media_player.cc.

§ Volume()

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

Implements shaka::media::MediaPlayer.

Definition at line 222 of file mse_media_player.cc.

§ Width()

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

Implements shaka::media::MediaPlayer.

Definition at line 214 of file mse_media_player.cc.


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