onopenstatechange Event

This topic documents a feature that is obsolete as of Windows Internet Explorer 7.

Obsolete. Fires when the Media Bar player changes its open state.

Syntax

Event Property mediaBar.onopenstatechange = handler;
attachEvent mediaBar.attachEvent( "onopenstatechange", handler);
Named script <SCRIPT FOR = mediaBar EVENT = onopenstatechange>

Event Information

Bubbles No
Cancels No
To invoke
  • Attempt to open media content in the media player.
  • Attempt to change the media content playing in the media player.
Default action Initiates any action associated with this script.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

srcElement Gets or sets the object that fired the event.

Refer to the specific event object for additional event properties.

Remarks

As of Microsoft Internet Explorer 6 on Windows XP Service Pack 2 (SP2) or Internet Explorer 7, the mediaBar feature is obsolete and no longer available.

onopenstatechange was introduced in Internet Explorer 6.

The Media Bar player's open state changes as it locates and loads playlists, connects to servers hosting media content, acquires codecs for media playback, and so on. To handle events related to playback of media items, use onplaystatechange.

If multiple instances of the mediaBar behavior run concurrently, only one of them receives event notification, even though all instances have access to media item attributes and information about the open and play states. Developers are encouraged to avoid designs that employ multiple instances of the behavior.

Although the event object is theoretically available in event notifications from onopenstatechange and onplaystatechange, it does not contain or provide useful information if queried. Instead, event handlers should query the openState and playState properties to return player state information.

Example

In the following example, HTML in the Media Bar content area is updated with the media's open state information when the onopenstatechange event fires. Because the openState and playState properties return an integer, the function in this example accesses an array in order to return a text description. The array is not shown on this page, but you can see it by clicking the Show Me sample and viewing the source code.


<SCRIPT>
            .
            .
            .
function open_state_handle() {    
  // Return open state as integer and access the array to return the text associated 
  // with that integer
  div_Openstate.innerText += divMedia.openState + '  ' + open_array[divMedia.openState] 
  + '<BR>';
}
            .
            .
            .
</SCRIPT>
<BODY>
    <!-- In the Media Bar content area, the open state description text appears in divMedia. -->
    <DIV style="behavior:url(#default#mediaBar)" OnOpenStateChange="open_state_handle()"
        id="divMedia"></DIV>         
</BODY>
             

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/target_event.htm

Applies To

mediaBar

See Also

openState