NaCl Player API
NaCl Player API Documentation
Samsung::NaClPlayer::MediaPlayer Class Reference

#include <media_player.h>

Public Types

enum  BindToDisplayMode { BindPlayerToDisplay, DoNotBindPlayerToDisplay }
 
enum  MediaPlayerMode { MediaPlayerModeDefault, MediaPlayerModeD2TV }
 
enum  MediaPlayerDisplayMode { MediaPlayerDisplayModeStretch = 0, MediaPlayerDisplayModeLetterbox = 1 }
 
enum  MediaPlayerVr360Mode { MediaPlayerVr360ModeOff = 0, MediaPlayerVr360ModeOn = 1 }
 
typedef std::vector< VideoTrackInfoVideoTracksList
 
typedef std::vector< AudioTrackInfoAudioTracksList
 
typedef std::vector< TextTrackInfoTextTracksList
 

Public Member Functions

 MediaPlayer (BindToDisplayMode=BindPlayerToDisplay, MediaPlayerMode=MediaPlayerModeDefault)
 
 MediaPlayer (const MediaPlayer &other)
 
MediaPlayeroperator= (const MediaPlayer &other)
 
void SetMediaEventsListener (MediaEventsListener *listener)
 
void SetMediaEventsListener (std::shared_ptr< MediaEventsListener > listener)
 
void SetSubtitleListener (SubtitleListener *listener)
 
void SetSubtitleListener (std::shared_ptr< SubtitleListener > listener)
 
void SetBufferingListener (BufferingListener *listener)
 
void SetBufferingListener (std::shared_ptr< BufferingListener > listner)
 
void SetDRMListener (DRMListener *listener)
 
void SetDRMListener (std::shared_ptr< DRMListener > listener)
 
bool BindToDisplay ()
 
int32_t AttachDataSource (const MediaDataSource &data_source, const std::function< void(int32_t)> &callback)
 
int32_t AttachDataSource (const MediaDataSource &data_source)
 
int32_t Play (const std::function< void(int32_t)> &callback)
 
int32_t Play ()
 
int32_t Pause (const std::function< void(int32_t)> &callback)
 
int32_t Pause ()
 
int32_t Stop (const std::function< void(int32_t)> &callback)
 
int32_t Stop ()
 
int32_t Seek (TimeTicks time, const std::function< void(int32_t)> &callback)
 
int32_t Seek (TimeTicks time)
 
int32_t SetPlaybackRate (double rate, const std::function< void(int32_t)> &callback)
 
int32_t SetPlaybackRate (double rate)
 
int32_t GetDuration (const std::function< void(int32_t, TimeDelta)> &callback)
 
int32_t GetDuration (TimeDelta &duration)
 
int32_t GetCurrentTime (const std::function< void(int32_t, TimeTicks)> &callback)
 
int32_t GetCurrentTime (TimeTicks &current_time)
 
int32_t GetPlayerState (const std::function< void(int32_t, MediaPlayerState)> &callback)
 
int32_t GetPlayerState (MediaPlayerState &)
 
int32_t GetCurrentVideoTrackInfo (const std::function< void(int32_t, const VideoTrackInfo &)> &callback)
 
int32_t GetCurrentVideoTrackInfo (VideoTrackInfo &)
 
int32_t GetVideoTracksList (const std::function< void(int32_t, const VideoTracksList &)> &callback)
 
int32_t GetVideoTracksList (VideoTracksList &)
 
int32_t GetCurrentAudioTrackInfo (const std::function< void(int32_t, const AudioTrackInfo &)> &callback)
 
int32_t GetCurrentAudioTrackInfo (AudioTrackInfo &)
 
int32_t GetAudioTracksList (const std::function< void(int32_t, const AudioTracksList &)> &callback)
 
int32_t GetAudioTracksList (AudioTracksList &)
 
int32_t GetCurrentTextTrackInfo (const std::function< void(int32_t, const TextTrackInfo &)> &callback)
 
