top

PLAYER

This class supports a few functions such as buffering, handling error and rendering, all those functions are needed to play multimedia contents.

Add the following line for Player class into a html file your own :

  object id="plugin" classid="clsid:SAMSUNG-INFOLINK-SEF" style="width:0px; height:0px;">/object>

You can declare Player class like this :

  ex) plugin = document.getElementById("plugin");

        plugin.Open('Player', '1.112', 'Player');

        plugin.Execute('method', 'parm1', 'parm2');


Listeners

OnConnectionFailed

Description
OnConnectionFailed event is different from OnNetworkDisconnected. This event is sent only when media player fails to connect to server at the beginning or at the jump in HTTP and HTTPS streaming.
Emulator Support
SDK Constraint
Example
Player.OnConnectionFailed = OnConnectionFailed;
function OnConnectionFailed() {
    Player.Stop();
    ...
}

OnAuthenticationFailed

Description
The OnAuthenticationFailed event is sent by media player when it fails to play because authentication process has been failed.
Emulator Support
SDK Constraint
Example
Player.OnAuthenticationFailed = OnAuthenticationFailed;
function OnAuthenticationFailed() {
    Player.Stop();
    ...
}

OnStreamNotFound

Description
OnStreamNotFound event is sent by media player when it fails to play because streaming server replays that the stream specified by url parameter of Play() API is not exist.
Emulator Support
SDK Constraint
Example
Player.OnStreamNotFound = OnStreamNotFound;
function OnStreamNotFound() {
    Player.Stop();
    ...
}

OnNetworkDisconnected

Description
Receiving OnNetworkDisconnected event means media player already succeed to connect to streaming server. Usually this event means network is disconnected during the streaming.
Emulator Support
SDK Constraint
Example
Player.OnNetworkDisconnected = OnNetworkDisconnected;
function OnNetworkDisconnected() {
    Player.Stop();
    ...
}

OnRenderError

Description
OnRenderError event is sent by media player when it found that there are some problem in rendering because of the reason specified by parameter. Parameter value of OnRenderError means as follow: 1. Unsupported container 2. Unsupported video codec 3. Unsupported audio codec 4. Unsupported video resolution
Parameters
RenderErrorType Number
Emulator Support
SDK Constraint

OnRenderingComplete

Description
The OnRenderingComplete event is sent by media player when it reaches to the end of stream.
Emulator Support
SDK Constraint
Example
Player.OnRenderingComplete = OnRenderingComplete;
function OnRenderingComplete() {
    Player.Stop();
}

OnStreamInfoReady

Description
The OnStreamInfoReady event is sent by the media player is when it is ready to send content information such as duration and video resolution after parsing the stream. There are a few APIs which gives valid information only when they are called after OnStreamInfoReady() event is sent. APIs such as GetDuration(), GetVideoWidth(), and GetVideoHeight() are have to be used after widget get OnStreamInfoReady event.
Emulator Support
SDK Constraint
Example
Player.OnStreamInfoReady = OnStreamInfoReady;
function OnStreamInfoReady() {
    var totaltime = Player.GetDuration();
    var width = Player.GetVideoWidth();
    var height = Player.GetVideoHeight();
}

OnBufferingStart

Description
OnBufferingStart event is sent by media player when it goes on buffering status.
Emulator Support
SDK Constraint
Example
Player.OnBufferingStart = OnBufferingStart;
function OnBufferingStart() {
    //Drawing buffering image
}

OnBufferingComplete

Description
The OnBufferingComplete event is sent by media player when it gets out of buffering status.
Emulator Support
SDK Constraint
Example
Player.OnBufferingComplete = OnBufferingComplete;
function OnBufferingComplete() {
    //unload buffering image
}

OnBufferingProgress

Description
OnBufferingProgress event is sent by media play to notify how much data it has to receive more to get out from buffering status.
Parameters
percent Number
Emulator Support
SDK Constraint
Example
Player.OnBufferingProgress = OnBufferingProgress;
function OnBufferingProgress() {
    //Draing buffering progress bar
}

