Shaka Player Embedded
|
#include <media_player.h>
Classes | |
class | Client |
class | ClientList |
Public Member Functions | |
MediaPlayer () | |
virtual | ~ MediaPlayer () |
MediaPlayer (const MediaPlayer &)=delete | |
MediaPlayer & | operator= (const MediaPlayer &)=delete |
MediaPlayer (MediaPlayer &&)=delete | |
MediaPlayer & | operator= (MediaPlayer &&)=delete |
virtual MediaCapabilitiesInfo | DecodingInfo (const MediaDecodingConfiguration &config) const =0 |
virtual VideoPlaybackQuality | VideoPlaybackQuality () const =0 |
virtual void | AddClient (Client *client) const =0 |
virtual void | RemoveClient (Client *client) const =0 |
virtual std::vector< BufferedRange > | GetBuffered () const =0 |
virtual VideoReadyState | ReadyState () const =0 |
virtual VideoPlaybackState | PlaybackState () 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< TextTrack > | AddTextTrack (TextTrackKind kind, const std::string &label, const std::string &language)=0 |
Rendering | |
virtual bool | SetVideoFillMode (VideoFillMode mode)=0 |
virtual uint32_t | Width () const =0 |
virtual uint32_t | Height () const =0 |
virtual double | Volume () const =0 |
virtual void | SetVolume (double volume)=0 |
virtual bool | Muted () const =0 |
virtual void | SetMuted (bool muted)=0 |
Playback | |
virtual void | Play ()=0 |
virtual void | Pause ()=0 |
virtual double | CurrentTime () const =0 |
virtual void | SetCurrentTime (double time)=0 |
virtual double | Duration () const =0 |
virtual void | SetDuration (double duration)=0 |
virtual double | PlaybackRate () const =0 |
virtual void | SetPlaybackRate (double rate)=0 |
Internal methods | |
These are called by Shaka Player Embedded to setup state. | |
virtual bool | AttachSource (const std::string &src)=0 |
virtual bool | AttachMse ()=0 |
virtual bool | AddMseBuffer (const std::string &mime, bool is_video, const ElementaryStream *stream)=0 |
virtual void | LoadedMetaData (double duration)=0 |
virtual void | MseEndOfStream ()=0 |
virtual bool | SetEmeImplementation (const std::string &key_system, eme::Implementation *implementation)=0 |
virtual void | Detach ()=0 |
Static Public Member Functions | |
static void | SetMediaPlayerForSupportChecks (const MediaPlayer *player) |
static const MediaPlayer * | GetMediaPlayerForSupportChecks () |
Defines the base class for media handling. This handles decryption, decoding, playback, and rendering of media content. This can handle both MSE-based playback and raw src= playback; it is not required to support both, returning false
from the respective methods will stop playback. For MSE-based playback, this is given the encoded frames after they have been demuxed by the Demuxer. This is expected to pull those frames when needed.
This acts both as the <video>
element to JavaScript and as the app's API to interact with playback. It is expected that this type is internally thread-safe and can be called from multiple threads.
An object of a derived class is created by the app during startup and is given to the Player. The Client is created by Shaka Player Embedded and is given to this object. Once the manifest is loaded, playback is started by calling either AttachMse or AttachSource. Once playback is done, Detach is called.
If another manifest is loaded, we will start again for a new stream. Implementers are not required to support multiple playback sessions, but they'll need to avoid calling Player::Load a second time with the same MediaPlayer instance.
Definition at line 184 of file media_player.h.
shaka::media::MediaPlayer::MediaPlayer | ( | ) |
|
virtual |
|
delete |
|
delete |
|
pure virtual |
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.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ProxyMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
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.
mime | The full MIME type given from JavaScript. |
is_video | True if this is for a video stream, false for audio. |
stream | The stream containing the encoded frames. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Adds a new text track to the player. This can return nullptr if this isn't supported.
kind | The kind of the new track. |
label | A string label for the track. |
language | The language of the new track. |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Starts MSE-based playback. At a later time, AddMseBuffer will be called to give streams to pull from.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Starts playback using the given src= URL. The player should read data from the given URL and play its content.
src | The URL to read from. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
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.
config | The configuration to check support for. |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Stops playback from the current media. This should stop using the current ElementaryStream objects and halt playback.
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
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.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ProxyMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
static |
Definition at line 234 of file media_player.cc.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
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.
duration | The estimated duration of the stream based on the init segments; can be infinity if unknown. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
For MSE playback, this indicates that the last segment has been handled and the current buffered end represents the end of all the content.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
delete |
|
delete |
|
pure virtual |
Pauses playback of the current content. If this is called before AttachSource/AttachMse, this should not start playing when content is given.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Starts playback of the current content. If this is called before AttachSource/AttachMse, this should start playing when content is given.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ProxyMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ProxyMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Removes a client listener. The given client will no longer be called when events happen.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ProxyMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Seeks to a new position in the currently-playing stream. Does nothing if no content is loaded.
time | The presentation time to seek to. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Sets the duration of the media.
duration | The duration, in seconds, to set to. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
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.
key_system | The name of the key system this is for. |
implementation | The implementation used to decrypt frames. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
static |
Sets the global MediaPlayer instance that is used to determine if content can be played. This is used by MediaSource.isTypeSupported to determine if content can be played.
This allows setting a special instance for these static support checks for when a "current" MediaPlayer cannot be determined. This can be set to nullptr to not use it anymore.
If a value isn't given here, we'll use an arbitrary MediaPlayer instance that was given to some Player instance. We'll only use alive instances, but we may use a different one than what will ultimately play the content.
player | The MediaPlayer instance to use; only the DecodingInfo method will be called. |
Definition at line 230 of file media_player.cc.
|
pure virtual |
Sets whether the audio is muted.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Sets the playback rate of the video. Does nothing if no content is loaded.
rate | The new playback rate. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Sets how to resize video frames within the drawing region.
mode | The new method to resize the video frames. |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Sets the volume [0, 1] to render audio at.
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ProxyMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::DefaultMediaPlayer, shaka::media::MseMediaPlayer, and shaka::media::ios::AvMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.
|
pure virtual |
Implemented in shaka::media::MseMediaPlayer, shaka::media::ios::AvMediaPlayer, and shaka::media::ProxyMediaPlayer.