int32_t GetCurrentTextTrackInfo (TextTrackInfo &)
 
int32_t GetTextTracksList (const std::function< void(int32_t, const TextTracksList &)> &callback)
 
int32_t GetTextTracksList (TextTracksList &)
 
int32_t SelectTrack (ElementaryStreamType track_type, uint32_t track_index, const std::function< void(int32_t)> &callback)
 
int32_t SelectTrack (ElementaryStreamType track_type, uint32_t track_index)
 
int32_t AddExternalSubtitles (const std::string &file_path, const std::string &encoding, const std::function< void(int32_t, const TextTrackInfo &)> &callback)
 
int32_t AddExternalSubtitles (const std::string &file_path, const std::string &encoding, TextTrackInfo &)
 
int32_t SetSubtitlesDelay (TimeDelta delay, const std::function< void(int32_t)> &callback)
 
int32_t SetSubtitlesDelay (TimeDelta delay)
 
int32_t SetDisplayRect (const Rect &rect, const std::function< void(int32_t)> &callback)
 
int32_t SetDisplayRect (const Rect &rect)
 
int32_t SetDisplayMode (MediaPlayerDisplayMode display_mode, const std::function< void(int32_t)> &callback)
 
int32_t SetVr360Mode (MediaPlayerVr360Mode display_mode, const std::function< void(int32_t)> &callback)
 
int32_t SetVr360Mode (MediaPlayerVr360Mode display_mode)
 
int32_t SetVr360Rotation (float horizontal_angle, float vertical_angle, const std::function< void(int32_t)> &callback)
 
int32_t SetVr360Rotation (float horizontal_angle, float vertical_angle)
 
int32_t SetVr360ZoomLevel (uint32_t zoom_level, const std::function< void(int32_t)> &callback)
 
int32_t SetVr360ZoomLevel (uint32_t zoom_level)
 
int32_t SetDisplayMode (MediaPlayerDisplayMode display_mode)
 
int32_t SetDRMSpecificData (DRMType drm_type, DRMOperation drm_operation, uint32_t drm_data_size, const void *drm_data, const std::function< void(int32_t)> &callback)
 
int32_t SetDRMSpecificData (DRMType drm_type, DRMOperation drm_operation, uint32_t drm_data_size, const void *drm_data)
 

Detailed Description

MediaPlayer is type allowing application to control playback state, inquire about playback state. It's also responsible for assigning data source which will feed player with media data.

Assumptions:

  • Video is displayed in area of embed/object element of HTML page in which plugin is embedded.
  • Video and graphics from module can be displayed simultaneously. (see PPB_Instance.BindGraphics). Application must set proper CSS style for embed element with NaCl application (mostly transparent background).

Some methods in this class are available in synchronous and asynchronous variant. Both versions perform the same action, the only difference is how results of those actions are reported to the caller. Asynchronous method propagates this result by a provided additional parameter callback function.

Common constraints:

  1. Synchronous methods can't be called from the main thread.
  2. Asynchronous methods must be called from a thread with attached MessageLoop, which is required to report a result via provided callback in the same thread as the call itself.

Definition at line 55 of file media_player.h.

Member Enumeration Documentation

◆ BindToDisplayMode

An enum that controls whether the player should be bound to the display at creation. In most cases it should and the default constructor will do that. Only a bound player will display content in the defined area of the screen. However in some use cases (for example when MediaPlayer is used alongside the Pepper Compositor interface) creation of a player without binding it to the display will be needed. Such player can be then bound to the display by the BindToDisplay method.

Definition at line 64 of file media_player.h.

◆ MediaPlayerDisplayMode

An enum that controls Media Player display mode. For details, please see descriptions of particular enum values. A default value is MediaPlayerDisplayModeStretch.

Enumerator
MediaPlayerDisplayModeStretch 

