function QTPlayer()
{
    // call after rendering song
    this.createAudio = function( songURL, audiodiv) 
    {
	//songURL = "http://arunk.freepgs.com/blog/rgaula/ni.mp3";
	//songURL = "file:///C:/arun/rgaula/gmpmgrs.mp3";
	var urlAudioInfo = this.audioInfo[songURL];
	if( !urlAudioInfo )  {
	    urlAudioInfo = new Object();
	    urlAudioInfo.url = songURL;
	    urlAudioInfo.indexes = new Array();
	    this.audioInfo[songURL] = urlAudioInfo;
	}
	this.init(songURL);
	var bad = null;
	if( songURL && songURL != "") {
	    audiodiv.style.width = "100%";
	    audiodiv.style.height = 72;
	    audiodiv.style.zIndex = 10;
	    audiodiv.style.display = "block";

	    // generate the correct name so that the pre-installed
	    // handlers will work
	    var audio_id  = qtAudioControlNameBase + (_QTAudioPlayers.length+1)

	    this.audio_id = audio_id;

	    /* from http://web.mac.com/eric.carlson/events_demo/detailed.html */
	    var s = "" + 
		    '<object width="100%" height="44" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' +
		    'id="' + audio_id + '" style="behavior:url(#qt_event_source);" >' +
		    '<param name="src" value="' + songURL + '">' +
		   '<param name="autoplay" value="false">' +
		   '<param name="postdomevents" value="true">' +
		   //'<param name="allowembedtagoverrides" value="true">' +
		   '<embed  id="' + audio_id + '_embed" ' +
		    'postdomevents="true" autoplay="false" width = "100%" height = "44" ' + '" ' +
                    'src="' + songURL + '" > </embed></object>' +
		     this.getSliderControlsHTML(audio_id);
	    audiodiv.innerHTML = s;

	    var plug = document.getElementById(audio_id);
	    if(!plug ) {
		bad = "Error: Quicktime player fail to initialize";
	    }
	    else {
		// add to global array so that event handlers can find us
		_QTAudioPlayers[audio_id] = this;	 
		this.audioPlayerControl = plug;
		//this.myAddListener(plug,'qt_begin',           this.qt_pluginBegin, false);
		//this.myAddListener(plug,'qt_abort',           onEvent, false);
		//this.myAddListener(plug,'qt_canplay',         onEvent, false);
		//this.myAddListener(plug,'qt_canplaythrough',  onEvent, false);
		//this.myAddListener(plug,'qt_durationchange',  onEvent, false);
		this.myAddListener(plug,'qt_ended',           this.qt_onEvent, false);
		this.myAddListener(plug,'qt_error',           this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_load',            this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_loadedfirstframe',this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_loadedmetadata',  this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_pause',           this.qt_onEvent, false);
		this.myAddListener(plug,'qt_play',            this.qt_onEvent, false);
		this.myAddListener(plug,'qt_progress',        this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_stalled',         this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_timechanged',     this.qt_onEvent, false);
		//this.myAddListener(plug,'qt_volumechange',    this.qt_onEvent, false);            
		this.myAddListener(plug,'qt_waiting',         this.qt_onEvent, false);
		this.initSliderControls(audio_id);
	    }
	}
	if( bad ) {
	    audiodiv.innerHTML = '<div style="font-size:8;"><i>Audio</i>: ' + bad + '</div>';
	    audiodiv.style.width = "100%";
	    audiodiv.style.textAlign = "center";
	    audiodiv.style.display = "block";
	    return;
	}
    }

    this.myAddListener = function(obj, evt, handler, captures)
    {
	if ( document.addEventListener )
	    obj.addEventListener(evt, handler, captures);
	else
	    obj.attachEvent('on' + evt, handler); // IE requires this form
    }


    this.qt_onEvent = function(evt) {
	var target = evt.target ? evt.target : evt.srcElement;
	if (!target)
	    return;
	var targetId = target.id;
	if( !targetId ) return;
	var player = _QTAudioPlayers[targetId];
	if( !player ) return;

	switch(evt.type) {
	    case 'qt_waiting':
		player.audioUpdateTimeIndicator("Preparing to play ...");
		break;

	    case 'qt_play':
		player.play_state = "play";
		player.onPlay();
		player.audioTimerPoll();
		break;

	    case 'qt_pause':
		player.play_state = "pause";
		player.onPause();
		break;

	    case 'qt_ended':
		player.play_state = null;
		player.onStop();
		break;
	}
    }

    this.onAudioControlPositionChange = function(newPosition) { 
	this.audioUpdateTimeIndicator(); 
    }

    this.getAudioPosition = function() { 
	var scale = this.audioPlayerControl.GetTimeScale();
	return this.audioPlayerControl.GetTime()*(1.0/scale);
    }
    this.seekAudio = function(time) { 
	var s = time*this.audioPlayerControl.GetTimeScale();
	this.audioPlayerControl.SetTime(s);
    }
    this.setAudioPlaybackRate = function(rate) {
	if( this.audioPlayerControl && this.audioPlayerControl.SetRate )
	    this.audioPlayerControl.SetRate(rate);
    }

    /**
     * poller while playing
     */
    this.audioTimerPoll = function()
    {
	this.audioUpdateTimeIndicator();
	if( this.play_state == "play" )
	    setTimeout(function() { me.audioTimerPoll(); }, 25 );
    }

    this.setPlayerAudio = function(URL) {
	if( this.play_state == "play" )	// if playing
	    this.audioPlayerControl.Stop();			// stop
	this.audioPlayerControl.URL = URL;
    }


    var me = this;

    this.audio_id = "";
    this.play_state = null;

    this.setBaseObject(this);	// kind a kludgy
}
/**
 * a class that represents a (QuickTime Player) plugin
 */
