JSAPI Widget

From DevWiki

Jump to: navigation, search

< JavaScript API

Widget Object

The widget object allows you to specify which object on a given url should be used for playback. You can also used this object to do specific actions to the widget itself, such as simulate clicks on the player. To return a valid widget object, use boxee.getActiveWidget() or boxee.getWidgets()
See Boxee Object for details.


getZIndex
getZIndex -> Number
Returns the current Z-Index for the given widget
zindex = widget.GetZIndex();


isVisible
isVisible() -> Boolean
Return 'true' if the given widget is visible on the page.
This is an internal method from Mozilla and not very reliable.
if ( widget.isVisible() ) { ... }


isActive
isActive() -> Boolean
Return 'true' if the given widget is the active widget.
if ( widget.isVisible() ) { ... }


isFullScreen
isFullScreen() -> Boolean
Return 'true' if the given widget is fullscreen.
if ( widget.fullscreen() ) { ... }


setActive
setActive()
Sets the given widget to the active widget to be used for playback
widget.SetActive();
setCrop
setCrop(int, int, int, int)
Defines the crop used on the activeWidget. Use left, top, right, bottom
widget.setCrop(10, 40, 10, 40)


setUseRealWindow


mouseDown
mouseDown()
Simulates the mouse wheel being scrolled down one notch on the active widget.
widget.mouseDown();


mouseUp
mouseUp()
Simulates the mouse wheel being scrolled up one notch on the active widget.
widget.mouseUp();


click
click(int x, int y)
Clicks at (x,y) on the activeWidget.
Dimensions for X/Y are based on the size of the widget, not the browser page.
widget.click(40, 200);


resize


mouseMove
mouseMove(int x, int y)
Move the mouse to the specified (x,y) coordinates.
Dimensions for X/Y are based on the size of the widget, not the browser page.
widget.mouseMove(40, 200);


hasAttribute
hasAttribute(string) -> Boolean
Return 'true' if the activeWidget (object) contains the specified attribute tag.
if ( widget.hasAttribute('flashvars') ) { ... }


getAttribute
getAttribute(string) -> String
Returns the specified attribute tag for the activeWidget (object).
fvars = widget.getAttribute('flashvars');


getTagName


getPixel
getPixel(int x, int y) -> String
Used to identify an RGB color code from the specified (x,y) coordinates on the activeWidget (object).
function R(p) { return (p & 0x00ff0000) >> 16; }
function G(p) { return (p & 0x0000ff00) >> 8; }
function B(p) { return (p & 0x000000ff) ; }
if(( B(p) < 100 ) && ( G(p) < 100 ) && ( R(p) < 100 )) { ... }
Personal tools