When this mode is set a video will be stretched to match either:

  • entire player area (which takes up entire plugin area by default),
  • or an area explicitly set as display rect with MediaPlayer::SetDisplayRect(...).
MediaPlayerDisplayModeLetterbox 

When this mode is set a video will be scaled to fit a player area but will also maintain it's aspect ratio. If player area aspect ratio doesn't match video's aspect ratio, then resulting video will be letterboxed (or pillarboxed).

Definition at line 82 of file media_player.h.

◆ MediaPlayerMode

An enum that controls Media Player mode. Some non-trivial Media Player functions might be supported only if certain MediaPlayerMode is set.

Enumerator
MediaPlayerModeDefault 

Default Media Player mode that is suitable for the most common playback scenarios. This mode is used in constructor when no mode is explicitly specified.

MediaPlayerModeD2TV 

Media Player mode that is dedicated for a D2TV playback.

Definition at line 69 of file media_player.h.

◆ MediaPlayerVr360Mode

An enum that controls Media Player Vr360 mode. For details, please see descriptions of particular enum values. A default value is PP_MEDIAPLAYERVR360MODE_OFF.

Definition at line 99 of file media_player.h.

Constructor & Destructor Documentation

◆ MediaPlayer()

Samsung::NaClPlayer::MediaPlayer::MediaPlayer ( BindToDisplayMode  = BindPlayerToDisplay,
MediaPlayerMode  = MediaPlayerModeDefault 
)

Creates a player with given modes. Default values create a player that can be used in the most typical scenarios.

Parameters
[in]BindToDisplayModeCreate a player that is either bound to display or not. See BindToDisplayMode enum description for more details.
[in]MediaPlayerModeCreate a player that uses a specified playback mode.

Member Function Documentation

◆ AddExternalSubtitles() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::AddExternalSubtitles ( const std::string &  file_path,
const std::string &  encoding,
const std::function< void(int32_t, const TextTrackInfo &)> &  callback 
)

Adds external subtitles. Returns ErrorCodes::Success in case of success and writes added text track information to |subtitles| param. After that newly added subtitles will be activated and SubtitleListener will be notified about it's texts at the time those texts should be shown.

Please note that player is responsible only for subtitle file parsing. No subtitles are displayed by the player. Application can use SubtitleListener to get subtitle texts at correct playback times and display them manually.

Constraints: Ability to add external subtitles after attaching data source is implementation dependent. If it is impossible to add external subtitles after data source is attached, this method will fail with ErrorCodes::NotSupported error code. Therefore this method is guaranteed to succeed only before data source is attached.

Parameters
[in]file_pathA path of the subtitles.
[in]encodingSubtitle encoding can be selected:
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ AddExternalSubtitles() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::AddExternalSubtitles ( const std::string &  file_path,
const std::string &  encoding,
TextTrackInfo  
)

Synchronously adds external subtitles.

Warning
This method can't be called from the main thread.

For detailed description

See also
AddExternalSubtitles(..., callback).

◆ AttachDataSource() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::AttachDataSource ( const MediaDataSource data_source,
const std::function< void(int32_t)> &  callback 
)

Attaches the given MediaDataSource to the player.

You can pass a NULL object to detach currently attached data source. Reattaching data source will return ErrorCodes::Success and do nothing.

Attached data source must be valid. Otherwise ErrorCodes::BadArgument will be returned.

Attaching data source to the player will cause:

  1. Detaching currently attached data source.
  2. Performing initialization of newly bound data source (this step is specific to data source which is being bound).
Parameters
[in]data_sourceA MediaDataSource identifying data source to be attached to the player.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.

◆ AttachDataSource() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::AttachDataSource ( const MediaDataSource data_source)

Synchronously attaches the given MediaDataSource to the player.

Warning
This method can't be called from the main thread.

For detailed description

See also
AttachDataSource(..., callback).

◆ BindToDisplay()

