Native Player
1.0
|
This class controls NaCl Player in the elementary stream playback scenario with DASH support. More...
#include <es_dash_player_controller.h>
Public Member Functions | |
EsDashPlayerController (const pp::InstanceHandle &instance, std::shared_ptr< Communication::MessageSender > message_sender) | |
~EsDashPlayerController () override | |
void | InitPlayer (const std::string &url, const std::string &subtitle={}, const std::string &encoding={}) |
void | Play () override |
Orders the player to start/resume playback of the loaded content. More... | |
void | Pause () override |
Orders the player to pause playback of the content. More... | |
void | Seek (Samsung::NaClPlayer::TimeTicks to_time) override |
void | ChangeRepresentation (StreamType stream_type, int32_t id) override |
void | SetViewRect (const Samsung::NaClPlayer::Rect &view_rect) override |
void | PostTextTrackInfo () override |
void | ChangeSubtitles (int32_t id) override |
void | ChangeSubtitleVisibility () override |
Orders the player to start or stop generating events related to subtitles. More... | |
PlayerState | GetState () override |
void | UpdateStreamsBuffer (int32_t) |
void | OnStreamConfigured (StreamType type) |
void | FinishStreamConfiguration () |
void | InitializeSubtitles (const std::string &subtitle, const std::string &encoding) |
void | InitializeDash (const std::string &mpd_file_path) |
void | InitializeStreams (int32_t) |
Public Member Functions inherited from PlayerController | |
PlayerController () | |
Creates a PlayerController object. More... | |
virtual | ~PlayerController () |
Destroys the PlayerController object. More... | |
Additional Inherited Members | |
Public Types inherited from PlayerController | |
enum | PlayerState { PlayerState::kUnitialized, PlayerState::kReady, PlayerState::kPaused, PlayerState::kPlaying, PlayerState::kError } |
This class controls NaCl Player in the elementary stream playback scenario with DASH support.
This class provides an implementation of the PlayerController
interface. It controls a life cycle and manages a MediaPlayer
object. MediaPlayer
is the main class of NaCl Player. EsDashPlayerController
allows a playback of a DASH content using elementary streams.
EsDashPlayerController
uses NaCl Player in an elementary stream playback mode, which relies on the ESDataSource
class. In this scenario it is an application responsibility to deliver elementary stream packets to NaCl Player. For a DASH content, application is also responsible for parsing a DASH manifest file, as well as managing and demuxing media streams into a series of ElementaryStreamPacket
objects, which are delivered to NaCl Player for a playback.
The application needs to implement a basic player control operations, elementary stream packets provision to NaCl Player and DASH handling.
EsDashPlayerController
supports playback from a DASH manifest file.
ElementaryStreamPacket
PlayerController
Samsung::NaClPlayer::ElementaryStream
Samsung::NaClPlayer::ESDataSource
Samsung::NaClPlayer::MediaPlayer
Definition at line 83 of file es_dash_player_controller.h.
|
inline |
Creates an EsDashPlayerController
object. NaCl Player must be initialized using the InitPlayer()
method before a playback can be started.
EsDashPlayerController
is created by a PlayerProvider
factory.
[in] | instance | An InstanceHandle identifying Native Player object. |
[in] | message_sender | A MessageSender object pointer which will be used to send messages through the communication channel. |
Definition at line 99 of file es_dash_player_controller.h.
|
inlineoverride |
Destroys an EsDashPlayerController
object. This also destroys a MediaPlayer
object and thus a player pipeline.
Definition at line 110 of file es_dash_player_controller.h.
|
overridevirtual |
Orders the player to change a stream representation to a defined one.
[in] | stream_type | A definition which stream representation should be changed. |
[in] | id | An id of the new stream representation which should be used. |
Implements PlayerController.
|
overridevirtual |
Orders the player to change a subtitles set from current to the specified one.
[in] | id | An id of a subtitles set which should be used. |
Implements PlayerController.
|
overridevirtual |
Orders the player to start or stop generating events related to subtitles.
Implements PlayerController.
void EsDashPlayerController::FinishStreamConfiguration | ( | ) |
Marks end of configuration of all media streams.
|
overridevirtual |
Provides information about PlayerController
state.
Implements PlayerController.
void EsDashPlayerController::InitializeDash | ( | const std::string & | mpd_file_path | ) |
Loads and parses a DASH manifest file. This method loads available stream representations, begins stream configuration procedure and starts a side worker thread.
[in] | mpd_file_path | A URL of the DASH manifest file. |
void EsDashPlayerController::InitializeStreams | ( | int32_t | ) |
Initializes audio and video streams. This method choses initial representations for each available stream and initializes DRM if it is present.
void EsDashPlayerController::InitializeSubtitles | ( | const std::string & | subtitle, |
const std::string & | encoding | ||
) |
Loads a subtitles file. This will enable subtitle text updates to be sent to the UI module using the MessageSender
class during playback. This method must be called before the FinishStreamConfiguration()
.
[in] | subtitle | A URL of the subtitles files. |
[in] | encoding | An encoding of the subtitles file. |
void EsDashPlayerController::InitPlayer | ( | const std::string & | url, |
const std::string & | subtitle = {} , |
||
const std::string & | encoding = {} |
||
) |
Initializes NaCl Player and prepares it to play a given content. Subtitles information may also be passed to this function to get ready for a playback with the subtitles.
This method can be called several times to change a multimedia content that should be played with NaCl Player.
[in] | url | An address of a DASH manifest file to be prepared for a playback in NaCl Player. |
[in] | subtitle | A URL of the subtitles file to be loaded along the multimedia DASH clip pointed by the url parameter. Subtitle text updates will be sent to the UI module using MessageSender given during construction of this object. May be an empty string if there are no external subtitles to be loaded. |
[in] | encoding | Encoding of the subtitles file pointed by the subtitle parameter. UTF-8 encoding will be uesd as a default if an empty string is given. |
void EsDashPlayerController::OnStreamConfigured | ( | StreamType | type | ) |
An event handler method that should be called both when configuration for the stream is set for the first time and when configuration is changed during playback (e.g. a representation is changed).
[in] | type | Indicates a stream type for which configuration has been completed. |
|
overridevirtual |
Orders the player to pause playback of the content.
Implements PlayerController.
|
overridevirtual |
Orders the player to start/resume playback of the loaded content.
Implements PlayerController.
|
overridevirtual |
Orders the player to send a message about all available subtitles text track's information.
Implements PlayerController.
|
overridevirtual |
Orders the player to change the current playback time to the defined one.
param[in] to_time Time from which playback should continue when seek operation completes.
Implements PlayerController.
|
overridevirtual |
Sets a player display area.
[in] | view_rect | A size and position of a player display area. |
Implements PlayerController.
void EsDashPlayerController::UpdateStreamsBuffer | ( | int32_t | ) |
Checks every stream if there is enough data buffered. If not, initiates data download. This method reschedules a call to itself on the side player thread.
[in] | result | A PPAPI error code, required in PP_MessageLoop tasks. PP_OK is an expected value . |