mediaBar Behavior | Internet Development Index |
Provides a basic user interface (UI) for locating and playing media within the browser window. The Media Bar?A HREF="/workshop/author/behaviors/overview.html">default behavior exposes much of the Media Bar functionality to scripting, giving you control over playback, navigation, and the player UI. It also enables you to load HTML in the Media Bar content area.
Syntax
XML <Prefix: CustomTag ID=sID STYLE="behavior:url('#default#mediaBar')" /> HTML <ELEMENT STYLE="behavior:url('#default#mediaBar')" ID=sID> Scripting object.style.behavior = "url('#default#mediaBar')" object.addBehavior ("#default#mediaBar")
Possible Values
Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag. CustomTag User-defined tag. sID String that specifies a unique identifier for the object.
Members Table
The following table lists the members exposed by the mediaBar object. Click a tab on the left to choose the type of member you want to view.
Attributes/Properties
Property Description currentItem Sets or retrieves the current media item. disabledUI Sets or retrieves a Boolean value that specifies whether an instance of the Media Bar? UI is disabled. enabled Sets or retrieves a Boolean value that specifies whether the Media Bar player control is enabled. hasNextItem Sets or retrieves a value that indicates whether any successive items follow the current item in the playlist. nextItem Sets or retrieves the next media item in a playlist, if there is one. openState Sets or retrieves an integer that indicates the open state of the Media Bar player. playlistInfo Sets or retrieves playlist information, if a playlist exists. playState Sets or retrieves an integer that indicates the play state of the Media Bar player. Events
Event Description onhide Fires when the Media Bar player is hidden. onopenstatechange Fires when the Media Bar player changes its open state. onplaystatechange Fires when the Media Bar player changes its play state. onshow Fires when the Media Bar player becomes visible. Methods
Method Description playNext Starts playback of the next media item in the playlist, if a playlist is present. playURL Loads media from a URL into the Media Bar and starts playback. stop Stops playback of the media that is currently playing. Objects
Object Description MediaItem Represents a single item in a media player playlist. PlaylistInfo Contains information about a media player playlist.
Remarks
Users can open the Media Bar by clicking a media link in the browser, typing the URL of a media file in the address bar, clicking the Media button in the Internet Explorer toolbar, or by choosing Explorer Bar from the View menu and selecting Media. The mediaBar behavior only functions within the Media Bar.
When new content is targeted at the mediaBar behavior, the Media Bar becomes dedicated to that content, stopping playback of previous media and navigating away from HTML in the Media Bar content area. For a demonstration, see the example section that follows.
You might not have access to the members listed in this table using script until the window.onload event fires. If you wait for this event to fire, it ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and that all the behavior's properties, methods, and events are available for scripting. If you use any of the behavior-defined members before the window.onload event fires, a scripting error can occur, which indicates that the object does not support that particular member.
Security Alert The Media Bar can load .asx and .asf files that specify multiple media URLs and scripted content. For security reasons, streamed content from unverified sources should be treated as user input. Developers should use caution when displaying content from unverified sources as HTML in the Media Bar content pane. For more information, see Security Considerations: Dynamic HTML and Security Considerations: DHTML and Default Behaviors.The mediaBar behavior is available in Internet Explorer 6 only in the Microsoft Win32® platform.
Examples
The following example shows an ordinary link to media content. When clicked, it starts media playback in the Media Bar.
<A href="http://msdn.microsoft.com/workshop/samples/author/behaviors/media/56movie.asf"> Launch the shuttle.</A>To display HTML content in the Media Bar content area, you can use a link that targets the Media Bar.
<A target="_media" href="http://msdn.microsoft.com/workshop/samples/author/behaviors/ sample_content.htm"></A>Because the behavior works only within the Media Bar, you must load any HTML content that uses the mediaBar behavior in the Media Bar content area and declare the behavior there. Playback of media files loaded with the mediaBar behavior's playNext or playURL methods can then be paused, scanned, and stopped using the media player user interface.
<!-- Use an inline behavior declaration for media content in the Media Bar content area. --> <DIV style="behavior:url(#default#mediaBar)" id="divMedia"> Container for media to play in the Media Bar. </DIV>
See Also
Using the Media Bar in Internet Explorer