Native Player  1.0
Communication Namespace Reference

Classes

class  MessageReceiver
 Main class responsible for handling messages from the communication channel and controlling player life cycle. More...
 
class  MessageSender
 This class is designed to create and post messages from the player using the communication channel. Possible messages, which the player can send, are defined in enum MessageFromPlayer. More...
 

Enumerations

enum  MessageToPlayer {
  kClosePlayer = 0, kLoadMedia = 1, kPlay = 2, kPause = 3,
  kSeek = 4, kChangeRepresentation = 5, kChangeSubtitlesRepresentation = 7, kChangeSubtitlesVisibility = 8,
  kChangeViewRect
}
 
enum  MessageFromPlayer {
  kTimeUpdate = 100, kSetDuration = 101, kBufferingCompleted = 102, kAudioRepresentation = 103,
  kVideoRepresentation = 104, kSubtitlesRepresentation = 105, kRepresentationChanged = 106, kSubtitles = 107
}
 
enum  ClipTypeEnum { , ClipTypeEnum::kUrl = 1, ClipTypeEnum::kDash = 2 }
 

Variables

const std::string kKeyMessageToPlayer = "messageToPlayer"
 
const std::string kKeyMessageFromPlayer = "messageFromPlayer"
 
const std::string kKeyBitrate = "bitrate"
 
const std::string kKeyDuration = "duration"
 
const std::string kKeyEncoding = "encoding"
 
const std::string kKeyId = "id"
 
const std::string kKeyLanguage = "language"
 
const std::string kKeySubtitle = "subtitle"
 
const std::string kKeyTime = "time"
 
const std::string kKeyType = "type"
 
const std::string kKeyUrl = "url"
 
const std::string kKeyWidth = "width"
 
const std::string kKeyHeight = "height"
 
const std::string kKeyXCoordination = "x_coordinate"
 
const std::string kKeyYCoordination = "y_coordinate"
 

Detailed Description

In this namespace you can find a class designed for receiving messages from UI, a class designed for sending messages to UI and key values used for a message building.
It is assumed that UI is implemented in the separate module. In this application JavaScript is used for this purpose. For communication purposes the "post message" - "handle message" mechanism, characteristic for JavaScript and supported in NaCl, is used. All messages are VarDictionary objects and their values are held in a "key" - "value" map. It is mandatory for the message to contain a kKeyAction entry which defines message type.

Enumeration Type Documentation

This enum is used to define type of clip which is requested. Basing on this information the player can prepare accurate playback pipeline.
It is used in a MessageToPlayer::kLoadMedia message.

Enumerator
kUrl 

Requested content is a media container.

kDash 

Requested content is a dash manifest.

Definition at line 188 of file messages.h.

Values defined in this enum are used to recognize the message type sent from the player. The value of this type should be send in the VarDictionary object with the kKeyMessageFromPlayer key. When an action requires additional parameters these values should be also included in the sameVarDictionary object. Parameters can be found in the values description, each one's type key identifier and description is provided.

Note
Information about all tracks, representations and content duration is send right after content loading is finished. Other messages are send when accurate event occurs, or related operation have been completed.
See also
kKeyMessageToPlayer
Enumerator
kTimeUpdate 

An information from the player about current playback position.

Parameters
(double)kKeyTimeA value which holds current playback position in seconds.
kSetDuration 

An information from the player about the duration of the loaded content.

Parameters
(double)kKeyTimeA value which holds the content duration in seconds.
kBufferingCompleted 

An information from the player that buffering have been finished; no additional parameters.

kAudioRepresentation 

An information from the player about an Audio representation.

Parameters
(int)kKeyIdAn index of the Audio representation.
(int)kKeyBitrateA bitrate of the Audio representation.
(string)kKeyLanguageA language code of the Audio representation.
Note
When the player finishes loading the content, messages about all available Audio representation are sent.
kVideoRepresentation 

An information from the player about a Video representation.

Parameters
(int)kKeyIdAn index of the Video representation.
(int)kKeyBitrateA bitrate of the Video representation.
(int)kKeyHeightA height of the Video representation resolution.
(int)kKeyWidthA width of the Video representation resolution.
Note
When the player finishes loading the content, messages about all available Video representation are sent.
kSubtitlesRepresentation 

An information from the player about subtitles representation.

Parameters
(int)kKeyIdAn index of the subtitles representation.
(string)kKeyLanguageA language of the subtitle representation.
Note
When the player finishes loading the content, messages about all available subtitles representation are sent.
kRepresentationChanged 

An information that a defined representation has been changed.

Parameters
(int)kKeyTypeA definition whether the message is about a Video = 0 or an Audio = 1 stream.
(int)kKeyIdAn index of the currently used representation.
kSubtitles 

An information from the player that a subtitle sent in a message should be shown.

Parameters
(double)kKeyDurationAn information (in seconds) for how long from the current moment, a sent subtitle should be visible.
(string)kKeySubtitleA string which includes a subtitle which should be presented.

Definition at line 125 of file messages.h.

