Provides a way for authors to specify multiple alternative media resources for the video and audio elements.
![]() |
Syntax
<source src="videofile.mp4" type="video/mp4">
DOM Information
Inheritance Hierarchy
Members
The source object has these types of members:
Events
The source object has these events.
| Event | Description |
|---|---|
| abort |
Fires when the user aborts the download. |
| blur |
Fires when the object loses the input focus. |
| canplay |
Occurs when playback is possible, but would require further buffering. |
| canplaythrough |
Occurs when playback to end is possible without requiring a stop for further buffering. |
| change |
Fires when the contents of the object or selection have changed. |
| drag |
Fires on the source object continuously during a drag operation. |
| dragend |
Fires on the source object when the user releases the mouse at the close of a drag operation. |
| dragenter |
Fires on the target element when the user drags the object to a valid drop target. |
| dragleave |
Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. |
| dragover |
Fires on the target element continuously while the user drags the object over a valid drop target. |
| dragstart |
Fires on the source object when the user starts to drag a text selection or selected object. |
| drop |
Fires on the target object when the mouse button is released during a drag-and-drop operation. |
| durationchange |
Occurs when the duration attribute is updated. |
| emptied |
Occurs when the media element is reset to its initial state. |
| ended |
Occurs when the end of playback is reached. |
| error |
Fires when an error occurs during object loading. |
| focus |
Fires when the object receives focus. |
| focusin |
Fires for an element just prior to setting focus on that element. |
| focusout |
Fires for the current element with focus immediately after moving focus to another element. |
| input |
Occurs when the text content of an element is changed through the user interface. |
| keydown |
Fires when the user presses a key. |
| keypress |
Fires when the user presses an alphanumeric key. |
| load |
Fires immediately after the client loads the object. |
| loadeddata |
Occurs when media data is loaded at the current playback position. |
| loadedmetadata |
Occurs when the duration and dimensions of the media have been determined. |
| loadstart |
Occurs when Internet Explorer begins looking for media data. |
| mousedown |
Fires when the user clicks the object with either mouse button. |
| mousemove |
Fires when the user moves the mouse over the object. |
| mouseout |
Fires when the user moves the mouse pointer outside the boundaries of the object. |
| mouseover |
Fires when the user moves the mouse pointer into the object. |
| mouseup |
Fires when the user releases a mouse button while the mouse is over the object. |
| onkeyup |
Fires when the user releases a key. |
| onselect |
Fires when the current selection changes. |
| pause |
Occurs when playback is paused. |
| play |
Occurs when the play method is requested. |
| playing |
Occurs when the audio or video has started playing. |
| progress |
Occurs to indicate progress while downloading media data. |
| ratechange |
Occurs when the playback rate is increased or decreased. |
| readystatechange |
Fires when the state of the object has changed. |
| reset |
Fires when the user resets a form. |
| seeked |
Occurs when the seek operation ends. |
| seeking |
Occurs when the current playback position is moved. |
| stalled |
Occurs when the download has stopped. |
| suspend |
Occurs if the load operation has been intentionally halted. |
| timeupdate |
Occurs to indicate the current playback position. |
| volumechange |
Occurs when the volume is changed, or playback is muted or unmuted. |
| waiting |
Occurs when playback stops because the next frame of a video resource is not available. |
Methods
The source object has these methods.
| Method | Description |
|---|---|
| compareDocumentPosition |
Compares the position of two nodes in a document. |
| getAttributeNodeNS |
Gets an attribute object that matches the specified namespace and name. |
| getAttributeNS |
Gets the value of the specified attribute within the specified namespace. |
| getElementsByClassName |
Gets a collection of objects that are based on the value of the class attribute. |
| getElementsByTagNameNS |
Gets a collection of objects that are based on the specified element names within a specified namespace. |
| hasAttributeNS |
Determines whether an attribute that has the specified namespace and name exists. |
| isDefaultNamespace |
Indicates whether or not a namespace is the default namespace for a document. |
| isEqualNode |
Determines if two nodes are equal. |
| isSameNode |
Determines if two node references refer to the same node. |
| isSupported |
Returns a value indicating whether or not the object supports a specific DOM standard. |
| lookupNamespaceURI |
Gets the URI of the namespace associated with a namespace prefix, if any. |
| lookupPrefix |
Gets the namespace prefix associated with a URI, if any. |
| msMatchesSelector |
Determines whether an object matches the specified selector. |
| removeAttributeNS |
Removes the specified attribute from the object. |
| setAttributeNodeNS |
Sets an attribute object as part of the object. |
| setAttributeNS |
Sets the value of the specified attribute within the specified namespace. |
Properties
The source object has these properties.
| Property | Description |
|---|---|
|
Retrieves the local name of the fully qualified XML declaration for a node. | |
|
Gets or sets the intended media type of the media source. | |
|
Retrieves the namespace URI of the fully qualified XML declaration for a node. | |
|
Retrieves the local name of the fully qualified XML declaration for a node. | |
|
The address or URL of the a media resource (video, audio) that is to be considered. | |
|
Sets or retrieves the text content of an object and any child objects. | |
|
Gets or sets the MIME type of a media resource. |
Standards information
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.8.8
Remarks
Note If you change the media file using the src property on an audio or video object, you need to call the load method before calling the play method. If you change the src and call the play() method without loading first, it will continue to play the file specified by the source element.
See also
Build date: 11/28/2012
