Cisco Digital Media Player
JavaScript API
by Jenny Polyakov
DMP JavaScript API
Modification History
Rev Date Originator Comment
1 Jenny Polyakov Created
2 Aug 19, Mitul Sen Updated
2008
3 Sep 15 Mitul Sen Incorporated review comments
2008
4 Oct 9 2008 Mitul Sen Added some notes based on PM comments
Table of Contents
TABLE OF CONTENTS .............................................................................................................. 2
INTRODUCTION ......................................................................................................................... 4
SYSTEM COMPONENTS .................................................................................................................. 4
VIDEO AND GRAPHICS PLANES ..................................................................................................... 5
TVZILLA PREFERENCES......................................................................................................... 6
INTRODUCTION............................................................................................................................... 6
TVZILLA SPECIFIC PREFERENCES................................................................................................ 6
MOZILLA FIREFOX PREFERENCES ............................................................................................... 9
JAVASCRIPT APIS.................................................................................................................... 11
OVERVIEW .................................................................................................................................... 11
JAVASCRIPT CALLS ..................................................................................................................... 12
APPENDIX A. SYSTEM PARAMETERS ............................................................................... 17
Cisco Systems Confidential Page 2 of 25
DMP JavaScript API
APPENDIX B. CHANGES FROM DMP 43XX ....................................................................... 21
APPENDIX C. SAMPLE CODE ............................................................................................... 23
Cisco Systems Confidential Page 3 of 25
DMP JavaScript API
Introduction
This document depicts the low-level JavaScript API to the Cisco Digital Media Player’s
(DMP) multimedia functionality. This API document mainly addresses the Yoda DMP
release but should be compatible with the DMP 4300G series 2.43 release and up.
System Components
The DMP is a highly versatile middleware platform for the IP-based set-top boxes. Its
core is based on the Linux operating system. The following is a structural diagram of the
DMP’s software components:
Media Player: can play movies from several sources: including UDP multicast
stream, HTTP server.
Web Server: allows controlling the DMP via the Web. The control (user)
interface allows the performance of some general operations (reboot, changing
volume, brightness and contrast, etc.) for the device with the help of a web
browser. In this version of the firmware, the developer cannot change the look
and feel of the control interface – it can only be done by Cisco engineers.
Tvzilla: a Mozilla-based web browser. The main purpose of the browser is to
build the user interface for the DMP.
OSD Control Server: controls the On Screen Display (OSD) plane (for example,
users can dynamically change the alpha transparency value for any rectangle on
the OSD plane).
The current document describes the JavaScript-based API to each component mentioned
above. More details on the API can be found in the “API Calls” section of this document.
Cisco Systems Confidential Page 4 of 25
DMP JavaScript API
Video and Graphics Planes
Video and graphics in the device are displayed on different planes. All graphics are
displayed on the On Screen Display (OSD) plane. Graphics are 32 bits per pixel therefore
it is possible to use translucent graphics on the OSD plane (in this case you will see the
video plane through the OSD plane):
The OSD Plane starts at (0,0) and its height and width are set through the Web-based
interface (the default is 1366x768). The Video plane coordinates are different—there is
no (0,0) point, and its size depends on video resolution. But in general, the (2048,2048)
point corresponds to the middle of the screen, and the maximum screen size is
4096x4096.
Cisco Systems Confidential Page 5 of 25
DMP JavaScript API
TVzilla Preferences
Introduction
TVzilla is the DMP’s own built-in browser. There are certain parameters that should be
configured for the browser that are kept in a text file inside the DMP’s file system. This
section describes all of the preferences that a user can access and modify for full
customization of the browser.
TVzilla Specific Preferences
The TVzilla browser extends regular Firefox preferences by adding its own. TVzilla reads its
preferences at startup time from [Link] file from browser’s profile. Default browser profile path is
/tmp/browser in device’s file system. It is possible to change profile path with the help of -p
<path> command line parameter of browser binary.
Every line of preference file should be in the following format
user_pref ("preference_name", preference_value);
Currently the following preferences are used by TVzilla (default values are in
parenthesis):
[Link] _ Browser control port (5555).
[Link] _ If true control connections from localhost are allowed only (true).
[Link] _ Browser startup page URL (“about:blank”).
[Link] _ Turn on syslog. Browser uses syslog protocol (RFC 3164) to send
JavaScript Console messages and internal browser errors (false).
[Link] _ Syslog collector host. All syslog messages will be sent to this
host. You can use value “[Link]” to broadcast those messages. It is not a
standard behavior (see RFC 3164) but usually syslog servers support it
(“[Link]”).
[Link] _ Facility for all syslog messages. Possible values are “kernel”,
“user”, “mail”, “daemon”, “security”, “syslog”, “printer”, “news”, “uucp”, “clock”,
“security2”, “ftp”, “ntp”,
“log_audit”, “log_alert”, “clock2”, “local0”, .., “local7” (“local5”).
[Link] _ All syslog messages will be marked with this tag (prefix)
(“dmp_browser”).
[Link] _ Turn on and off syslog messages aggregation. Aggregation
allows to send log messages to collector by relatively big portions. As described by RFC
3164, the maximum size of syslog message is 1024 bytes. Usually messages are much
smaller. So, the system often sends a lot of small messages. To change the situation you
can use messages aggregation. Aggregation allows accumulation of several small
Cisco Systems Confidential Page 6 of 25
DMP JavaScript API
messages in a buffer and then sending them all as one sequence of syslog packets. Of
course, it is applicable only if immediate notification is not needed false).
[Link] _ Number of syslog records to keep in running system. This value
also limits the value of [Link] indirectly (256).
[Link] _ Size in bytes of aggregation buffer. Zero means no
aggregation will be used (2048).
[Link] _ Aggregation timeout in milliseconds. That means all
aggregated data will be sent in this amount of time after aggregation. Zero means no
timeout. This preference is also connected to [Link] preference
(300000).
[Link] _ Add some random delay in milliseconds between 0
and the value of this preference to aggregation timeout if the value of
[Link] is not zero (5000).
[Link].x _ Browser window horizontal position for new windows (01).
[Link].y _ Browser window vertical position for new windows (0).
[Link] _ Browser window width in pixels for new windows (720).
[Link] _ Browser window height in pixels for new window (480).
[Link] _ If true browser ignores other [Link].* parameters
and opens only full screen windows (true).
[Link] _ Single mode for browser. If this preference is true, only one
browser window is allowed. Popup blocking preferences will be ignored, i.e. all popups
will be blocked (false).
[Link] _ If false, browser windows are not resizable. Once opened they
will keep their sized until close. You also cannot change windows’ size from JavaScript
(false).
[Link] _ Background color for OSD message box (“#2f6681”).
[Link] _ Text color for OSD popup message box (“#efb525”).
[Link] _ Progress bar color for OSD popup message box
(“#83a2cf”).
[Link].x _ x-coordinate of upper left corner of the message box. If this
value is negative, the message box will be centered horizontally (-1).
[Link].y _ x-coordinate of upper left corner of the message box. If this
value is negative, it will be assumed to be screen height minus two heights of the
message box (-1).
[Link] _ Width of the message box. If this value is negative, the
message box
width will be a half of screen width (-1).
[Link] _ Height of the message box. If this value is negative, the
message box height will be a one seventh of screen height (150).
[Link] _ Timeout in milliseconds for OSD popup message box. After this
amount of time message box will disappear (3000).
1
Upper left corner of OSD plane has coordinates (0, 0).
Cisco Systems Confidential Page 7 of 25
DMP JavaScript API
[Link] _ Font size in points2 for OSD popup message box (32).
[Link] _ Turn on and off browser status bar (false).
[Link] _ Turn on and off browser progress bar (true).
[Link] _ Turn on and off browser progress bar auto mode. When auto
mode is on browser shows progress bar only during document loading (true).
[Link] _ Turn on and off browser spinner (true).
[Link] _ Turn on and off browser scroll bars (false).
[Link] _ Turn on and off failover mechanism (see section 2.1.2) (false).
[Link] _ Failover URL ("").
[Link] _ Final failover URL (”about:blank“);
[Link] _ Failover timeout in milliseconds (5000).
[Link] _ Failover tries number (3).
[Link] _ Recovery URL ("").
[Link] _ Recovery timeout in milliseconds (15000).
2
If the display is 72 dpi 1 point equals to 1 pixel
Cisco Systems Confidential Page 8 of 25
DMP JavaScript API
Mozilla Firefox Preferences
In addition, a user should set the following native Firefox preferences. The following are
standard settings, which can be changed according to the customer’s needs.
Font Settings
user_pref("[Link]", "sans-serif");
user_pref("[Link].x-western", "serif");
user_pref("[Link].x-western", "serif");
user_pref("[Link].x-western", "Fixed");
user_pref("[Link]-serif.x-western", "sans-serif");
user_pref("[Link].x-western", "serif");
user_pref("[Link]", 6);3
user_pref("[Link].use_document_fonts", 0);
user_pref("[Link]", true);
Security Settings
user_pref("[Link]", false);
user_pref("security.warn_entering_secure", false);
user_pref("security.warn_entering_weak", false);
user_pref("security.warn_leaving_secure", false);
user_pref("security.warn_submit_insecure", false);
user_pref("security.warn_viewing_mixed", false);
user_pref("[Link]", false);
user_pref("security.enable_java", false);
user_pref("security.ask_for_password", 0);
Same Origin Policy
TVzilla does not obey “the same origin policy”. Therefore if you want to load your
HTML documents with JavaScript scripts from any web server, you can use a built-in JS
library located in the [Link]
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]
gName",
"allAccess")
user_pref("[Link]",
"allAccess")
3
For the DMP4400 it is recommended to turn off antialiasing because if antialiasing is turned on, the
quality of the fonts deteriorates. That being the case, this user preference does not add any value
Cisco Systems Confidential Page 9 of 25
DMP JavaScript API
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]
ByTagName","allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]
te",
"allAccess")
user_pref("[Link]
Text",
"allAccess")
user_pref("[Link]
XML",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]
ng",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]",
"allAccess")
user_pref("[Link]", false)
Pop-up Settings
user_pref("[Link].first_popup", false)
user_pref("[Link].disable_from_plugins", 3)
user_pref("[Link].remove_blacklist", false)
user_pref("[Link]", false)
user_pref("dom.popup_maximum", 0)
user_pref("[Link]",
"allAccess")
Cisco Systems Confidential Page 10 of 25
DMP JavaScript API
user_pref("[Link]",
"allAccess")
Cache Directory
Memory cache is disabled in the last call
user_pref("[Link].parent_directory",
"/tmp/ftproot/usb_1/.tmp")
user_pref("[Link]",
"/tmp/ftproot/usb_1/.tmp")
user_pref("[Link]",
"/tmp/ftproot/usb_1/.tmp")
user_pref("[Link]",
"/tmp/ftproot/usb_1/.tmp")
user_pref("[Link]", false)
JavaScript APIs
Overview
The DMP can be controlled and customized by the tvMediaPlayer Javascript class. This
component provides the interface for the control of SysMng, the media player, the OSD
control server, remote control, and TVzilla itself.
To simplify usage of this component you should use [Link] –
within that library tvMediaPlayer JavaScript class instantiates an object from the
tvMediaPlayer XPCOM component and makes some other low level preparations.
Methods of tvMediaPlayer JavaScript class are described below in C-like format. Input
parameters are in Italics and parameters’ range in square brackets. In case of failure each
method returns an integer error code, or zero otherwise.
JavaScript Calls
Video-Related Calls
osdSetAlpha(unsigned int x, unsigned int y, unsigned int width, unsigned int
height, unsigned char alpha)- Sets alpha transparency value for the rectangular
area on the OSD plane.
setGeometry(unsigned int x, unsigned int y, unsigned int width, unsigned int
height) - Changes the output window for the movie playing. Movie will be scaled
Cisco Systems Confidential Page 11 of 25
DMP JavaScript API
to the desired size and the center of the movie rectangle will be placed to the (x,
y) point. Here x, y, width and height are in relative coordinates. The center of the
video plane has coordinates (2048, 2048).
setAbsoluteGeometry(nsIDOMWindow wnd, unsigned int x, unsigned int y,
unsigned int width, unsigned int height) - The same as the previous setGeometry
method, however coordinates are absolute – they are the same as in the OSD
plane.
setOutputElement(nsIDOMWindow wnd, nsIDOMNSHTMLElement element[,
unsigned char alpha]) - Calculates the absolute position and size of the DOM
element and changes the movie output window correspondingly. In addition it can
change alpha for that rectangle on the OSD plane.
setFullScreen() - Returns movie playback to full screen mode.
setAlphaForElement(nsIDOMWindow wnd, nsIDOMNSHTMLElement
element[, unsigned char alpha]) - Sets alpha transparency value for the specific
element. If no alpha is specified then set it to 0 .
play(string url) – Plays a movie.
stop() - Stops playing movie.
getDuration(Object duration) - Returns movie duration (in bytes for HTTP).
getPosition(Object position) - Returns movie playing position.
isPlaying(Object yes) - Returns 1 if movie is playing, 0 otherwise.
setRightVolume(unsigned int volume) - Sets volume for the right audio channel
[0–100].
setLeftVolume(unsigned int volume) - Sets volume for the left audio channel [0–
100].
setBrightness(unsigned int brightness) - Sets brightness [0-100].
setContrast(unsigned int contrast) - Sets contrast [0-100].
setSaturation(unsigned int saturation) - Sets saturation [0-100].
setTVStandard(unsigned int standard) - Sets TV standard. Standard should be
one of the predefined constants (see Appendix A for the list of valid standards’
values).
Cisco Systems Confidential Page 12 of 25
DMP JavaScript API
setConnector(unsigned int connector) - Sets connector. Connector should be one
of the predefined constants (see Appendix A for the list of valid connectors’
values).
setColorSpace(unsigned int colorSpace) - Sets color space. ColorSpace should be
one of the predefined constants (see Appendix A for the list of valid ColorSpace
values).
mibGet(string name, Object value) _ Get value of MIB property.
mibSet(string name, string value) _ Set value of MIB property.
Browser Calls
browserSetPref(string key, string value, unsigned int type) - Sets browser
preference.
browserGetPref(string key, string value) - Save browser preferences.
Debug Calls**
log(string msg ) 4- Sends a debug msg to the system log. This method does not
use values of [Link].* preferences. It always uses default settings. So, it is
always on and broadcasts the message to address [Link] with syslog
facility "local5".
Remote Control calls
There is no currently no javascript API for remote control calls ie., to redefine the
remote control keys. The way to do that is by making HTTP requests to manipulate
MIB data, ie. the data stored within the DMP
The following buttons are defined on the remote control for the DMP:
• POWER
• PLAY
• PAUSE
• STOP
• FAST_FORWARD
4
The log() api call has been found to not work on some platforms
Cisco Systems Confidential Page 13 of 25
DMP JavaScript API
• REWIND
• MUTE
• INPUT
• EXIT
• ENTER
• CHAN_UP
• CHAN_DOWN
• UP
• DOWN
• LEFT
• RIGHT
• VOLUME_UP
• VOLUME_DOWN
• MENU
• SHOW_IP
• RED
• GREEN
• YELLOW
• BLUE
Applications may need to mimic the key/button press events and redefine these remote
control buttons. The command to redefine a remote control button is as follows:-
ira add 1 <command> 1 <button_name> <action>
Where command may be one of the following:
xfake – to simulate a button press
sh - for internal shell.
The following prefixes are supported for sh
mn - internal (port 6666 mng command)
fg - regular unix shell command executed in foreground
bg - regular unix shell command executed in background
init - init service command. Currently only Volume up/down init commands are
implemented.
The value of <action> is explained below:
If xfake is selected, the action is a simple sending of a char value, e.g.:
ira add 1 xfake 1 PLAY a
Cisco Systems Confidential Page 14 of 25
DMP JavaScript API
ira add 1 xfake 1 MENU b
ira add 1 xfake 1 NUMBER_1 1
ira add 1 xfake 1 PAGE_UP Prior
ira add 1 xfake 1 PAGE_DOWN Next
In case of sh, action represents a command line interface, hence, action here is a
shell command, e.g.:
ira add 1 sh 1 SHOW_IP mn mng start showip 7000
In order to display messages and icons on the screen, the syntax is as follows:
ira add 1 sh 1 RED fg sendcmd [Link]:5555
“message{text=Key%20is%20not%20bound. icon=remote}"
The following icons are available:
• error
• contrast
• fwupgrade
• hwinfo
• brightness
• mute
• remote
• saturation
• volumechange
• warning
• information
For more details and examples of HTTP requests to redefine remote control keys
please refer to the “DMP MIB data” document
Notes:
* If id is omitted, then the operation will be applied to the last opened
window.
** Microsoft Windows users can greatly benefit from an application called
“Kiwi Syslog Daemon” – it will display debug and error messages in a user-friendly,
Cisco Systems Confidential Page 15 of 25
DMP JavaScript API
graphical manner (a freeware version can be downloaded from
[Link]
Cisco Systems Confidential Page 16 of 25
DMP JavaScript API
Appendix A. System Parameters
Parameter
Name Value=Value String Representation
TVStandard 0=Custom
1=CVT_640x480x50
2=CVT_640x480x60
3=CVT_640x480x75
4=CVT_640x480x85
5=CVT_800x600x50
6=CVT_800x600x60
7=CVT_800x600x75
8=CVT_800x600x85
9=CVT_1024x768x50
10=CVT_1024x768x60
11=CVT_1024x768x75
12=CVT_1024x768x85
13=CVT_1152x864x50
14=CVT_1152x864x60
15=CVT_1152x864x75
16=CVT_1152x864x85
17=CVT_1280x960x50
18=CVT_1280x960x60
19=CVT_1280x960x75
20=CVT_1280x960x85
21=CVT_1280x1024x50
22=CVT_1280x1024x60
23=CVT_1280x1024x75
24=CVT_1280x1024x85
25=CVT_1600x1200x50
26=CVT_1600x1200x60
27=SYABAS_848x480x60
28=DBL3_1952x1232
29=DBL3_1952x30
30=HDMI_640x480p59
31=HDMI_640x480p60
32=HDMI_480p59
33=HDMI_480p60
34=HDMI_720p59
35=HDMI_720p60
36=HDMI_1080i59
37=HDMI_1080i60
38=HDMI_480i59
39=HDMI_480i60
40=HDMI_720x240p59
Cisco Systems Confidential Page 17 of 25
DMP JavaScript API
41=HDMI_720x240p60
42=HDMI_2880x480i59
43=HDMI_2880x480i60
44=HDMI_2880x240p59
45=HDMI_2880x240p60
46=HDMI_1440x480p59
47=HDMI_1440x480p60
48=HDMI_1080p59
49=HDMI_1080p60
50=HDMI_576p50
51=HDMI_720p50
52=HDMI_1080i50
53=HDMI_576i50
54=HDMI_720x288p50
55=HDMI_2880x576i50
56=HDMI_2880x288p50
57=HDMI_1440x576p50
58=HDMI_1080p50
59=HDMI_1080p23
60=HDMI_1080p24
61=HDMI_1080p25
62=HDMI_1080p29
63=HDMI_1080p30
64=1080p60
65=1080p59
66=1080p50
67=1080i60
68=1080i59
69=1080i50
70=1080i48
71=1080i47
72=1080p30
73=1080p29
74=1080p25
75=1080p24
76=1080p23
77=1080i50_1250
78=1080p50_1250
79=720p60
80=720p59
81=720p50
82=720p30
83=720p29
84=720p25
85=720p24
86=720p23
87=NTSC_M_Japan
88=NTSC_M
Cisco Systems Confidential Page 18 of 25
DMP JavaScript API
89=PAL_60
90=PAL_M
91=480p59
92=NTSC_M_Japan_714
93=NTSC_M_714
94=PAL_60_714
95=PAL_M_714
96=480p59_714
97=PAL_BG
98=576p50
99=PAL_BG_702
100=576p50_702
101=VESA_640x350x85
102=VESA_640x400x85
103=VESA_720x400x85
104=VESA_640x480x60
105=VESA_640x480x72
106=VESA_640x480x75
107=VESA_640x480x85
108=VESA_848x480x60
109=VESA_800x600x56
110=VESA_800x600x60
111=VESA_800x600x72
112=VESA_800x600x75
113=VESA_800x600x85
114=VESA_1024x768x43
115=SYABAS_852x480x60
116=VESA_1024x768x60
117=VESA_1024x768x70
118=VESA_1024x768x75
119=VESA_1024x768x85
120=VESA_1152x864x75
121=VESA_1280x768x60RB
122=VESA_1280x768x60
123=VESA_1280x768x75
124=VESA_1280x768x85
125=VESA_1280x960x60
126=VESA_1280x960x85
127=VESA_1280x1024x60
128=VESA_1280x1024x75
129=VESA_1280x1024x85
130=VESA_1360x768x60
131=VESA_1400x1050x60RB
132=VESA_1400x1050x60
133=VESA_1400x1050x75
134=VESA_1400x1050x85
135=VESA_1600x1200x60
136=VESA_1920x1200x60RB
Cisco Systems Confidential Page 19 of 25
DMP JavaScript API
137=VESA_1920x1200x60
138=VESA_640x480i30
139=VESA_640x480i60
140=Apple_LCD_23_1920x1200x5994
141=Samsung_S50HWXD01_1366x768x50
142=Samsung_S50HWXD01_1366x768x5994
143=Samsung_S50HWXD01_1366x768x60
144=Samsung_S50HWXD02_1366x768x50
145=Samsung_S50HWXD02_1366x768x5994
146=Samsung_S50HWXD02_1366x768x60
147=Samsung_S50HWXD03_1366x768x50
148=Samsung_S50HWXD03_1366x768x5994
149=Samsung_S50HWXD03_1366x768x60
150=Samsung_S42AXXD02_1024x768x50
151=Samsung_S42AXXD02_1024x768x5994
152=Samsung_S42AXXD02_1024x768x60
153=Samsung_S42SDYD04_852x480x50
154=Samsung_S42SDYD04_852x480x5994
155=Samsung_S42SDYD04_852x480x60
156=Samsung_LTP400WQF01_480x272x5994
157=ChiMei_V296W1L01_1280x768x5994
158=ChiMei_V296W1L01_1280x768x60
159=ChiMei_V270W1L03_1280x720x5994
160=ChiMei_V270W1L03_1280x720x60
161=1280x768x60
162=LG_LC150X02_1024x768x50
163=LG_LC150X02_1024x768x5994
164=LG_LC150X02_1024x768x60
165=LG_LC150X02_1024x768x50L
166=LG_LC150X02_1024x768x60L
167=LG_LC150X02_1024x768x5994H
168=LG_LC150X02_1024x768x60H
169=LG_LC260W01_1280x768x60
170=LG_LCxx0W01_1366x768x60
171=LG_LC50X03_1366x768x50
172=LG_LC50X03_1366x768x5010
173=LG_LC50X03_1366x768x5994
174=LG_LC50X03_1366x768x5997
175=LG_LC50X03_1366x768x60
176=Fujitsu_Plasma_42_1024x1024xi50
177=Fujitsu_Plasma_42_1024x1024xi52
178=Fujitsu_Plasma_42_1024x1024xi5994
179=Fujitsu_Plasma_42_1024x1024xi60
180=Fujitsu_Plasma_42_1024x1024xi70
181=Casio_COM35H3125_320x240x50
182=Casio_COM35H3125_320x240x5994
183=Casio_COM35H3125_320x240x60
184=Casio_COM35H3125_320x240x70
Cisco Systems Confidential Page 20 of 25
DMP JavaScript API
185=InnoluxAT102TN01_800x480x60
186=AUOptronicsB104SN02_800x600x60
187=eLCOS_1920x1080x60
188=eLCOS_1920x1080x5994
189=Chunghwa_CLAA070VA01_800x480x60
190=Chunghwa_CLAA070VA01_800x480x5994
191=Chunghwa_CLAA070VA01_800x480x50
192=AUO_T315XW01V0_1366x768x5994
193=AUO_T315XW01V0_1366x768x60
194=720x480x60
Connector 0=COMPOSITE/SVIDEO
1=HDMI
6=COMPONENT
Color Space 1=None
2=RGB_16_235
3=RGB_0_255
4=YUV_601
5=YUV_709
Appendix B. Changes from DMP 43xx
TVzilla preferences in DMP 43xx are as follows:-
[Link] - Minimal browser window width in pixels. It is not possible to
set window width less than this value (50).
[Link] - Minimal browser window height in pixels. It is not possible
to set window height less than this value (50).
[Link] - Browser window width in pixels at startup (720).
[Link] - Browser window height in pixels at startup (480).
[Link].x - Browser window horizontal position at startup and for new windows
(0).
[Link].y - Browser window vertical position at startup and for new windows (0).
[Link] - Default text scale (1.0).
[Link] - TVzilla startup URL ([Link]
[Link] - Control TCP port number (5555).
Cisco Systems Confidential Page 21 of 25
DMP JavaScript API
Some additional APIs which existed in DMP 43xx are as follows. These APIs have been
removed as of DMP4400 (Yoda release)
osdLock() - Locks the OSD plane. Nothing will be drawn on the OSD plane until
osdUnlock() function is invoked. After unlocking, all previously drawn things
will be reflected on the OSD plane. Users can use this method to prevent OSD
from flickering when the device boots and graphical applications start.
osdUnlock() - Unlocks the OSD plane.
browserSetSize(unsigned int width, unsigned int height[, unsigned int id])* - Sets
browser window size.
browserSetPos(unsigned int x, unsigned int y[, unsigned int id]) - Sets browser
window position.
browserSetVisibility(unsigned int visible[, unsigned int id]) - Sets browser
visibility.
browserSetTextScale(float textScale[, unsigned int id]) - Sets text scale in the
browser window. To double text size use textScale=2; to decrease text size two
times use textScale=0.5, etc. To turn text off on the page use textScale=0.
browserLoadUrl(string url[, boolean newWindow][, unsigned int id]) - Loads
URL in browser window with id equals to id.
browserClose([unsigned int id]) - Closes browser window.
browserSavePrefs() - Save browser preferences.
browserPageRight() - Scrolls half of a page to the right in browser window.
browserPageLeft() - Scrolls half of a page to the left in browser window.
browserPageUp() - Scrolls half of a page up in browser window.
browserPageDown() - Scrolls half of a page down in browser window.
browserClick() - Emulates mouse click on the currently selected
browserKeyPress(string key) - Emulates key pressing on the currently selected
element
Cisco Systems Confidential Page 22 of 25
DMP JavaScript API
Appendix C. Sample Code
In the following sample, a scaled window will display looped video (playlist is over
HTTP stream). Change movieUrl variable and save the following code as [Link]
under some Web server directory (Apache server is recommended). Point your DMP to
the [Link] by using “Display Actions”->”URL To Be Displayed” dialogue from the
DMP-DM.
<html>
<head>
<script language="JavaScript"
src="[Link]
<script language="JavaScript">
var mediaPlayer; // MediaPlayer object.
var position = new Object(); // Current movie position.
var duration = new Object(); // Movie duration.
var active = new Object(); // Playing is in progress.
var movieTimeout = 3000; // Movie checking interval in
milliseconds.
var i = 0;
var timer = 0;
const STATUS_IDLE = 0;
const STATUS_STARTING = 1;
const STATUS_PLAYING = 2;
const TRIES_LIMIT = 10;
var status = STATUS_IDLE;
var tries = 0;
// Put your movie URLs here.
var playlist = new Array(
“[Link]
“[Link]
) ;
function init()
{
var el = [Link]("movie");
mediaPlayer = new tvMediaPlayer();
[Link](window, 0, 0, [Link],
[Link], 255);
if (el)
[Link](window, el, 0);
[Link](10);
[Link](10);
Cisco Systems Confidential Page 23 of 25
DMP JavaScript API
movie() ;
}
function destroy()
{
[Link]() ;
[Link]();
}
function nextItem()
{
[Link]() ;
[Link](playlist[i]) ;
status = STATUS_STARTING;
++i;
if (i >= [Link])
i = 0;
tries = 0;
}
function movie()
{
switch (status) {
case STATUS_IDLE:
nextItem();
break;
case STATUS_STARTING:
[Link](position);
[Link](duration);
[Link](active);
if( [Link]) {
status = STATUS_PLAYING;
tries = 0;
} else // The playback is not started yet.
if (++tries > TRIES_LIMIT)
status = STATUS_IDLE;
break;
case STATUS_PLAYING:
[Link](position);
[Link](duration);
[Link](active);
if ((! [Link] && [Link] > 0 && [Link]
> 0 && [Link] ==
[Link]) ||
(![Link] && [Link] == 0 && [Link] == 0
&& ++tries > TRIES_LIMIT)) {
Cisco Systems Confidential Page 24 of 25
DMP JavaScript API
status = STATUS_IDLE;
nextItem();
}
break;
}
if (timer)
[Link](timer);
timer = [Link]("movie();", movieTimeout);
}
</script>
<style>
body {
margin: 10px;
background--color: #FF6600;
}
#movie {
width: 480px;
height: 240px;
border--width: 2px;
border--style: ridge;
border--color: #efb525;
}
</style>
</head><body onload="init();" onunload="destroy();">
<div id="movie"></div>
</body>
</html>
Cisco Systems Confidential Page 25 of 25