bool Samsung::NaClPlayer::MediaPlayer::BindToDisplay ( )

Binds an unbound player to the display. For more information see the BindToDisplayMode enum description.

Returns
True on success, false otherwise.

◆ GetAudioTracksList() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetAudioTracksList ( const std::function< void(int32_t, const AudioTracksList &)> &  callback)

Retrieves information of all audio tracks from the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion with the list of audio tracks available in the currently attached data source. The list will be empty if the media played form the attached data source doesn't have any audio tracks.
Returns
If >= 0, the number of tracks is returned, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetAudioTracksList() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetAudioTracksList ( AudioTracksList &  )

Synchronously retrieves information of all audio tracks from the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetAudioTracksList(callback).

◆ GetCurrentAudioTrackInfo() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentAudioTrackInfo ( const std::function< void(int32_t, const AudioTrackInfo &)> &  callback)

Retrieves information of the current audio track from the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetCurrentAudioTrackInfo() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentAudioTrackInfo ( AudioTrackInfo )

Synchronously retrieves information of the current audio track from the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description see description of asynchronous method (one with additional callback argument).

◆ GetCurrentTextTrackInfo() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentTextTrackInfo ( const std::function< void(int32_t, const TextTrackInfo &)> &  callback)

Retrieves information of the current text/subtitles track from the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetCurrentTextTrackInfo() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentTextTrackInfo ( TextTrackInfo )

Synchronously retrieves information of the current text/subtitles track from the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetCurrentTextTrackInfo(callback).

◆ GetCurrentTime() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentTime ( const std::function< void(int32_t, TimeTicks)> &  callback)

Retrieves the current time/position of the media played from the attached data source.

This operation can be performed only if the media player is in MediaPlayerState_Playing or MediaPlayerState_Paused states.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetCurrentTime() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentTime ( TimeTicks current_time)

Synchronously retrieves the current time/position of the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetCurrentTime(callback).

◆ GetCurrentVideoTrackInfo() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentVideoTrackInfo ( const std::function< void(int32_t, const VideoTrackInfo &)> &  callback)

Retrieves information of the current video track from the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetCurrentVideoTrackInfo() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetCurrentVideoTrackInfo ( VideoTrackInfo )

Synchronously retrieves information of the current video track from the media played from the attached data source.

Warning
This method can't be called from the main thread.

◆ GetDuration() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetDuration ( const std::function< void(int32_t, TimeDelta)> &  callback)

Retrieves the duration of the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetDuration() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetDuration ( TimeDelta duration)

Synchronously retrieves the duration of the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetDuration(callback).

◆ GetPlayerState() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetPlayerState ( const std::function< void(int32_t, MediaPlayerState)> &  callback)

Retrieves the current media player state.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.

◆ GetPlayerState() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetPlayerState ( MediaPlayerState )

Synchronously retrieves the current media player state.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetPlayerState(callback).

◆ GetTextTracksList() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetTextTracksList ( const std::function< void(int32_t, const TextTracksList &)> &  callback)

Retrieves information of all text/subtitles tracks from the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion with the list of text/subtitles tracks available in the currently attached data source. The list will be empty if the media played form the attached data source doesn't have any text/subtitles tracks.
Returns
If >= 0, the number of tracks is returned, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetTextTracksList() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetTextTracksList ( TextTracksList &  )

Synchronously retrieves information of all text/subtitles tracks from the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetTextTracksList(callback).

◆ GetVideoTracksList() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetVideoTracksList ( const std::function< void(int32_t, const VideoTracksList &)> &  callback)

Retrieves information of all video tracks from the media played from the attached data source.

Parameters
[in]callbackA callback to be called upon completion with the list of video tracks available in currently attached data source. The list will be empty if the media played form the attached data source doesn't have any video tracks.
Returns
If >= 0, the number of tracks is returned, otherwise an error code from ErrorCodes. Meaning of errors:

