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.
dhtml语法
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") |
dhtml可能的值
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="/hbcms/php/r.php?url=http%3a%2f%2fmsdn.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="/hbcms/php/r.php?url=http%3A%2F%2Fmsdn.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>
This feature requires Microsoft® Internet Explorer 6 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
更多语法参考
Using the Media Bar in Internet Explorer