dojox/av/FLVideo (version 1.10)

dijit/_Widget, dojox/av/_Media

Summary

Inserts a Flash FLV video into the HTML page and provides methods and events for controlling the video. Also plays the H264/M4V codec with a little trickery: change the '.M4V' extension to '.flv'.

Usage

var foo = new FLVideo(options);
dojox/av/FLVideo
Parameter Type Description
options Object

See the dojox/av/FLVideo reference documentation for more information.

Examples

Example 1

markup:

<div id="vid" initialVolume=".7",
    mediaUrl="../resources/Grog.flv"
    dojoType="dojox.av.FLVideo"></div>

Example 2

programmatic:

new dojox.av.FLVideo({
    initialVolume:.7,
    mediaUrl:"../resources/Grog.flv"
}, "vid");

Property Summary

  • _attrPairNames
  • _blankGifPath to a blank 1x1 image.
  • _flashObjectThe dojox.embed object
  • _focusManager
  • _setClassAttr
  • _setDirAttr
  • _setIdAttr
  • _setLangAttr
  • _setTypeAttr
  • _startedstartup() has completed.
  • _swfPathThe path to the video player SWF resource
  • allowFullScreenWhether to allow the SWF to go to fullscreen
  • allowNetworkingWhether SWF is restricted to a domain
  • allowScriptAccessWhether the SWF can access the container JS
  • attributeMapDeprecated.
  • autoPlayWhether the video automatically plays on load or not.
  • baseClassRoot CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate widget state.
  • bufferTimeTime in milliseconds that the video should be loaded before it will play.
  • class
  • containerNodeDesignates where children of the source DOM node will be placed. &quot;Children&quot; in this case refers to both DOM nodes and widgets.
  • dirBi-directional support, as defined by the HTML DIR attribute.
  • domNodeThis is our visible representation of the widget!
  • flashMediaThe SWF object.
  • focusedThis widget or a widget it contains has focus, or is &quot;active&quot; because it was recently clicked.
  • idA unique, opaque ID string that can be assigned by users or by the system.
  • initialVolumeThe initial volume setting of the player.
  • isDebugSetting to true tells the SWF to output log messages to Firebug.
  • langRarely used.
  • mediaUrl
  • minBufferTimeTime in milliseconds between the playhead time and loaded time that will trigger the buffer.
  • ownerDocumentThe document this widget belongs to.
  • percentDownloadedThe percentage the media has downloaded; from 0-100
  • srcNodeRefpointer to original DOM node
  • styleHTML style attributes as cssText string or name/value hash
  • titleHTML title attribute.
  • tooltipWhen this widget&#39;s title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.
  • updateTimeHow often, in milliseconds to get an update of the video position.
  • wmodeThe render type of the SWF

