TV.CHANNEL
tv.channel class includes general functions of the channel control to develop TV app.
For example, getting an available channel information and changing a current TV's channel.
Add the following line for tv.channel class into a html file your own : <script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script> |
You can declare tv.channel class like this : ex) var tvChannel = webapis.tv.channel; |
Contents
Methods
ChannelListSuccuessCallback | ||
Description | ||
[callback]Specifies the options for gathering the available Channel list. | ||
Parameters | ■onsuccess - Function - callback to be called when the operation is succeded | |
Return | ■ returns the available channel list | |
Emulator Support | Yes | |
SDK Constraint | None | |
Example | ||
var mode = webapis.tv.channel.NAVIGATOR_MODE_ALL; var nStart = 0; var channelSize = 10; var errorCallback = function () {}; var ChannelListSuccuessCallback = function(channelList) { for (var i=0; i<channelList.length; i++ ){ console.log ("ptc : " + channelList[i].ptc) console.log ("major : " + channelList[i].major) console.log ("minor : " + channelList[i].minor) console.log ("lcn : " + channelList[i].lcn) console.log ("sourceID : " + channelList[i].sourceID) console.log ("programNumber : " + channelList[i].programNumber) console.log ("transportStreamID : " + channelList[i].transportStreamID) console.log ("originalNetworkID : " + channelList[i].originalNetworkID) console.log ("serviceName : " + channelList[i].serviceName) console.log ("channelName : " + channelList[i].channelName) } }; webapis.tv.channel.getChannelList(ChannelListSuccuessCallback, errorCallback, mode, nStart, channelSize); |
findChannel | ||
Description | ||
This function is used to get the specified channel information. | ||
Parameters | ■major - Number - major channel number ■minor - Number - minor channel number ■successCallback - Function - called when the invocation ends successfully ■errorCallback - Function - called when an error occurs | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
function successCB(channels) { console.log("getting channels is successful"); } function errorCB(error) { console.log(error.name); } try { webapis.tv.channel.findChannel(9, 0, successCB, errorCB); } catch (error) { console.log(error.name); } |
getChannelList | ||
Description | ||
This function is used to retrieve the list of channels. It takes mode, starting number and the number of channels to be retrieved as parameters apart from the successCallback and errorCallback. | ||
Parameters | ■successCallback - called when the invocation ends successfully ■errorCallback - called when an error occurs ■mode (Optional) - unsigned short - channel navigation mode ■nStart (Optional) - unsigned long - start index ■number (Optional) - unsigned long - number of the channel information | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
function successCB(channels) { console.log("getting channels is successful"); } function errorCB(error) { console.log(error.name); } try { // gets 10 channel list of all channels webapis.tv.channel.getChannelList(successCB, errorCB, webapis.tv.channel.NAVIGATOR_MODE_ALL, 0, 10); } catch (error) { console.log(error.name); } |
getCurrentChannel | ||
Description | ||
This function is used to retrieve the current channel information. | ||
Parameters | none | |
Return | ■ChannelInfo - Current channel inforamtion | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
var retValue = webapis.tv.channel.getCurrentChannel(); |
getCurrentProgram | ||
Description | ||
This function is used to retrieve the current program information of the tuned channel. | ||
Parameters | none | |
Return | ■ProgramInfo - current program information - broadcast over the given channel | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
var currentProgram = webapis.tv.channel.getCurrentProgram(); |
getNumOfAvailableTuner | ||
Description | ||
Gets the number of available tuners. | ||
Parameters | none | |
Return | ■Unsigned long | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
try { var tuners = webapis.tv.channel.getNumOfAvailableTuner(); console.log("TV has " + tuners + " tuners"); } catch (error) { console.log(error.name); } |
getProgramList | ||
Description | ||
This function is used to get the program list in the channel tuned. It takes channelInfo, startTime and the number of programs to be retrieved as parameters apart from the successCallback and errorCallback. | ||
Parameters | ■channelInfo - ChannelInfo - specifies channel information ■startTime - unsigned long - program start time ■successCallback - Callback Function - called when the invocation ends successfully ■errorCallback - Callback Function - called when an error occurs ■duration (Optional) - unsigned long - time duration in which period programs will be searched | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
function successCB(programs) { console.log("getting programs is successful"); } function errorCB(error) { console.log(error.name); } try { var channel = webapis.tv.channel.getCurrentChannel(); webapis.tv.channel.getProgramList(channel, webapis.tv.info.getEpochTime(), successCB, errorCB, 3600); } catch (error) { console.log(error.name); } |
ProgramListSuccuessCallback | ||
Description | ||
[callback] Specifies the options for gathering the available program list. | ||
Parameters | ■onsuccess - Function - callback to be called when the operation is succeded | |
Return | ■ returns the available program list | |
Emulator Support | Yes | |
SDK Constraint | None | |
Example | ||
var errorCallback = function () {}; var ProgramListSuccuessCallback = function (programs) { for (var i=0; i<programs.length; i++ ){ console.log ("title : " + programs[i].title) console.log ("startTime : " + programs[i].startTime) console.log ("duration : " + programs[i].duration) console.log ("detailedDescription : " + programs[i].detailedDescription) console.log ("language : " + programs[i].language) console.log ("rating : " + programs[i].rating) } }; var setSourceCB = function(sInfo, windowID){ var currentChannel = webapis.tv.channel.getCurrentChannel(windowID); var startTime = webapis.tv.info.getEpochTime(); var duration = 3600; webapis.tv.channel.getProgramList(currentChannel, startTime, ProgramListSuccuessCallback, errorCallback, duration); } var errorCB = function() {} webapis.tv.window.setSource({type : webapis.tv.window.SOURCE_MODE_TV, number : webapis._pluginDef.PL_WINDOW_SOURCE_TV}, setSourceCB, errorCB, 0); |
tune | ||
Description | ||
This function is used to tune to the specified channel. | ||
Parameters | ■option - TuneOption - option for tuning information ■successCallback - called when the invocation ends successfully ■errorCallback - called when an error occurs ■windowID (optional) - unsigned short - window identifier | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
function successCB() { console.log("tuning is successful"); } function errorCB(error) { console.log(error.name); } webapis.tv.channel.tune({ ptc: 9, major: 9, minor: 0, sourceID : 9, programNumber: 9, transportStreamID : 90, tunecallback: { onsucess: function(programList) { console.log("getting program list is successfully"); }, onerror: function(channelList) { console.log("getting program list is successfully"); } } }, successCB, errorCB, 0); |
tuneDown | ||
Description | ||
This function is used to tune the previous channel. Upon success successCallback is called and upon failure errorCallback is called. | ||
Parameters | ■successCallback - called when the invocation ends successfully ■errorCallback - called when an error occurs ■tuneMode (Optional) - Channel navigation mode * TV_CHANNEL_NAVIGATOR_MODE_ALL * TV_CHANNEL_NAVIGATOR_MODE_DIGITAL * TV_CHANNEL_NAVIGATOR_MODE_ANALOG * TV_CHANNEL_NAVIGATOR_MODE_FAVORITE ■windowID (Optional) - unsigned short - window identifier | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
function successCB() { console.log("tuning is successful"); } function errorCB(error) { console.log(error.name); } webapis.tv.channel.tuneDown(successCB, errorCB, webapis.tv.channel.NAVIGATOR_MODE_ALL, 0); |
tuneUp | ||
Description | ||
This function is used to tune the next channel. Upon success successCallback is called and upon failure errorCallback is called. | ||
Parameters | ■successCallback - called when the invocation ends successfully ■errorCallback - called when an error occurs ■tuneMode (Optional) - Channel navigation mode * TV_CHANNEL_NAVIGATOR_MODE_ALL * TV_CHANNEL_NAVIGATOR_MODE_DIGITAL * TV_CHANNEL_NAVIGATOR_MODE_ANALOG * TV_CHANNEL_NAVIGATOR_MODE_FAVORITE ■windowID (Optional) - unsigned short - window identifier | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
function successCB() { console.log("tuning is successful"); } function errorCB(error) { console.log(error.name); } webapis.tv.channel.tuneUp(successCB, errorCB, webapis.tv.channel.NAVIGATOR_MODE_ALL, 0); |