A smartbox library allows to start one application on a few smartTV platforms.
Currently supported platforms:
To add your own platform please see the platform documentation.
Smartbox has three dependencies:
- jQuery(1.8.1+)
- Underscore(или lodash)
- Event Emitter( Backbone или Frontbone ) for the player plugin
The compiled version of the library is located in the directory /dist.
- Platforms' methods
- Log console
- Legend
- Navigation
- Input fields
- Keyboard(virtual)
- Voice management
- Legend @todo_doc
- Player
To use all plugins and functions of the library it's necessary to wrap a code as callback SB.ready SB.ready(function(){ // your code });
SB.ready will be executed after all callbacks jQuery.ready,
-
isInited() - checking the library initialization. Returns true or false
SB.isInited(); -
ready(func) executes the code of the funtion func after the library has been initializated
SB.ready(function(){ // your code }); -
readyForPlatform(platform, cb) executes the code of the funtion func after the library has been initializated, if the current plaform - platform
SB.readyForPlatform('samsung', function(){ // code for samsung });
All configurations of the library are located in the object SB.platform
SB.config = {
/**
* Platform which will be used in case detectPlatform returns false
* ex: browser, samsung, lg
* @type: {String}
*/
defaultPlatform: 'browser'
}String: shows which method is used to get DUID for application. By default: real.
real: the method SB.Platform.getNativeDUID() is used;mac: the method device MAC-address is used, available for LG and Samsung;random: a new DUID is generated each application starting;[other value]: will be used as DUID.
For example:
SB.config.DUID="fgsfds";
SB.ready(function(){
SB.currentPlatform.DUID;//=> "fgsfds"
});