a class that represents a (QuickTime Player) plugin
a class that represents a ( QuickTime Player ) plugin
function QTPlayer()
{
    this.createAudio = function( songURL, audiodiv) 
    {
	var urlAudioInfo = this.audioInfo[songURL];
	if( !urlAudioInfo )  {
	    urlAudioInfo = new Object();
	    urlAudioInfo.url = songURL;
	    urlAudioInfo.indexes = new Array();
	    this.audioInfo[songURL] = urlAudioInfo;
	}
	this.init(songURL);
	var bad = null;
	if( songURL && songURL != "") {
	    audiodiv.style.width = "100%";
	    audiodiv.style.height = 72;
	    audiodiv.style.zIndex = 10;
	    audiodiv.style.display = "block";
	    var audio_id  = qtAudioControlNameBase + (_QTAudioPlayers.length+1)
	    this.audio_id = audio_id;
	    var s = "" + 
		    '<object width="100%" height="44" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' +
		    'id="' + audio_id + '" style="behavior:url(#qt_event_source);" >' +
		    '<param name="src" value="' + songURL + '">' +
		   '<param name="autoplay" value="false">' +
		   '<param name="postdomevents" value="true">' +
		   '<embed  id="' + audio_id + '_embed" ' +
		    'postdomevents="true" autoplay="false" width = "100%" height = "44" ' + '" ' +
                    'src="' + songURL + '" > </embed></object>' +
		     this.getSliderControlsHTML(audio_id);
	    audiodiv.innerHTML = s;
	    var plug = document.getElementById(audio_id);
	    if(!plug ) {
		bad = "Error: Quicktime player fail to initialize";
	    }
	    else {
		_QTAudioPlayers[audio_id] = this;	 
		this.audioPlayerControl = plug;
		this.myAddListener(plug,'qt_ended',           this.qt_onEvent, false);
		this.myAddListener(plug,'qt_error',           this.qt_onEvent, false);
		this.myAddListener(plug,'qt_play',            this.qt_onEvent, false);
		this.myAddListener(plug,'qt_progress',        this.qt_onEvent, false);
		this.myAddListener(plug,'qt_waiting',         this.qt_onEvent, false);
		this.initSliderControls(audio_id);
	    }
	}
	if( bad ) {
	    audiodiv.innerHTML = '<div style="font-size:8;"><i>Audio</i>: ' + bad + '</div>';
	    audiodiv.style.width = "100%";
	    audiodiv.style.textAlign = "center";
	    audiodiv.style.display = "block";
	    return;
	}
    }
    this.myAddListener = function(obj, evt, handler, captures)
    {
	if ( document.addEventListener )
	    obj.addEventListener(evt, handler, captures);
	else
	    obj.attachEvent('on' + evt, handler); 
    }
    this.qt_onEvent = function(evt) {
	var target = evt.target ? evt.target : evt.srcElement;
	if (!target)
	    return;
	var targetId = target.id;
	if( !targetId ) return;
	var player = _QTAudioPlayers[targetId];
	if( !player ) return;
	switch(evt.type) {
	    case 'qt_waiting':
		player.audioUpdateTimeIndicator("Preparing to play ...");
		break;
	    case 'qt_play':
		player.play_state = "play";
		player.onPlay();
		player.audioTimerPoll();
		break;
	    case 'qt_pause':
		player.play_state = "pause";
		player.onPause();
		break;
	    case 'qt_ended':
		player.play_state = null;
		player.onStop();
		break;
	}
    }
    this.onAudioControlPositionChange = function(newPosition) { 
	this.audioUpdateTimeIndicator(); 
    }
    this.getAudioPosition = function() { 
	var scale = this.audioPlayerControl.GetTimeScale();
	return this.audioPlayerControl.GetTime()*(1.0/scale);
    }
    this.seekAudio = function(time) { 
	var s = time*this.audioPlayerControl.GetTimeScale();
	this.audioPlayerControl.SetTime(s);
    }
    this.setAudioPlaybackRate = function(rate) {
	if( this.audioPlayerControl && this.audioPlayerControl.SetRate )
	    this.audioPlayerControl.SetRate(rate);
    }
    this.audioTimerPoll = function()
    {
	this.audioUpdateTimeIndicator();
	if( this.play_state == "play" )
	    setTimeout(function() { me.audioTimerPoll(); }, 25 );
    }
    this.setPlayerAudio = function(URL) {
	if( this.play_state == "play" )	
	    this.audioPlayerControl.Stop();			
	this.audioPlayerControl.URL = URL;
    }
    var me = this;
    this.audio_id = "";
    this.play_state = null;
    this.setBaseObject(this);	
}
function QTPlayer ( ) { this . createAudio = function ( songURL , audiodiv ) { var urlAudioInfo = this . audioInfo [ songURL ] ; if ( ! urlAudioInfo ) { urlAudioInfo = new Object ( ) ; urlAudioInfo . url = songURL ; urlAudioInfo . indexes = new Array ( ) ; this . audioInfo [ songURL ] = urlAudioInfo ; } this . init ( songURL ) ; var bad = null ; if ( songURL && songURL != "" ) { audiodiv . style . width = "100%" ; audiodiv . style . height = 72 ; audiodiv . style . zIndex = 10 ; audiodiv . style . display = "block" ; var audio_id = qtAudioControlNameBase + ( _QTAudioPlayers . length + 1 ) this . audio_id = audio_id ; var s = "" + '<object width="100%" height="44" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" ' + 'id="' + audio_id + '" style="behavior:url(#qt_event_source);" >' + '<param name="src" value="' + songURL + '">' + '<param name="autoplay" value="false">' + '<param name="postdomevents" value="true">' + '<embed  id="' + audio_id + '_embed" ' + 'postdomevents="true" autoplay="false" width = "100%" height = "44" ' + '" ' + 'src="' + songURL + '" > </embed></object>' + this . getSliderControlsHTML ( audio_id ) ; audiodiv . innerHTML = s ; var plug = document . getElementById ( audio_id ) ; if ( ! plug ) { bad = "Error: Quicktime player fail to initialize" ; } else { _QTAudioPlayers [ audio_id ] = this ; this . audioPlayerControl = plug ; this . myAddListener ( plug , 'qt_ended' , this . qt_onEvent , false ) ; this . myAddListener ( plug , 'qt_error' , this . qt_onEvent , false ) ; this . myAddListener ( plug , 'qt_play' , this . qt_onEvent , false ) ; this . myAddListener ( plug , 'qt_progress' , this . qt_onEvent , false ) ; this . myAddListener ( plug , 'qt_waiting' , this . qt_onEvent , false ) ; this . initSliderControls ( audio_id ) ; } } if ( bad ) { audiodiv . innerHTML = '<div style="font-size:8;"><i>Audio</i>: ' + bad + '</div>' ; audiodiv . style . width = "100%" ; audiodiv . style . textAlign = "center" ; audiodiv . style . display = "block" ; return ; } } this . myAddListener = function ( obj , evt , handler , captures ) { if ( document . addEventListener ) obj . addEventListener ( evt , handler , captures ) ; else obj . attachEvent ( 'on' + evt , handler ) ; } this . qt_onEvent = function ( evt ) { var target = evt . target ? evt . target : evt . srcElement ; if ( ! target ) return ; var targetId = target . id ; if ( ! targetId ) return ; var player = _QTAudioPlayers [ targetId ] ; if ( ! player ) return ; switch ( evt . type ) { case 'qt_waiting' : player . audioUpdateTimeIndicator ( "Preparing to play ..." ) ; break ; case 'qt_play' : player . play_state = "play" ; player . onPlay ( ) ; player . audioTimerPoll ( ) ; break ; case 'qt_pause' : player . play_state = "pause" ; player . onPause ( ) ; break ; case 'qt_ended' : player . play_state = null ; player . onStop ( ) ; break ; } } this . onAudioControlPositionChange = function ( newPosition ) { this . audioUpdateTimeIndicator ( ) ; } this . getAudioPosition = function ( ) { var scale = this . audioPlayerControl . GetTimeScale ( ) ; return this . audioPlayerControl . GetTime ( ) * ( 1.0 / scale ) ; } this . seekAudio = function ( time ) { var s = time * this . audioPlayerControl . GetTimeScale ( ) ; this . audioPlayerControl . SetTime ( s ) ; } this . setAudioPlaybackRate = function ( rate ) { if ( this . audioPlayerControl && this . audioPlayerControl . SetRate ) this . audioPlayerControl . SetRate ( rate ) ; } this . audioTimerPoll = function ( ) { this . audioUpdateTimeIndicator ( ) ; if ( this . play_state == "play" ) setTimeout ( function ( ) { me . audioTimerPoll ( ) ; } , 25 ) ; } this . setPlayerAudio = function ( URL ) { if ( this . play_state == "play" ) this . audioPlayerControl . Stop ( ) ; this . audioPlayerControl . URL = URL ; } var me = this ; this . audio_id = "" ; this . play_state = null ; this . setBaseObject ( this ) ; }
a class that represents a (QuickTime Player) plugin
a class that represents a ( QuickTime Player ) plugin
// call after rendering song
 //songURL = "http://arunk.freepgs.com/blog/rgaula/ni.mp3";
 //songURL = "file:///C:/arun/rgaula/gmpmgrs.mp3";
 // generate the correct name so that the pre-installed
 // handlers will work
 /* from http://web.mac.com/eric.carlson/events_demo/detailed.html */ //'<param name="allowembedtagoverrides" value="true">' +
 // add to global array so that event handlers can find us
 //this.myAddListener(plug,'qt_begin',           this.qt_pluginBegin, false);
 //this.myAddListener(plug,'qt_abort',           onEvent, false);
 //this.myAddListener(plug,'qt_canplay',         onEvent, false);
 //this.myAddListener(plug,'qt_canplaythrough',  onEvent, false);
 //this.myAddListener(plug,'qt_durationchange',  onEvent, false);
 //this.myAddListener(plug,'qt_load',            this.qt_onEvent, false);
 //this.myAddListener(plug,'qt_loadedfirstframe',this.qt_onEvent, false);
 //this.myAddListener(plug,'qt_loadedmetadata',  this.qt_onEvent, false);
 //this.myAddListener(plug,'qt_pause',           this.qt_onEvent, false);
 //this.myAddListener(plug,'qt_stalled',         this.qt_onEvent, false);
 //this.myAddListener(plug,'qt_timechanged',     this.qt_onEvent, false);
 //this.myAddListener(plug,'qt_volumechange',    this.qt_onEvent, false);            
 // IE requires this form
 /**
     * poller while playing
     */ // if playing
 // stop
 // kind a kludgy