◆ GetVideoTracksList() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::GetVideoTracksList ( VideoTracksList &  )

Synchronously retrieves information of all video tracks from the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
GetVideoTracksList(callback).

◆ Pause() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Pause ( const std::function< void(int32_t)> &  callback)

Requests to pause playback of media from the data source attached to the media player.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ Pause() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Pause ( )

Synchronously requests to pause playback of media from the data source attached to the media player.

Warning
This method can't be called from the main thread.

For detailed description

See also
Pause(callback).

◆ Play() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Play ( const std::function< void(int32_t)> &  callback)

Requests to start playback of media from the data source attached to the media player.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ Play() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Play ( )

Synchronously requests to start playback of media from the data source attached to the media player.

Warning
This method can't be called from the main thread.

For detailed description

See also
Play(callback).

◆ Seek() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Seek ( TimeTicks  time,
const std::function< void(int32_t)> &  callback 
)

Requests to seek media from the attached data source to the given time stamp.

Parameters
[in]timeA time stamp from begging of the clip to from which playback should be resumed.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ Seek() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Seek ( TimeTicks  time)

Synchronously requests to seek media from the attached data source to the given time stamp.

Warning
This method can't be called from the main thread.

For detailed description

See also
Seek(..., callback).

◆ SelectTrack() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SelectTrack ( ElementaryStreamType  track_type,
uint32_t  track_index,
const std::function< void(int32_t)> &  callback 
)

Selects a track of the given track_type to be activated for the media played from the attached data source.

Remarks: If activated track is a text track, it will be automatically activated and therefore it's subtitles will be delivered as events to the SubtitleListener.

Parameters
[in]track_typeA type of the stream for which activate track.
[in]track_indexAn index of the track which has to be activated. A valid track index can be obtained from one of the [Audio/Video/Text]TrackInfo structures returned by a corresponding call to Get[Audio/Video/Text]TracksInfo.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:
  • ErrorCodes::BadArgument - if no data source is connected to the media player or passed track_type or track_index are not valid.

◆ SelectTrack() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SelectTrack ( ElementaryStreamType  track_type,
uint32_t  track_index 
)

Synchronously selects a track of the given track_type to be activated for the media played from the attached data source.

Warning
This method can't be called from the main thread.

For detailed description

See also
SelectTrack(..., callback).

◆ SetBufferingListener() [1/2]

void Samsung::NaClPlayer::MediaPlayer::SetBufferingListener ( BufferingListener listener)

Attaches a BufferingListener to the player. After attaching, the plugin will be notified about initial media buffering events.

The listener will be called in the same thread in which this method was called.

Listeners ownership is not taken by NaCl Player and application must control listener's object lifecycle.

Parameters
[in]listenerA BufferingListener implementation whose methods will be notified about subscribed events.

◆ SetBufferingListener() [2/2]

void Samsung::NaClPlayer::MediaPlayer::SetBufferingListener ( std::shared_ptr< BufferingListener listner)

Deprecated method for backwards compatibility

Deprecated:
In new code, raw pointers should be passed so as to not risk cyclic dependencies in client code.

For detailed description

See also
void SetBufferingListener(...* listener).

◆ SetDisplayMode() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetDisplayMode ( MediaPlayerDisplayMode  display_mode,
const std::function< void(int32_t)> &  callback 
)

Sets a display mode which will be used by player. If no display mode is set, MediaPlayerDisplayModeStretch is used.

Parameters
[in]display_modeA display mode to be used. See MediaPlayerDisplayMode enum for possible options.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.

◆ SetDisplayMode() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetDisplayMode ( MediaPlayerDisplayMode  display_mode)

Synchronously sets the display mode.

Warning
This method can't be called from the main thread.

For detailed description

See also
SetDisplayMode(..., callback).

◆ SetDisplayRect() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetDisplayRect ( const Rect rect,
const std::function< void(int32_t)> &  callback 
)