Method Summary

  • _applyAttributes() Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.
  • _attrToDom(attr,value,commands) Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter.
  • _changeAttrValue(name,value) Internal helper for directly changing an attribute value.
  • _checkBuffer(time,bufferLength) Checks that there is a proper buffer time between current playhead time and the amount of data loaded.
  • _eventFactory() Creates a generic event object.
  • _figureStatus() Calculate media status, based on playhead movement, and onStop and onStart events
  • _get(name) Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters.
  • _getAttrNames(name) Helper function for get() and set().
  • _initStatus() Connect mediaStatus to the media.
  • _introspect() Collect metadata about this widget (only once per class, not once per instance): - list of attributes with custom setters, storing in this.constructor._setterAttrs - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • _normalizeUrl(_url) Checks that path is relative to HTML file or converts it to an absolute path.
  • _normalizeVolume(vol) Ensures volume is less than one
  • _set(name,value) Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.
  • _setFocusedAttr(val)
  • _setOwnerDocumentAttr(val)
  • _setStyleAttr(value) Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string
  • _sub(topic,method) helper for subscribing to topics
  • _update() Helper function to fire onPosition, check download progress, and check buffer.
  • attr(name,value) This method is deprecated, use get() or set() directly.
  • buildRendering() Construct the UI for this widget, setting this.domNode.
  • connect(obj,event,method) Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
  • create(params,srcNodeRef) Kick off the life-cycle of a widget
  • defer(fcn,delay) Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed.
  • destroy()
  • destroyDescendants(preserveDom) Recursively destroy the children of this widget and their descendants.
  • destroyRecursive(preserveDom) Destroy this widget and its descendants
  • destroyRendering(preserveDom) Destroys the DOM nodes associated with this widget.
  • disconnect(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • emit(type,eventObj,callbackArgs) Used by widgets to signal that a synthetic event occurred, ex: myWidget.emit("attrmodified-selectedChildWidget", {}).
  • get(name) Get a property from a widget.
  • getChildren() Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget.
  • getDescendants() Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
  • getParent() Returns the parent widget of this widget.
  • getTime() Returns the current time of the video
  • isFocusable() Return true if this widget can currently be focused and false if not
  • isLeftToRight() Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
  • on(type,func)
  • own() Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
  • pause() Pauses the video
  • placeAt(reference,position) Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.
  • play(newUrl) Plays the video.
  • postCreate() Initialize the media.
  • postMixInProperties() Called after the parameters to the widget have been read-in, but before the widget template is instantiated.
  • postscript(params,srcNodeRef) Kicks off widget instantiation.
  • seek(time) Goes to the time passed in the argument
  • set(name,value) Set a property on a widget
  • setAttribute(attr,value) Deprecated.
  • startup() Processing after the DOM fragment is added to the document
  • subscribe(t,method) Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
  • toString() Returns a string that represents the widget.
  • uninitialize() Deprecated.
  • unsubscribe(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • volume(vol) Sets the volume of the video to the time in the
  • watch(name,callback) Watches a property for changes

Event Summary

  • _onBlur() This is where widgets do processing for when they stop being active, such as changing CSS classes.
  • _onFocus() This is where widgets do processing for when they are active, such as changing CSS classes.
  • _onMap(type) Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove").
  • _onShow() Internal method called when this widget is made visible.
  • onBlur() Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.
  • onBuffer(isBuffering) Fires a boolean to tell if media is paused for buffering or if buffering has finished
  • onClick(evt) Fires when the player is clicked Could be used to toggle play/pause, or do an external activity, like opening a new window.
  • onClose() Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden.
  • onDblClick(event) Connect to this function to receive notifications of mouse double click events.
  • onDownloaded(percent) Fires the amount of that the media has been downloaded.
  • onEnd(data) Fires when video ends Could be used to change pause button to play or show a post video graphic, like YouTube
  • onError(data,url) Fired when the player encounters an error
  • onFocus() Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.
  • onHide() Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.
  • onKeyDown(event) Connect to this function to receive notifications of keys being pressed down.
  • onKeyPress(event) Connect to this function to receive notifications of printable keys being typed.
  • onKeyUp(event) Connect to this function to receive notifications of keys being released.
  • onLoad(mov) Fired when the SWF player has loaded NOT when the video has loaded
  • onMetaData(data,evt) The video properties.
  • onMouseDown(event) Connect to this function to receive notifications of when the mouse button is pressed down.
  • onMouseEnter(event) Connect to this function to receive notifications of when the mouse moves onto this widget.
  • onMouseLeave(event) Connect to this function to receive notifications of when the mouse moves off of this widget.
  • onMouseMove(event) Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
  • onMouseOut(event) Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
  • onMouseOver(event) Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
  • onMouseUp(event) Connect to this function to receive notifications of when the mouse button is released.
  • onPause(data) Fires when the pause button is clicked
  • onPlay(data) Fires when video starts and resumes
  • onPlayerStatus(data) The status of the video from the SWF playing, stopped, bufering, etc.
  • onPosition(time) The position of the playhead in seconds
  • onResize() Fired on page resize
  • onShow() Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.
  • onStart(data) Fires when video starts Good for setting the play button to pause during an autoPlay for example
  • onStatus(data) Simple status
  • onStop() Fire when the Stop button is clicked
  • onSwfSized(data) Fired on SWF resize, or when its toggled between fullscreen.

Properties

_attrPairNames
Defined by: dijit/_WidgetBase
_blankGif
Defined by: dijit/_WidgetBase

Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

_flashObject
Defined by: dojox/av/_Media

The dojox.embed object

_focusManager
Defined by: dijit/_FocusMixin
_setClassAttr
Defined by: dijit/_WidgetBase
_setDirAttr
Defined by: dijit/_WidgetBase
_setIdAttr
Defined by: dijit/_WidgetBase
_setLangAttr
Defined by: dijit/_WidgetBase
_setTypeAttr
Defined by: dijit/_WidgetBase
_started
Defined by: dijit/_WidgetBase

startup() has completed.

_swfPath
Defined by: dojox/av/FLVideo

The path to the video player SWF resource

allowFullScreen
Defined by: dojox/av/_Media

Whether to allow the SWF to go to fullscreen

allowNetworking
Defined by: dojox/av/_Media

Whether SWF is restricted to a domain

allowScriptAccess
Defined by: dojox/av/_Media

Whether the SWF can access the container JS

attributeMap
Defined by: dijit/_WidgetBase

Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

  • DOM node attribute

    focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

  • DOM node innerHTML

    title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

  • DOM node innerText

    title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

  • DOM node CSS class

    myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

If the value is an array, then each element in the array matches one of the formats of the above list.

There are also some shorthands for backwards compatibility:

  • string --> { node: string, type: "attribute" }, for example:
"focusNode" ---> { node: "focusNode", type: "attribute" }
  • "" --> { node: "domNode", type: "attribute" }
autoPlay
Defined by: dojox/av/_Media

Whether the video automatically plays on load or not.

baseClass
Defined by: dijit/_WidgetBase

Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate widget state.

bufferTime
Defined by: dojox/av/_Media

Time in milliseconds that the video should be loaded before it will play. May pause and resume to build up buffer. Prevents stuttering.

Note: Older FLVs, without a duration, cannot be buffered.

class
Defined by: dijit/_WidgetBase
containerNode
Defined by: dijit/_WidgetBase

Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

<div data-dojo-type=myWidget>
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>
</div>

containerNode would point to:

<b> here's a plain DOM node
<span data-dojo-type=subWidget>and a widget</span>
<i> and another plain DOM node </i>

In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

dir
Defined by: dijit/_WidgetBase

Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

domNode
Defined by: dijit/_WidgetBase

This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

flashMedia
Defined by: dojox/av/_Media

The SWF object. Methods are passed to this.

focused
Defined by: dijit/_FocusMixin

This widget or a widget it contains has focus, or is "active" because it was recently clicked.

id
Defined by: dijit/_WidgetBase

A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

initialVolume
Defined by: dojox/av/_Media

The initial volume setting of the player. Acccepts between 0 and 1.

isDebug
Defined by: dojox/av/_Media

Setting to true tells the SWF to output log messages to Firebug.

lang
Defined by: dijit/_WidgetBase

Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

mediaUrl
Defined by: dojox/av/_Media
minBufferTime
Defined by: dojox/av/_Media

Time in milliseconds between the playhead time and loaded time that will trigger the buffer. When buffer is triggered, video will pause until the bufferTime amount is buffered. Note: Should be a small number, greater than zero.

ownerDocument
Defined by: dijit/_WidgetBase

The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

percentDownloaded
Defined by: dojox/av/_Media

The percentage the media has downloaded; from 0-100

srcNodeRef
Defined by: dijit/_WidgetBase

pointer to original DOM node

style
Defined by: dijit/_WidgetBase

HTML style attributes as cssText string or name/value hash

title
Defined by: dijit/_WidgetBase

HTML title attribute.

For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

tooltip
Defined by: dijit/_WidgetBase

When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

updateTime
Defined by: dojox/av/_Media

How often, in milliseconds to get an update of the video position.

wmode
Defined by: dojox/av/_Media

The render type of the SWF

Methods

_applyAttributes()
Defined by dijit/_WidgetBase

Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

_attrToDom(attr,value,commands)
Defined by dijit/_WidgetBase

Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

Parameter Type Description
attr String

Name of member variable (ex: "focusNode" maps to this.focusNode) pointing to DOMNode inside the widget, or alternately pointing to a subwidget

value String
commands Object
Optional
_changeAttrValue(name,value)
Defined by dojo/Stateful

Internal helper for directly changing an attribute value.

Directly change the value of an attribute on an object, bypassing any accessor setter. Also handles the calling of watch and emitting events. It is designed to be used by descendant class when there are two values of attributes that are linked, but calling .set() is not appropriate.

Parameter Type Description
name String

The property to set.

value Mixed

The value to set in the property.

Returns:function

Internal helper for directly changing an attribute value.

_checkBuffer(time,bufferLength)
Defined by dojox/av/FLVideo

Checks that there is a proper buffer time between current playhead time and the amount of data loaded. Works only on FLVs with a duration (not older). Pauses the video while continuing download.

Parameter Type Description
time Float
bufferLength Float
_eventFactory()
Defined by dojox/av/_Media

Creates a generic event object.

Returns:object
_figureStatus()
Defined by dojox/av/_Media

Calculate media status, based on playhead movement, and onStop and onStart events

_get(name)
Defined by dijit/_WidgetBase

Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

For example, CheckBox._getValueAttr() calls this._get("value").

Parameter Type Description
name String
Returns:undefined
_getAttrNames(name)
Defined by dijit/_WidgetBase

Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

Parameter Type Description
name undefined
Returns:undefined | object
_initStatus()
Defined by dojox/av/_Media

Connect mediaStatus to the media.

_introspect()
Defined by dijit/_WidgetBase

Collect metadata about this widget (only once per class, not once per instance):

- list of attributes with custom setters, storing in this.constructor._setterAttrs
- generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
_normalizeUrl(_url)
Defined by dojox/av/_Media

Checks that path is relative to HTML file or converts it to an absolute path.

Parameter Type Description
_url undefined
Returns:string
_normalizeVolume(vol)
Defined by dojox/av/_Media

Ensures volume is less than one

Parameter Type Description
vol number
Returns:number
_set(name,value)
Defined by dijit/_WidgetBase

Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

Parameter Type Description
name String
value anything
_setFocusedAttr(val)
Defined by dijit/_Widget
Parameter Type Description
val undefined
_setOwnerDocumentAttr(val)
Defined by dijit/_WidgetBase
Parameter Type Description
val undefined
_setStyleAttr(value)
Defined by dijit/_WidgetBase

Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

Determines which node to set the style on based on style setting in attributeMap.

Parameter Type Description
value String | Object
_sub(topic,method)
Defined by dojox/av/_Media

helper for subscribing to topics

Parameter Type Description
topic undefined
method undefined
_update()
Defined by dojox/av/FLVideo

Helper function to fire onPosition, check download progress, and check buffer.

attr(name,value)
Defined by dijit/_Widget

This method is deprecated, use get() or set() directly.

Parameter Type Description
name String | Object

The property to get or set. If an object is passed here and not a string, its keys are used as names of attributes to be set and the value of the object as values to set in the widget.

value Object
Optional

Optional. If provided, attr() operates as a setter. If omitted, the current value of the named property is returned.

Returns:undefined
buildRendering()
Defined by dijit/_WidgetBase

Construct the UI for this widget, setting this.domNode. Most widgets will mixin dijit._TemplatedMixin, which implements this method.

connect(obj,event,method)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

Parameter Type Description
obj Object | null
event String | Function
method String | Function
Returns:any | undefined

A handle that can be passed to disconnect in order to disconnect before the widget is destroyed.

Examples

Example 1

var btn = new Button();
// when foo.bar() is called, call the listener we're going to
// provide in the scope of btn
btn.connect(foo, "bar", function(){
    console.debug(this.toString());
});
create(params,srcNodeRef)
Defined by dijit/_WidgetBase

Kick off the life-cycle of a widget

Create calls a number of widget methods (postMixInProperties, buildRendering, postCreate, etc.), some of which of you'll want to override. See http://dojotoolkit.org/reference-guide/dijit/_WidgetBase.html for a discussion of the widget creation lifecycle.

Of course, adventurous developers could override create entirely, but this should only be done as a last resort.

Parameter Type Description
params Object | null

Hash of initialization parameters for widget, including scalar values (like title, duration etc.) and functions, typically callbacks like onClick. The hash can contain any of the widget's properties, excluding read-only properties.

srcNodeRef DOMNode | String
Optional

If a srcNodeRef (DOM node) is specified:

  • use srcNodeRef.innerHTML as my contents
  • if this is a behavioral widget then apply behavior to that srcNodeRef
  • otherwise, replace srcNodeRef with my generated DOM tree
defer(fcn,delay)
Defined by dijit/_WidgetBase

Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

Parameter Type Description
fcn Function

Function reference.

delay Number
Optional

Delay, defaults to 0.

Returns:object
destroy()
Defined by dojox/av/FLVideo
destroyDescendants(preserveDom)
Defined by dijit/_WidgetBase

Recursively destroy the children of this widget and their descendants.

Parameter Type Description
preserveDom Boolean
Optional

If true, the preserveDom attribute is passed to all descendant widget's .destroy() method. Not for use with _Templated widgets.

destroyRecursive(preserveDom)
Defined by dijit/_WidgetBase

Destroy this widget and its descendants

This is the generic "destructor" function that all widget users should call to cleanly discard with a widget. Once a widget is destroyed, it is removed from the manager object.

Parameter Type Description
preserveDom Boolean
Optional

If true, this method will leave the original DOM structure alone of descendant Widgets. Note: This will NOT work with dijit._TemplatedMixin widgets.

destroyRendering(preserveDom)
Defined by dijit/_WidgetBase

Destroys the DOM nodes associated with this widget.

Parameter Type Description
preserveDom Boolean
Optional

If true, this method will leave the original DOM structure alone during tear-down. Note: this will not work with _Templated widgets yet.

disconnect(handle)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use handle.remove() instead.

Disconnects handle created by connect.

Parameter Type Description
handle undefined
emit(type,eventObj,callbackArgs)
Defined by dijit/_WidgetBase

Used by widgets to signal that a synthetic event occurred, ex:

myWidget.emit("attrmodified-selectedChildWidget", {}).

Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

Parameter Type Description
type String
eventObj Object
Optional
callbackArgs Array
Optional
Returns:undefined
get(name)
Defined by dijit/_WidgetBase

Get a property from a widget.

Get a named property from a widget. The property may potentially be retrieved via a getter method. If no getter is defined, this just retrieves the object's property.

For example, if the widget has properties foo and bar and a method named _getFooAttr(), calling: myWidget.get("foo") would be equivalent to calling widget._getFooAttr() and myWidget.get("bar") would be equivalent to the expression widget.bar2

Parameter Type Description
name undefined

The property to get.

Returns:undefined
getChildren()
Defined by dijit/_WidgetBase

Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

Returns:Array
getDescendants()
Defined by dijit/_Widget

Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

Returns:Array
getParent()
Defined by dijit/_WidgetBase

Returns the parent widget of this widget.

Returns:undefined
getTime()
Defined by dojox/av/_Media

Returns the current time of the video

Returns:undefined
isFocusable()
Defined by dijit/_WidgetBase

Return true if this widget can currently be focused and false if not

Returns:undefined
isLeftToRight()
Defined by dijit/_WidgetBase

Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

Returns:undefined
on(type,func)
Defined by dijit/_Widget
Parameter Type Description
type String | Function

protected

func Function
Returns:undefined
own()
Defined by dijit/Destroyable

Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

Returns:any | undefined

The array of specified handles, so you can do for example:

var handle = this.own(on(...))[0];
pause()
Defined by dojox/av/FLVideo

Pauses the video

placeAt(reference,position)
Defined by dijit/_WidgetBase

Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

A convenience function provided in all _Widgets, providing a simple shorthand mechanism to put an existing (or newly created) Widget somewhere in the dom, and allow chaining.

Parameter Type Description
reference String | DomNode | DocumentFragment | dijit/_WidgetBase

Widget, DOMNode, DocumentFragment, or id of widget or DOMNode

position String | Int
Optional

If reference is a widget (or id of widget), and that widget has an ".addChild" method, it will be called passing this widget instance into that method, supplying the optional position index passed. In this case position (if specified) should be an integer.

If reference is a DOMNode (or id matching a DOMNode but not a widget), the position argument can be a numeric index or a string "first", "last", "before", or "after", same as dojo/dom-construct::place().

Returns:dijit/_WidgetBase | function

Provides a useful return of the newly created dijit._Widget instance so you can "chain" this function by instantiating, placing, then saving the return value to a variable.

Examples

Example 1

// create a Button with no srcNodeRef, and place it in the body:
var button = new Button({ label:"click" }).placeAt(win.body());
// now, 'button' is still the widget reference to the newly created button
button.on("click", function(e){ console.log('click'); }));

Example 2

// create a button out of a node with id="src" and append it to id="wrapper":
var button = new Button({},"src").placeAt("wrapper");

Example 3

// place a new button as the first element of some div
var button = new Button({ label:"click" }).placeAt("wrapper","first");

Example 4

// create a contentpane and add it to a TabContainer
var tc = dijit.byId("myTabs");
new ContentPane({ href:"foo.html", title:"Wow!" }).placeAt(tc)
play(newUrl)
Defined by dojox/av/FLVideo

Plays the video. If an url is passed in, plays the new link.

Parameter Type Description
newUrl String
Optional
postCreate()
Defined by dojox/av/FLVideo

Initialize the media.

postMixInProperties()
Defined by dijit/_WidgetBase

Called after the parameters to the widget have been read-in, but before the widget template is instantiated. Especially useful to set properties that are referenced in the widget template.

postscript(params,srcNodeRef)
Defined by dijit/_WidgetBase

Kicks off widget instantiation. See create() for details.

Parameter Type Description
params Object
Optional
srcNodeRef DomNode | String
seek(time)
Defined by dojox/av/FLVideo

Goes to the time passed in the argument

Parameter Type Description
time Float
set(name,value)
Defined by dijit/_WidgetBase

Set a property on a widget

Sets named properties on a widget which may potentially be handled by a setter in the widget.

For example, if the widget has properties foo and bar and a method named _setFooAttr(), calling myWidget.set("foo", "Howdy!") would be equivalent to calling widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) would be equivalent to the statement widget.bar = 3;