OnCurrentPlayTime

Description
OnCurrentPlayTime is sent by media player to notify current playback time.
Parameters
milli-sec Number
Emulator Support
SDK Constraint
Example
Player.OnCurrentPlayTime = OnCurrentPlayTime;
function OnCurrentPlayTime() {
    ....
}

Methods

InitPlayer

Description
The InitPlayer function initializes the media player with the specified URL.
Parameters
■url 
  - String
  - Specifies the URL of the content to play
Return■Boolean
  - always returns true
Emulator SupportY
SDK ConstraintNone
Example
Execute("InitPlayer", URL);
Execute("SetDisplayArea", x, y, width, height);
Execute("SetInitialBufferSize" 400*1024);
Execute("StartPlayback");

StartPlayback

Description
The StartPlayback function starts playback of contents.
Parameters
none
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
Execute("InitPlayer", url);
Execute("SetDisplayArea", x, y, width, height);
Execute("SetInitialBufferSize", 400*1024); //400KB
Execute("StartPlayback");

Play

Description
The Play function starts playing the content specified by url.
Parameters
■url 
  - String
  - Specifies the URL of content
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal = Execute("Play", url);

Stop

Description
The Stop function stops playback of the current content. Stop must be called before it exits.
Parameters
none
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal=Execute("Stop");

Pause

Description
The Pause function pauses the currently playing content.
Parameters
none
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal=Execute("Pause");

Resume

Description
The Resume function resumes the currently paused content.
Parameters
none
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal = Execute("Resume");

JumpForward

Description
The JumpForward function jumps forward from the current playback point by the amount specified by the seconds parameter.
Parameters
■offset
  - Number
  - Relative time offset from current time in seconds
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal = Execute("JumpForward", 30);

JumpBackward

Description
The JumpBackward function jumps backward from the current playback point by the amount specified in the seconds parameter.
Parameters
■offset 
  - Number
  - Relative time offset from current time in seconds
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal = Execute("JumpBackward", 30);

SetPlaybackSpeed

Description
The SetPlaybackSpeed function sets the playback speed of the currently playing content.
Parameters
■speed 
  - Number
  - Specifies the playback speed in multiples of 2. This can be negative integer for backward playback.
Return■Boolean
  - true : success
  - false : fail
Emulator SupportY
SDK ConstraintNone
Example
var retVal = Execute("SetPlaybackSpeed", "2");

GetDuration

Description
The GetDuration function gets the duration of currently playing content in seconds.
Parameters
none
Return■Success
  - duration of contents in seconds

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var totalTime = Execute("GetDuration");

GetVideoResolution

Description
The GetVideoResolution function gets the resolution, that is, the width and height, of the playing content. This function must be called after the widget receives the OnStreamInfoReady event to get the valid value.
Parameters
none
Return■Success
  - video resolution in ‘width|height’ form

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var resolution = Execute("GetVideoResolution");

GetAvailableBitrates

Description
The GetAvailableBitrates function gets the available bitrate information, if the content being played supports adaptive streaming. This function is available only when the playback uses a streaming solution that supports adaptive streaming, for example, HAS and Widevine.
Parameters
none
Return■Success
  - Available bitrates information for currently playing content as a string

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var bitratesInfo = Execute("GetAvailableBitrates");

GetCurrentBitrates

Description
The GetCurrentBitrates function gets the current bitrate of the playing content.
Parameters
none
Return■Success
  - bitrates of the currently playing content in byte number format

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var bps = Execute("GetCurrentBitrates");

GetPlayerVersion

Description
The GetPlayerVersion function gets the version of the media player.
Parameters
none
Return■String
  - The version of media player in the form of ‘UNIPLAYER-000000’.
Emulator SupportY
SDK ConstraintNone
Example
var version = Execute("GetPlayerVersion")