Values defined in this enum are used to recognize the message type sent to the player. The value of this type should be send in the VarDictionary object with the kKeyMessageToPlayer key. When an action requires additional parameters these values should be also included in the sameVarDictionary object. Parameters can be found in the values description, each one's type key identifier and description is provided.

See also
kKeyMessageToPlayer
Enumerator
kClosePlayer 

A request to close the player; no additional parameters.

kLoadMedia 

A request to load content specified in additional fields and prepare the player to play it.

Parameters
(int)kKeyTypeA specification of what kind of content have to be loaded. The only values accepted for this parameter are the ones defined by ClipEnumType
(string)kKeyUrlAn URL to the content container. This points to different file types depending on values of kKeyType.
(string)kKeySubtitle[optional] A path to the file with external subtitles. If an application wants to play content with external subtitles this field must be filled.
(string)kKeyEncoding[optional] A subtitles encoding code. If this parameter is not specified then UTF-8 will be used .
See also
Communication::ClipTypeEnum
kPlay 

A request to start playing; no additional parameters.

kPause 

A request to pause playing; no additional parameters.

kSeek 

A request to set a playback current position to a defined one.

Parameters
(double)kKeyTimeA new current playback position.
kChangeRepresentation 

A request to change stream representation to a defined one.

Parameters
(int)kKeyTypeAn information whether a Video = 0 or an Audio = 1 stream needs to be changed.
(int)kKeyIdAn index of a stream representation which should be used.
kChangeSubtitlesRepresentation 

A request to change subtitles representation to a defined one.

Parameters
(int)kKeyIdAn index of a subtitles representation which should be used.
kChangeSubtitlesVisibility 

A request to enable or disable subtitle events, depending on the previous state. Initially subtitles events are enabled. No additional parameters.

kChangeViewRect 

An information about the players position and size.

Parameters
(int)XCoordinationAn x position of the players left upper corner.
(int)YCoordinationA y position of the players left upper corner.
(int)kKeyWidthA width of the players window.
(int)kKeyHeightA height of the players window.

Definition at line 55 of file messages.h.

Variable Documentation

const std::string Communication::kKeyBitrate = "bitrate"

A string value used in messages as a VarDictionary key. This key maps to an int type value.

Definition at line 218 of file messages.h.

const std::string Communication::kKeyDuration = "duration"

A string value used in messages as a VarDictionary key. This key maps to a double type value.

Definition at line 222 of file messages.h.

const std::string Communication::kKeyEncoding = "encoding"

A string value used in messages as a VarDictionary key. This key maps to a string type value.

Definition at line 226 of file messages.h.

const std::string Communication::kKeyHeight = "height"

A string value used in messages as a VarDictionary key. This key maps to an int type value.

Definition at line 258 of file messages.h.

const std::string Communication::kKeyId = "id"

A string value used in messages as a VarDictionary key. This key maps to an int type value.

Definition at line 230 of file messages.h.

const std::string Communication::kKeyLanguage = "language"

A string value used in messages as a VarDictionary key. This key maps to a string type value.

Definition at line 234 of file messages.h.

const std::string Communication::kKeyMessageFromPlayer = "messageFromPlayer"

A string value used in messages as a VarDictionary key. kKeyMessageFromPlayer is used in all messages sent by the player. The value in a field with this key is used to define what kind of message it is. The only values the player can use for this field are values defined by enum MessageFromPlayer

See also
Communication::MessageFromPlayer

Definition at line 214 of file messages.h.

const std::string Communication::kKeyMessageToPlayer = "messageToPlayer"

A string value used in messages as a VarDictionary key. kKeyMessageToPlayer has to be used in all messages addressed to the player. The value sent in a field with this key is used to define what kind of message it is. The only values accepted for this field are the ones defined by the enum MessageToPlayer.

See also
Communication::MessageToPlayer

Definition at line 206 of file messages.h.

const std::string Communication::kKeySubtitle = "subtitle"

A string value used in messages as a VarDictionary key. This key maps to a string type value.

Definition at line 238 of file messages.h.

const std::string Communication::kKeyTime = "time"

A string value used in messages as a VarDictionary key. This key maps to a double type value.

Definition at line 242 of file messages.h.

const std::string Communication::kKeyType = "type"

A string value used in messages as a VarDictionary key. This key maps to an int type value.

Definition at line 246 of file messages.h.

const std::string Communication::kKeyUrl = "url"

A string value used in messages as a VarDictionary key. This key maps to a string type value.

Definition at line 250 of file messages.h.

const std::string Communication::kKeyWidth = "width"

A string value used in messages as a VarDictionary key. This key maps to an int type value.

Definition at line 254 of file messages.h.

const std::string Communication::kKeyXCoordination = "x_coordinate"

A string value used in messages as a VarDictionary key. This key maps to an int type value.

Definition at line 262 of file messages.h.

const std::string Communication::kKeyYCoordination = "y_coordinate"

A string value used in messages as a VarDictionary key. This key maps to an inttype value.

Definition at line 266 of file messages.h.