set() may also be called with a hash of name/value pairs, ex:

myWidget.set({
    foo: "Howdy",
    bar: 3
});

This is equivalent to calling set(foo, "Howdy") and set(bar, 3)

Parameter Type Description
name undefined

The property to set.

value undefined

The value to set in the property.

Returns:function | string

Set a property on a widget

setAttribute(attr,value)
Defined by dijit/_Widget

Deprecated. Use set() instead.

Parameter Type Description
attr String
value anything
startup()
Defined by dijit/_WidgetBase

Processing after the DOM fragment is added to the document

Called after a widget and its children have been created and added to the page, and all related widgets have finished their create() cycle, up through postCreate().

Note that startup() may be called while the widget is still hidden, for example if the widget is inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. For widgets that need to do layout, it's best to put that layout code inside resize(), and then extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible.

subscribe(t,method)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

Parameter Type Description
t String

The topic

method Function

The callback

Returns:undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
toString()
Defined by dijit/_WidgetBase

Returns a string that represents the widget.

When a widget is cast to a string, this method will be used to generate the output. Currently, it does not implement any sort of reversible serialization.

Returns:string
uninitialize()
Defined by dijit/_WidgetBase

Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

Returns:boolean
unsubscribe(handle)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use handle.remove() instead.

Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

Parameter Type Description
handle Object
volume(vol)
Defined by dojox/av/FLVideo