Sets the display region in which video will be displayed. The passed position is relative to the embed/object element of the WebPage associated with the given plugin.

Parameters
[in]rectVideo region in which video will be displayed.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes.

◆ SetDisplayRect() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetDisplayRect ( const Rect rect)

Synchronously sets the display region in which video will be displayed.

Warning
This method can't be called from the main thread.

For detailed description

See also
SetDisplayRect(..., callback).

◆ SetDRMListener() [1/2]

void Samsung::NaClPlayer::MediaPlayer::SetDRMListener ( DRMListener listener)

Attaches a DRMListener to the player. After attaching, the plugin will be notified about DRM related events.

The listener will be called in the same thread in which this method was called.

Listeners ownership is not taken by NaCl Player and application must control listener's object lifecycle.

Parameters
[in]listenerA DRMListener implementation whose methods will be notified about subscribed events.

◆ SetDRMListener() [2/2]

void Samsung::NaClPlayer::MediaPlayer::SetDRMListener ( std::shared_ptr< DRMListener listener)

Deprecated method for backwards compatibility

Deprecated:
In new code, raw pointers should be passed so as to not risk cyclic dependencies in client code.

For detailed description

See also
void SetBufferingListener(...* listener).

◆ SetDRMSpecificData() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetDRMSpecificData ( DRMType  drm_type,
DRMOperation  drm_operation,
uint32_t  drm_data_size,
const void *  drm_data,
const std::function< void(int32_t)> &  callback 
)

Calls a DRM system specific operation.

Parameters
[in]drm_typeA DRM system to be used
[in]drm_operationA DRM specific operation to be performed.
[in]drm_data_sizeA size of data buffer passed to DRM system.
[in]drm_dataA data buffer passed to DRM system.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ SetDRMSpecificData() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetDRMSpecificData ( DRMType  drm_type,
DRMOperation  drm_operation,
uint32_t  drm_data_size,
const void *  drm_data 
)

Synchronously calls a DRM system specific operation.

Warning
This method can't be called from the main thread.

For detailed description

See also
SetDRMSpecificData(..., callback).

◆ SetMediaEventsListener() [1/2]

void Samsung::NaClPlayer::MediaPlayer::SetMediaEventsListener ( MediaEventsListener listener)

Attaches a MediaEventsListener to the player. After attaching, the plugin will be notified about media playback related events.

The listener will be called in the same thread in which this method was called.

Listeners ownership is not taken by NaCl Player and application must control listener's object lifecycle.

Parameters
[in]listenerA MediaEventsListener implementation whose methods will be notified about subscribed events.

◆ SetMediaEventsListener() [2/2]

void Samsung::NaClPlayer::MediaPlayer::SetMediaEventsListener ( std::shared_ptr< MediaEventsListener listener)

Deprecated method for backwards compatibility

Deprecated:
In new code, raw pointers should be passed so as to not risk cyclic dependencies in client code.

For detailed description

See also
void SetMediaEventsListener(...* listener).

◆ SetPlaybackRate() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetPlaybackRate ( double  rate,
const std::function< void(int32_t)> &  callback 
)

Sets the playback rate. Pass: |rate| == 1.0 to mark normal playback, 0.0 < |rate| < 1.0 to mark speeds slower than normal, |rate| > 1.0 to mark speeds faster than normal.

Parameters
[in]rateA rate of the playback.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ SetPlaybackRate() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetPlaybackRate ( double  rate)

Synchronously sets the playback rate.

Warning
This method can't be called from the main thread.

For detailed description

See also
SetPlaybackRate(..., callback).

◆ SetSubtitleListener() [1/2]

void Samsung::NaClPlayer::MediaPlayer::SetSubtitleListener ( SubtitleListener listener)

Attaches a SubtitleListener to the player. After attaching plugin will be notified about subtitle texts that are parsed by the internal player subtitle parser at the time when they should be displayed. Only notifications regarding texts that originate from active text track are delivered this way. Previously attached listener (if any) is detached.

