The device API is mostly only translated
Development Guide
Http://www.samsungdforum.com/Guide/ref00011/index.html
(2013-04-26-10:35:01)
1.Device API
(API release time, 2012-02-01, this API is compatible with sdk4.0,3.5,2.5 and 2012,2011 modules)
The device API provides an optional, older way to leverage the middleware DTV functionality than the network device APIs. In addition, it provides additional functionality that is not available on the network device APIs.
The device API defines some of the following
API Widget does not support TV when using JS function (for example, switching channels).
The device API is also a JS
The device API is either a method call or a callback, which means it has the characteristics of bidirectional communication
Device APIs are used in conjunction with browsers
The device API has limited expressive power and use, such as some data structures or arrays of expressions.
Samsung's device APIs can be different for each product
The device API relies on the modules of the Samsung machine, and each product can have different modules.
The system's device API structure is described below
The device API that the widget can invoke supports Samsung's devices and other device modules, such as channel functional tiering
The device API layer actually binds JS like the c++/c language.
Samsung Smart TV has two main layers, widgets and Samsung's engines
The device API is a binary image that can be changed without changing any requirements.
Each API can have an enhanced version of the additional functionality under the Device API, which can be obtained by version number, with the version descriptor example:
[deivceapiname]-[xxxx]|ex.| TVMW-0005
The device API contains the following contents
api/Module Description
1.common/General
The generic API is a virtual plug-in that introduces some of the common features of all plug-ins, and it is not a real plugin
function/function
Getplugininfo ()
Define: This function gets information about the device API
Param: Parameter pl_cmn_info defines a common type of information for the device API, 0 for Pl_cmn_info_version for plug-in versions, and can be passed in numbers or strings
Return: Returns a positive value of success, negative value to failure
Example: Example:
Versionmsg = Pluginobject.getplugininfo (pl_cmn_info_version);
2.appcommon/app commonly used
App API to deal with basic TV functions, such as the registration of key values
function/function
Checkreservedkey ()
Iskeyregister ()
Registerallkey ()
Registercolorkey ()
Registerkey ()
Registernavikey ()
Registernumkey ()
Registerplaybackkey ()
Sendevent IME ()
Sendevent IME Sync ()
Sendkeytotvviewer ()
Subscribeevent ()
Unregisterallkey ()
Unregistercolorkey ()
Unregisterkey ()
Unregisternavikey ()
Unregisternumkey ()
Unregisterplaybackkey ()
Unsubscribeevent ()
event/Events
OnMessage
3.player/player
Player API controls multimedia playback back to look. Latest Version Player-0006,clsid:samsung-infolink-player
function/function
Clearscreen ()
Define: Clear the TV screen and black screen
Param:
Return:turn on returns success or false
Example:var Retval=imageviewer.clearscreen ()
Getavailablebitrates ()
Define: Gets the available bit rate for the currently playing streaming media
Param:
Return: Returns the available bit rate. Use a string or ' | ' A segmented byte to denote, such as 100kbps,200kbps or 102400|204800.
Remarks: The return value is only valid when play () is used
Example:var bitratesinfo=player.getavailablebitrates ();
Getcurrentbitrates ()
Define: Gets the bit rate of the current playback content
Param:
Return: Returns the current playback bit rate in number format
Example:var bps=player.getcurrentbitrates ();
Getduration ()
Define: Gets the continuation row of the current playback content.
Param:
Return: The total number of successful playback, otherwise 1
Remarks: Must be used before the Onstreaminfoready () callback function starts
Example:var totaltime=player.getduration ();
Getliveduration ()
Define: Get live content that the current media server can sustain
Param:
Return: Returns the live content string at start and end times
Remarks: Available only after using the Widevine live streaming solution
Example:var retval=getliveduration ();
Getplayerversion ()
Define: Get Player version
Param:
Return: Returns to the player version, formatted like "UNIPLAYER-000000"
Example:var version=getplayerversion ();
Getvideoheight ()
Define: Gets the height of the current playback video
Param:
Return: Returns the height of the current playback video content
Remarks: Used when Onstreaminfoready callback function callback
Example:var height=player.getvideoheight ();
Getvideowidth ()
Define: Gets the width of the current playback video content
Param:
Return: The width of the current playback video content
Remarks: Used when Onstreaminfoready callback function callback
Example:var width=player.getvideowidth ();
Initplayer ()
Define: Initializes the player with a specified URL
param: (string url)/url string
Return: Always returns True
Remarks: Can not be used with the play () API. If the widget uses Initplayer (), it must use Startplayback () for playback of a content, otherwise it must use only playing (), if you want to use Initplayer (), It must be used before other API declarations.
Example:Player.InitPlayer (URL);
Setdisplayarea (x, y, width, height);
Setinitialbuffersize (400*1024); 400KB
Startplayback ();
Jumpbackward ()
Define: How many seconds from the current replay point to jump backward
Param:number offset/number offset, current time, and seconds difference for time to jump
Return: Jump successfully returns success, otherwise false
Remarks: Like the TV.
Example:var Retval=player.jumpbackward (30);
Jumpforward ()
Define: How many seconds from the current replay point to jump forward
Param:number offset/number offset, current time, and seconds difference for time to jump
Return: Jump successfully returns success, otherwise false
Example:var Retval=player.jumpforward (30);
Pause ()
Define: Pause Current playback content
Param:
Return: Successful success failed false
Example:var Retval=player.pause ();
Play ()
Define: Play the specified URL content
Param:string/url string
Return: Successful success failed false
Example:var retval=player.play (URL);
Resume ()
Define: Resuming paused content
Param:
Return: Successful success failed false
Example:var Retval=player.resume ();
Resumeplay ()
Define: Resume playback by specifying the URL, the content that is played at the specified location
Param:string/url string, number/how many seconds
Return: Successful success failed false
Remarks: Often use the points saved from the bookmark to resume playback
Example:var Retval=player.resumeplay (url,3600);
Setcroparea ()
Define: Sets the original content that the widget clipping area wants to display. Usually used to remove black edges
Param: (number x, number y, number width, number height)/x,y axis coordinates (0,0 on left), width and height
Return: Successful success failed false
Example:var Retval=player.setcroparea (0,100,1920,880);
Setdisplayarea ()
Define: Set the display video content on the TV screen
Param: (number x, number y, number width, number height)/x,y axis coordinates (0,0 on left), width and height
Return: Successful success failed false
Example:var Retval=player.setdisplayarea (0,0,1920,1080);
Setict ()
Define: Setting ICT output levels
Param:bicton,bool value/Specify the output level of ICT, ICT open return True,ict turn false
Return: Successful success failed false
Remarks: Use after Onstreaminfoready callback, if the widget does not call this function, then the system will shut down the ICT
Example:var retval=setict (FALSE);
Setinitialbuffer ()
Define: Set the percentage size of the first cache at the time of the webcast
param:byte/byte, specifying the byte size of the cache, this API is optional and the media Player has a default value
Return: Successful success failed false
Example:var Retval=setinitialbuffer (1024*1024);
Setinitialtimeout ()
Define: Sets the maximum time for initial cache timeout before playback starts
Param:number second/seconds
Return: Successful success failed false
Remarks: This API is optional and the media Player has a default value
Example:var Retval=setinitialtimeout (30);
Setmacrovision ()
Define: Set the level of macro vision to support PLAYER-0003
param:number/or specify level
0:aps_all_off
1:aps_agc_on_only
2:aps_agc_on_cs_2l
3:aps_agc_on_cs_4l
Return: Successful success failed false
Remarks: Use after Onstreaminfoready callback, if the widget does not call this function, then the rank defaults to 0.
Example:var retval=setmacrovision (3);
Setpendingbuffer ()
Define: The size of the buffer as a percentage of the total cache when the media player is buffered
Param:number byte
Return: Successful success failed false
Remarks: This API is optional and the media Player has a default value
Example:var Retval=setpendingbuffer (512*1024); 512KB
Setplaybackspeed ()
Define: Set the speed of the multicast content
Param:speed (number)/speed of play, can be negative
Return: Successful success failed false
Remarks: Use after play () callback function call
Example:var Retval=setplayerbackspeed (2);
Setplayerproperty ()
Define: Set some properties of the media player, such as cookies
Param: (number type, string strparam, number Numparam)/digit, string, numeric parameter
Number Type:1:cookie Specifies the property that the widget wants to set, 1 is a Cookie
Strparam: String that specifies the parameters after the set property, such as 1st is the value of the cookie for the cookie property
Numparam: Specifies that the parameters of the set number are set, such as the length of the value of the cookie
Return: Successful success failed false
Remarks: Initplayer () and Startplayer () callback after use, play () can not use Setplayerproperty ()
Example:initplayer (URL);
Settotalbuffersize (size); Optional
Setplayerproperty (1, "Cookievalue", cookievaluelength); Set Cookie
Startplayback (SEC);
Settotalbuffersize ()
Define: Sets the buffer size of the player's stream
Param:number
Return: Successful success failed false
remarks:size/number, specifying total buffer size bytes, optional for this API, player contains default values
Example:var retval=settotalbuffersize (5*1024*1024); 5MB
Setvbidata ()
Define: Set Vbidata output level, support PLAYER-0003
Param: (number macrovisiontype,number Cgmstype)
Macrovisiontype
Number, specifies the macrovisiontype level. Specify the rank of the macro view
0:aps_all_off
1:aps_agc_on_only
2:aps_agc_on_cs_2l
3:aps_agc_on_cs_4l
Cgmstype
Number
Specifies the cgmstype level.
0:cgms_copy_free
1:cgms_copy_no_more
2:cgms_copy_once
3:cgms_copy_never
Return: Successful success failed false
Remarks: Called after the Onstreaminfoready callback, if the widget does not call this function, the system will not set the Vbidata output level, so the lowest level will be applied, if the widget wants to protect the content or want to use a different level of protection, You have to call this API, and the default is Aps_all_off and Cgms_copy_free.
Example:var Retval=setvbidata (3,3);
Startplayback ()
Define: Start playback of content
Param:
Return: Successful success failed false
Remarks: Must be called after Initplayer (), cannot be play (). Startplayback () calls
Example:Player.InitPlayer (URL);
Setdisplayarea (x, y, width, height);
Setinitialbuffersize (400*1024); 400KB
Startplayback ();
Stop ()
Define: Stop Current playback content
Param:
Return: Successful success failed false
Example:var Retval=player.stop ();
event/Events
Onadend
Define: When you finish playing the ad, it only works with some specific content that uses streaming media solutions. Support PLAYER-0005
Remakrs:widget programs can use this time to jump/skim operations or hide user notification messages
Example:player.onadend=onadend;
function Onadend ()
{
Hide AD. Notification message hide AD notification messages
Unblock jump event Unlock hop events
}
Onadstart
Define: When the multicast, need 1 ads to start, only for some use has flow resources of the specified content, support PLAYER-0005
Remakrs:widget programs can use this time to prevent ads from skipping or displaying user notification messages
Example:player.onadstart=onadstart;
function Onadstart ()
{
Show AD. Notification message displays AD notification messages
Block Jump event Lock Hop events
}
Onauthenticationfailed
Define: Event that the media player failed during the validation process
example:player.onauthenticationfailed=onauthenticationfailed;
function onauthenticationfailed () {
Player.stop ();
}
Onbufferingcomplete
Define: Media Player gets buffered state
Example:player.onbufferingcomplete=onbufferingcomplete;
function Onbufferingcomplete ()
{
Unload buffering image. Upload a buffer image
}
Onbufferingprogress
Define: Notifies the media player how much data is received from the buffered state
Param:percent numbers, from 0~100
example:player.onbufferingprogress=onbufferingprogress;
function onbufferingprogress ()
{
Drawing buffering progress bar.
}
Onbufferingstart
Define: Media Player gets buffered state
Example:player.onbufferingstart=onbufferingstart;
function Onbufferingstart ()
{
Drawing buffering image.
}
Onconnectionfailed
Define: When the media server is not connected to a streaming media server
REMAKRS: Unlike network link time onnetworkdisconnected, this event is sent only when the media player starts playing the connection Http/https streaming media server.
example:player.onconnectionfailed=onconnectionfailed;
function onconnectionfailed ()
{
Player.stop ();
...
}
Oncurrentplaytime
Define: When the media Player is notified of the current back-broadcast time
Param: microsecond
Example:player.oncurrentplaytime=oncurrentplaytime;
function Oncurrentplaytime () {
...
}
onnetworkdisconnected
Define: When the media player's network loses its connection or when the streaming media server stops sending the stream
Remakrs: Receiving this event means that the media player has successfully connected to the streaming media service, which usually means that the stream loses its link in the network
example:player.onnetworkdisconnected=onnetworkdisconnected;
function onnetworkdisconnected ()
{
Player.stop ();
}
Onrendererror
Define: When there is a problem with the specified parameters of the media Player
Param:rendererrortype number/Digital
Remakrs: The following parameters are defined
1:unsupported container
2:unsupported Video Codec
3:unsupported Audio Codec
4:unsupported Video resolution
Example
Onrenderingcomplete
Define: When the media server plays, it reaches the end of the stream
Example:player.onrenderingcomplete=onrenderingcomplete;
function Onrenderingcomplete ()
{
Player.stop ();
}
Onresolutionchanged
Define: When a video resource is changed in the back-broadcast, it is only valid for some of the content that specifies that the has stream resource is used, and the version PLAYER-0002
example:player.onresolutionchanged=onresolutionchanged;
function onresolutionchanged () {
}
Onstreaminfoready
Define: When the player is ready to send content information such as duration, parameter stream video resources
REMAKRS: Some APIs are only valid when Onstreaminfoready () is sent. such as Getduration (), Getvideowidth (), Getvideohight ()
Example:player.onstreaminfoready=onstreaminfoready;
function Onstreaminfoready ()
{
var totaltime=player.getduration ();
var width=player.getvideowidth ();
var height=player.getvideoheight ();
}
Onstreamnotfound
Define: Player because the Stream media server does not exist through the play () API of the URL parameter, causing playback to fail
Example:player.onstreamnotfound=onstreamnotfound;
function Onstreamnotfound ()
{
Player.stop ();
}
4.screen/screen
The screen API handles the commands of the TV screen, such as the 3D effect, the latest version Screen-0004,clsid:samsung-infolink-screen
function/function
Check3deffectmode
Define: Check the input mode of the 3D effect
Param:pl_screen_3deffect_mode
Return: Positive value failed
Remarks: Always return false
Example
if (1 = screenplugin.flag3deffectsupport ())
{
if (Pl_screen_3deffect_mode_side_by_side = = Screenplugin.get3deffectmode ())
{
if (1 = = Screenplugin.check3deffectmode (Pl_screen_3deffect_mode_off);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_off);
}
}
Else
{
if (1 = = Screenplugin.check3deffectmode (pl_screen_3deffect_mode_side_by_side);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_side_by_side);
}
}
}
Flag3dtvconnect
Define: Check to see if the connected TV supports 3D mode, only in BD mode can call, support SCREEN-0005
Param:
Return: Positive value failed
Example
if (1 = screenplugin.flag3dtvconnect ())
{
if (Pl_screen_3deffect_mode_side_by_side = = Screenplugin.get3deffectmode ())
{
if (1 = = Screenplugin.check3deffectmode (Pl_screen_3deffect_mode_off);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_off);
}
}
Else
{
if (1 = = Screenplugin.check3deffectmode (pl_screen_3deffect_mode_side_by_side);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_side_by_side);
}
}
}
Flag3deffectsupport
Define: Check if the device supports 3D effects
Param:
Return: Positive value failed
Remarks: Always return false
Example
if (1 = screenplugin.flag3deffectsupport ())
{
if (Pl_screen_3deffect_mode_side_by_side = = Screenplugin.get3deffectmode ())
{
if (1 = = Screenplugin.check3deffectmode (Pl_screen_3deffect_mode_off);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_off);
}
}
Else
{
if (1 = = Screenplugin.check3deffectmode (pl_screen_3deffect_mode_side_by_side);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_side_by_side);
}
}
}
Get3deffectmode
Define: Get current 3D mode (Pl_screen_3deffect_mode), support SCREEN-0002
Param:
Return: Positive value failed
Remarks: Always return to Pl_screen_3deffect_mode_off
Example
if (1 = screenplugin.flag3deffectsupport ())
{
if (Pl_screen_3deffect_mode_side_by_side = = Screenplugin.get3deffectmode ())
{
if (1 = = Screenplugin.check3deffectmode (Pl_screen_3deffect_mode_off);
{
Screenplugin.set3deffectmode (Pl_screen_3deffect_mode_off);
}
}
Else
{
if (1 = = Screenplugin.c