Sets the volume of the video to the time in the

Parameter Type Description
vol Float

between 0 - 1.

Returns:undefined
watch(name,callback)
Defined by dojo/Stateful

Watches a property for changes

Parameter Type Description
name String
Optional

Indicates the property to watch. This is optional (the callback may be the only parameter), and if omitted, all the properties will be watched

callback Function

The function to execute when the property changes. This will be called after the property has been changed. The callback will be called with the |this| set to the instance, the first argument as the name of the property, the second argument as the old value and the third argument as the new value.

Returns:any | object

An object handle for the watch. The unwatch method of this object can be used to discontinue watching this property:

var watchHandle = obj.watch("foo", callback);
watchHandle.unwatch(); // callback won't be called now

Events

_onBlur()
Defined by: dijit/_FocusMixin

This is where widgets do processing for when they stop being active, such as changing CSS classes. See onBlur() for more details.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onFocus()
Defined by: dijit/_FocusMixin

This is where widgets do processing for when they are active, such as changing CSS classes. See onFocus() for more details.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onMap(type)
Defined by: dijit/_WidgetBase

Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

Parameter Type Description
type String | Function
Returns:undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onShow()
Defined by: dijit/_Widget

Internal method called when this widget is made visible. See onShow for details.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onBlur()
Defined by: dijit/_FocusMixin

Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onBuffer(isBuffering)
Defined by: dojox/av/FLVideo

