:-[] :-|| Vivek Khokhar rambles here :-O :-[]

April 9, 2007

Windows Media Player Events

Filed under: javascript — Vivek Khokhar @ 10:13 pm

Value     State     Description
0     Undefined         Windows Media Player is in an undefined state.
1     Stopped            Playback of the current media item is stopped.
2     Paused             Playback of the current media item is paused. When a media item is                                                       paused, resuming playback begins from the same location.
3     Playing                 The current media item is playing.
4     ScanForward         The current media item is fast forwarding.
5     ScanReverse         The current media item is fast rewinding.
6     Buffering                 The current media item is getting additional data from the server.
7     Waiting                 Connection is established, but the server is not sending data. Waiting for session to begin.
8     MediaEnded     Media item has completed playback.
9     Transitioning     Preparing new media item.
10     Ready             Ready to begin playing.
11     Reconnecting     Reconnecting to stream.

Remarks

Windows Media Player states are not guaranteed to occur in any particular order. Furthermore, not every state necessarily occurs during a sequence of events. You should not write code that relies upon state order.

Example Code

The following JScript code shows the use of the player.playState property. An HTML text element, named “myText”, displays the current status. The Player object was created with ID = “Player”.

// Test whether Windows Media Player is in the playing state.
if (3 == Player.playState)
myText.value = “Windows Media Player is playing!”;
else
myText.value = “Windows Media Player is NOT playing!”;

November 16, 2006

DOM Select : Setting Onchange cross browser way

Filed under: javascript — Vivek Khokhar @ 4:05 am

This is how you set event handler that works.. for all

selColumn.onchange = “func()”;

var onChangeHandler = new Function(selColumn.onchange);

if (selColumn.addEventListener) {

selColumn.addEventListener(’change’, onChangeHandler, false );

} else if (selColumn.attachEvent) {

selColumn.attachEvent(’onchange’, onChangeHandler);

}

March 3, 2006

Javascript Fake window

Filed under: javascript — Vivek Khokhar @ 3:48 am

Javascript window.open returns an object that points to the newly open window. this is how you can make fake window objects to fool some page reloads :
Function dummyWindow will return a Window object whose reload doesn’t do anything

function _location(){
this.reload=_reload;
function _reload(){
return;
}
}
function dummyWindow(){
this.location = new _location();
}

Its a Hack but usefull in some scenarios

Powered by WordPress