The listener will be called in the same thread in which this method was called.

Listeners ownership is not taken by NaCl Player and application must control listener's object lifecycle.

Parameters
[in]listenerA SubtitleListener implementation whose methods will be notified about subscribed events.

◆ SetSubtitleListener() [2/2]

void Samsung::NaClPlayer::MediaPlayer::SetSubtitleListener ( std::shared_ptr< SubtitleListener listener)

Deprecated method for backwards compatibility

Deprecated:
In new code, raw pointers should be passed so as to not risk cyclic dependencies in client code.

For detailed description

See also
void SetSubtitleListener(...* listener).

◆ SetSubtitlesDelay() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetSubtitlesDelay ( TimeDelta  delay,
const std::function< void(int32_t)> &  callback 
)

Sets subtitles (text stream) SubtitleListener event emission delay regarding to the current media time.

Parameters
[in]delayA delay to be set.
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ SetSubtitlesDelay() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetSubtitlesDelay ( TimeDelta  delay)

Synchronously sets subtitles (text stream) SubtitleListener event emission delay regarding to the current media time.

Warning
This method can't be called from the main thread.

For detailed description

See also
SetSubtitlesDelay(..., callback).

◆ SetVr360Mode() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetVr360Mode ( MediaPlayerVr360Mode  display_mode,
const std::function< void(int32_t)> &  callback 
)

Set Vr360 mode. This function should be called player idle state.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]vr360_modePP_MediaPlayerVr360Mode
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.
  • PP_ERROR_FAILED - if player was is invalid state.

◆ SetVr360Mode() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetVr360Mode ( MediaPlayerVr360Mode  display_mode)

Set Vr360 mode. This function should be called player idle state.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]vr360_modePP_MediaPlayerVr360Mode
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.
  • PP_ERROR_FAILED - if player was is invalid state.

◆ SetVr360Rotation() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetVr360Rotation ( float  horizontal_angle,
float  vertical_angle,
const std::function< void(int32_t)> &  callback 
)

Set Vr360 rotation.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]horizontal_angle- horizontal angle of rotation in degree range (0.0 to 360.0).
[in]vertical_angle- vertical angle of rotation in degree range (0.0 to 360.0).
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.

◆ SetVr360Rotation() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetVr360Rotation ( float  horizontal_angle,
float  vertical_angle 
)

Set Vr360 rotation.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]horizontal_angle- horizontal angle of rotation in degree range 0.0 to 360.0).
[in]vertical_angle- vertical angle of rotation in degree range (0.0 to 360.0).
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.

◆ SetVr360ZoomLevel() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetVr360ZoomLevel ( uint32_t  zoom_level,
const std::function< void(int32_t)> &  callback 
)

Set Vr360 zoom.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]zoom- zoom level (0 to 100).
[in]callbackA PP_CompletionCallback to be called upon completion.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT - if parameter was wrong.

◆ SetVr360ZoomLevel() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::SetVr360ZoomLevel ( uint32_t  zoom_level)

Set Vr360 zoom.

Parameters
[in]playerA PP_Resource identifying the media player.
[in]zoom- zoom level.
Returns
PP_OK on success, otherwise an error code from pp_errors.h. Meaning of errors:
  • PP_ERROR_BADARGUMENT -.

◆ Stop() [1/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Stop ( const std::function< void(int32_t)> &  callback)

Requests to stop playback of media from the data source attached to the media player.

Parameters
[in]callbackA callback to be called upon completion.
Returns
ErrorCodes::Success on success, otherwise an error code from ErrorCodes. Meaning of errors:

◆ Stop() [2/2]

int32_t Samsung::NaClPlayer::MediaPlayer::Stop ( )

Synchronously requests to stop playback of media from the data source attached to the media player.

Warning
This method can't be called from the main thread.

For detailed description

See also
Stop(callback).

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