Fires a boolean to tell if media is paused for buffering or if buffering has finished

Parameter Type Description
isBuffering undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onClick(evt)
Defined by: dojox/av/FLVideo

Fires when the player is clicked Could be used to toggle play/pause, or do an external activity, like opening a new window.

Parameter Type Description
evt undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onClose()
Defined by: dijit/_Widget

Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

Returns:boolean

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onDblClick(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of mouse double click events.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onDownloaded(percent)
Defined by: dojox/av/FLVideo

Fires the amount of that the media has been downloaded. Number, 0-100

Parameter Type Description
percent undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onEnd(data)
Defined by: dojox/av/FLVideo

Fires when video ends Could be used to change pause button to play or show a post video graphic, like YouTube

Parameter Type Description
data undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onError(data,url)
Defined by: dojox/av/FLVideo

Fired when the player encounters an error

Parameter Type Description
data undefined
url undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onFocus()
Defined by: dijit/_FocusMixin

Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onHide()
Defined by: dijit/_Widget

Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onKeyDown(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of keys being pressed down.

Parameter Type Description
event undefined

key Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onKeyPress(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of printable keys being typed.

Parameter Type Description
event undefined

key Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onKeyUp(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of keys being released.

Parameter Type Description
event undefined

key Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onLoad(mov)
Defined by: dojox/av/FLVideo

Fired when the SWF player has loaded NOT when the video has loaded

Parameter Type Description
mov undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMetaData(data,evt)
Defined by: dojox/av/FLVideo

The video properties. Width, height, duration, etc.

NOTE: if data is empty, this is an older FLV with no meta data. Duration cannot be determined. In original FLVs, duration could only be obtained with Flash Media Server.

NOTE: Older FLVs can still return width and height and will do so on a second event call

Parameter Type Description
data undefined
evt undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseDown(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse button is pressed down.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseEnter(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves onto this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseLeave(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves off of this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseMove(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseOut(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseOver(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onMouseUp(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse button is released.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onPause(data)
Defined by: dojox/av/FLVideo

Fires when the pause button is clicked

Parameter Type Description
data undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onPlay(data)
Defined by: dojox/av/FLVideo

Fires when video starts and resumes

Parameter Type Description
data undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onPlayerStatus(data)
Defined by: dojox/av/FLVideo

The status of the video from the SWF playing, stopped, bufering, etc.

Parameter Type Description
data undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onPosition(time)
Defined by: dojox/av/FLVideo

The position of the playhead in seconds

Parameter Type Description
time undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onResize()
Defined by: dojox/av/FLVideo

Fired on page resize

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onShow()
Defined by: dijit/_Widget

Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onStart(data)
Defined by: dojox/av/FLVideo

Fires when video starts Good for setting the play button to pause during an autoPlay for example

Parameter Type Description
data undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onStatus(data)
Defined by: dojox/av/FLVideo

Simple status

Parameter Type Description
data undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onStop()
Defined by: dojox/av/FLVideo

Fire when the Stop button is clicked

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
onSwfSized(data)
Defined by: dojox/av/FLVideo

Fired on SWF resize, or when its toggled between fullscreen.

Parameter Type Description
data undefined

Examples

Example 1

console.warn("ERROR-"+data.type.toUpperCase()+":",
      data.info.code, " - URL:", url);
Error in the documentation? Can’t find what you are looking for? Let us know!