Meego Wiki
Views

TV Browser Javascript API

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Tizen TV Browser Web API)
(Tizen TV Browser Web API)
Line 1: Line 1:
= Tizen TV Browser Web API =
= Tizen TV Browser Web API =
-
The Tizen TV Web API refers and follows to the Open IPTV DAE ( [http://www.oipf.tv/docs/Release2/V2.1/OIPF-T1-R2-Specification-Volume-5-Declarative-Application-Environment-v2_1-2011-06-21.pdf Declarative Application Environment V2.1] ) specification
+
The [[TV Browser | Tizen TV Browser]] API refers and follows to the Open IPTV DAE ( [http://www.oipf.tv/docs/Release2/V2.1/OIPF-T1-R2-Specification-Volume-5-Declarative-Application-Environment-v2_1-2011-06-21.pdf Declarative Application Environment V2.1] ) specification
== 1. Tuner and Broadcasting API ==
== 1. Tuner and Broadcasting API ==

Revision as of 19:01, 26 January 2012

Contents

Tizen TV Browser Web API

The Tizen TV Browser API refers and follows to the Open IPTV DAE ( Declarative Application Environment V2.1 ) specification

1. Tuner and Broadcasting API

  • Reference: Open IPTV DAE specfication Section 7.13
  • Status: Under development
  • Overview:

The broadcasting API describes the video/broadcast embedded object needed to support display and control by a DAE application of scheduled content received over local tuner functionality available to an OITF, including the conveyance of the channel list to the server. The term “tuner” is used here to identify a piece of functionality to enable switching between different types of scheduled content services that are identified through logical channels. This includes IP broadcast channels, as well as traditionalbroadcast channels received over a hybrid tuner.

MeGoTVChannel.jpg

  • Implementation

The implementation is based on NPAPI. And the channel scan uses w-scan as the low-level scan library, the w-scan is wrapped into D-Bus service. The playback is based on UMMS, which is also D-Bus service.

MeeGoTV-Impl.png

1.1 <video/broadcast> Embedded Object

MIME Type: "video/broadcast"

<video/broadcast> Object
Name Type Notes
width Property Integer
height Property Integer
fullscreen Property Integer
playState Property Integer
currentChannel Property Channel
ChannelChangeError Event (Channel channel, Number errorState)
PlayStateChange Event (Number state, Number error)
ChannenChangeSucceeded Event (Channel channel)
FullscreenChange Event ()
getChannelConfig Method ChannelConfig ()
bindToCurrentChannel Method Channel (Channel)
createChannelObject Method Channel (Integer idType, String dsd, Integer id)
setChannel Method void (Channel channel, Boolean trickplay, String contentAccessDescriptorURL)
prevChannel Method void ()
nextChannel Method void ()
stop Method void ()
setVolume Method Boolean (Integer volume)
getVolume Method Integer ()
release Method void ()

1.2 ChannelConfig Class

The ChannelConfig object provides the entry point for applications to get information about available channels

ChannelList class
Name Type Notes
channelList Property ChannelList the list of all available channels
ChannelScan Event (Integer type, Integer progress, Integer frequency,Integer signalStrength, Integer channelNumber, Integer channelType, Integer channelCount,Integer transponderCount)
ChannelListUpdate Event (void)
startScan Method Integer (ChannelScanOptions options, ChannelScanParameters scanParameters)
stopScan Method void ()

1.3 ChannelList Class

ChannelList class
Name Type Notes
getChannel Method Channel (String channelID)
getChannelByTriplet Method Channel (Integer onid, Integer tsid, Integer sid)
getChannelBySourceID Method Channel (Integer sourceID)

1.4 Channel Class

Channel class
Name Type Notes
channelType Property Integer
idType Property Integer
ccid Property String
tunerID Property String optional
onid Property Integer DVB or ISDB original network ID
tsid Property Integer DVB or ISDB transport stream ID (for channels of type ID_DVB_* and ID_ISDB_*)
sid Property Integer DVB or ISDB service ID (for channels of type ID_DVB_* and ID_ISDB_*)
sourceID Property Integer ATSC source_ID value
freq Property Integer For analogue channels, the frequency of the video carrier in kHz
cni Property Integer For analogue channels, the VPS/PDC confirmed network identifier
name Property String The name of the channel. Can be used for linking analog channels without CNI
majorChannel Property Integer The major channel number, if assigned. Value undefined otherwise. Typically used for channels of type ID_ATSC_*.
minorChannel Property Integer The minor channel number, if assigned. Value undefined otherwise. Typically used for channels of type ID_ATSC_*
dsd Property String this property defines the delivery system descriptor (tuning parameters) as defined by DVB-SI

1.5 ChannelScanOptions class

ChannelScanOptions
Name Type Notes
channelType Property Integer The types of channel that should be discovered during the scan. Valid values are TYPE_TV(0), TYPE_RADIO(1), or TYPE_OTHER(2)
replaceExisting Property Boolean If true, any existing channels in the channel list managed by the OITF SHALL removed

1.6 ChannelScanParameters class

ChannelScanParameters is base of other channel scan parameters type

  • DVBTChannelScanParameters class
DVBTChannelScanParameters
Name Type Notes
startFrequency Property Integer The start frequency of the scan, in kHz.
endFrequency Property Integer The start frequency of the scan, in kHz.
ofdm Property String The Orthogonal Frequency Division Multiplexing (OFDM) for the indicating frequency
modulationModes Property Integer The modulation modes to be scanned.
bandwidth Property String The expected bandwidth

1.7 Sample Code

1 <html>
2
3 <head>
4 <script>
5 function start_scan() {
6 var plugin = document.getElementById("broadcast_object");
7 var channelConfig = plugin.getChannelConfig();
8 channelConfig.addEventListener("onChannelScan", function (channel) {
9 // do your callback
10 });
11 channelConfig.startScan();
12 }
13 
14 function stop_scan() {
15 var plugin = document.getElementById("broadcast_object");
16 var channelConfig = plugin.getChannelConfig();
17 channelConfig.stopScan();
18 }
19 
20 function prevChannel() {
21 var plugin = document.getElementById("broadcast_object");
22 var channelConfig = plugin.getChannelConfig();
23 channelConfig.prevChannel();
24 }
25 
26 function nextChannel() {
27 var plugin = document.getElementById("broadcast_object");
28 var channelConfig = plugin.getChannelConfig();
29 channelConfig.nextChannel();
30 }
31 
32 </script>
33 </head>
34 
35 <body>
36 
37 <div id="pluginContainer">
38 <object type="video/broadcast" width=600 height=400 id="broadcast_object">
39 the broadcast video window
40 </object>
41 
42 <button onclick="start_scan()">Start Scan</button>
43 <button onclick="stop_scan()">Stop Scan</button>
44 
45 <button onclick="nextChanel()">Next Channel</button>
46 <button onclick="prevChanel()">Prev Channel</button>
47 </div>
48 </body>
49 
50 </html>


2. Configuration and setting APIs

  • Reference: Open IPTV DAE specfication Section 7.3
  • Status: Under development

2.1 application/oipfConfiguration embed object

MIME type: "application/oipfConfiguration"

<application/oipfConfiguration> Object
Name Type Notes
configuration Property Configuration
localSystem Property LocalSystem

2.2 Configuration class

Name Type Notes
preferredAudioLanguage Property String
preferredSubtitleLanguage Property String
countryId Property String
regionId Property Integer
pvrPolicy Property Integer
pvrSaveEpisodes Property Integer
pvrSaveDays Property Integer
pvrStartPadding Property Integer
pvrEndPadding Property Integer
preferredTimeShiftMode Property Integer
getText Method String (String key)
setText Method void (String key, String value)

2.3 LocalSystem class

Name Type Notes
deviceID Property String
systemReady Property Boolean
vendorName Property String
modelName Property String
softwareVersion Property String
hardwareVersion Property String
serialNumber Property String
releaseVersion Property Integer
majorVersion Property Integer
minorVersion Property Integer
oipfProfile Property String
pvrEnabled Property Boolean
ciplusEnabled Property Boolean
standbyState Property Boolean
powerState Property Integer
previousPowerState Property Integer
timeCurrentPowerState Property Integer
volume Property Integer
mute Property Boolean
outputs Property AVOutputCollection
networkInterfaces Property NetworkInterfaceCollection
tuners Property TunerCollection
tvStandard Property Integer
pvrSupport Property Integer
setScreenSize Method Boolean (Integer width, Integer height)
setPvrSupport Method Integer(Integer state)
setPowerState Method Boolean (Integer type)
setDigestCredentials Method Boolean (String protocol, String domain, String username, String password)
clearDigestCredentials Method Boolean (String protocol, String domain)
PowerStateChange Event (Integer powerState)

2.4 NetworkInterface class

Name Type Notes
ipAddress Property String
macAddress Property String
connected Property Boolean
enabled Property Boolean

2.4 AVOutput class

Name Type Notes
name Property String
type Property String
enabled Property Boolean
subtitleEnabled Property Boolean
videoMode Property String
digitalAudioMode Property String
audioRange Property String
hdVideoFormat Property String
tvAspectRatio Property String
supportedVideoModes Property String
supportedDigitalAudioModes Property String
supportedAudioRanges Property String

2.5 Sample code

Sample code of using configuration APIs

1 <html>
2 <head>
3 <script>
4 function start_scan() {
5 var plugin = document.getElementById("config_object");
6 
7 var configuration = plugin.configuration;
8 
9 console.log(configuration.countryId);
10 
11 var localSystem = plugin.localsystem;
12 
13 console.log(localSystem.deviceID);
14 console.log(localSystem.vendorName);
15 console.log(localSystem.softwareVersion);
16 }
17 </script>
18 </head>
19 
20 <body>
21 <div id="pluginContainer">
22 <object type="application/oipfConfiguration" id="config_object" visible=false>
23 The system configuration object
24 </object>
25 
26 <button onclick="get_config()">Get Configuration</button>
27 </div>
28 </body>
29 
30 </html>


3. Media Playback APIs

  • Reference: Open IPTV DAE specfication Section 7.14
  • Status: Already ready in MeeGo 1.2, need some effot to port to Tizen

3.1 A/V control embed object

Name Type Notes
speed Property Integer
playPosition Property Integer
playState Property Integer
setSource Method Boolean (String uri)
play Method void (void )
pause Method void (void)
stop Method void (void )
seek Method void (Integer)
setVolume Method void (Integer)
getVolume Method Integer (void)
PlayerStateChanged Event Integer
PlayPositionChanged Event Integer

3.2 Sample Code

Sample code of using media APIs

1 <html>
2 <head>
3 <script>
4 function play_function() {
5 var plugin = document.getElementById("plugin_id");
6 plugin.play();
7 }
8 
9 function set_uri() {
10 var plugin = document.getElementById("plugin_id");
11 plugin.setSource("file:///home/meego/Videos/sintel_trailer-240p.ogv");
12 }
13 
14 
15 function stop_function() {
16 var plugin = document.getElementById("plugin_id");
17 plugin.stop();
18 }
19 
20 function pause_function() {
21 var plugin = document.getElementById("plugin_id");
22 plugin.pause();
23 }
24 
25 function player_state_changed(state) {
26 console.log("player state changed");
27 document.getElementById("state").innerHTML = "State: " + state + "";
28 }
29 
30 function onload_function() {
31 document.getElementById("page").innerHTML = "Loaded";
32 document.getElementById("plugin_id").addEventListener("PlayStateChanged", player_state_changed ,false );
33 }
34 </script>
35 </head>
36 
37 <body onload="onload_function()" >
38 <embed type="application/x-oipf" width=600 height=400 id="plugin_id">
39 media playback window
40 </embed>
41 <button onclick="set_uri()">SetUri</button>
42 <button onclick="play_function()">play</button>
43 <button onclick="stop_function()">stop</button>
44 <button onclick="pause_function()">pause</button>
45 
46 <div id="state"><b>State</b></div>
47 </body>
48 </html>

Personal tools