Native Player  1.0
EsDashPlayerController Class Reference

This class controls NaCl Player in the elementary stream playback scenario with DASH support. More...

#include <es_dash_player_controller.h>

Inheritance diagram for EsDashPlayerController:
PlayerController

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
}
 

Detailed Description

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.

See also
class ElementaryStreamPacket
class PlayerController
class Samsung::NaClPlayer::ElementaryStream
class Samsung::NaClPlayer::ESDataSource
class Samsung::NaClPlayer::MediaPlayer

Definition at line 83 of file es_dash_player_controller.h.

Constructor & Destructor Documentation

EsDashPlayerController::EsDashPlayerController ( const pp::InstanceHandle &  instance,
std::shared_ptr< Communication::MessageSender message_sender 
)
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.

Parameters
[in]instanceAn InstanceHandle identifying Native Player object.
[in]message_senderA MessageSender object pointer which will be used to send messages through the communication channel.
See also
EsDashPlayerController::InitPlayer()

Definition at line 99 of file es_dash_player_controller.h.

EsDashPlayerController::~EsDashPlayerController ( )
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.

Member Function Documentation

void EsDashPlayerController::ChangeRepresentation ( StreamType  stream_type,
int32_t  id 
)
overridevirtual

Orders the player to change a stream representation to a defined one.

Parameters
[in]stream_typeA definition which stream representation should be changed.
[in]idAn id of the new stream representation which should be used.

Implements PlayerController.

void EsDashPlayerController::ChangeSubtitles ( int32_t  id)
overridevirtual

Orders the player to change a subtitles set from current to the specified one.

Parameters
[in]idAn id of a subtitles set which should be used.

Implements PlayerController.

void EsDashPlayerController::ChangeSubtitleVisibility ( )
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.

PlayerState EsDashPlayerController::GetState ( )
overridevirtual

Provides information about PlayerController state.

Returns
A current state of the player.

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.

Parameters
[in]mpd_file_pathA 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().

Parameters
[in]subtitleA URL of the subtitles files.
[in]encodingAn 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.

Parameters
[in]urlAn address of a DASH manifest file to be prepared for a playback in NaCl Player.
[in]subtitleA 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]encodingEncoding of the subtitles file pointed by the subtitle parameter. UTF-8 encoding will be uesd as a default if an empty string is given.
See also
EsDashPlayerController::EsDashPlayerController()
MessageSender::ShowSubtitles()
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).

Parameters
[in]typeIndicates a stream type for which configuration has been completed.
void EsDashPlayerController::Pause ( )
overridevirtual

Orders the player to pause playback of the content.

Implements PlayerController.

void EsDashPlayerController::Play ( )
overridevirtual

Orders the player to start/resume playback of the loaded content.

Implements PlayerController.

void EsDashPlayerController::PostTextTrackInfo ( )
overridevirtual

Orders the player to send a message about all available subtitles text track's information.

Implements PlayerController.

void EsDashPlayerController::Seek ( Samsung::NaClPlayer::TimeTicks  to_time)
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.

void EsDashPlayerController::SetViewRect ( const Samsung::NaClPlayer::Rect &  view_rect)
overridevirtual

Sets a player display area.

Parameters
[in]view_rectA 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.

Parameters
[in]resultA PPAPI error code, required in PP_MessageLoop tasks. PP_OK is an expected value .
See also
StreamManager::UpdateBuffer()

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