//
// isound-api.js - iSound related Javascript functions
// Version 1.8.3
// Authors Pascal Becker, Michael Pelny, Oliver Lietz
// (c) Audiantis GmbH, 2005, 2006
// http://www.audiantis.com/
//
// latest changes: 
// ol, dec.06: debugging / xmlhttpreq (ajax) functionality
// ol, feb 07: encodeURI complete command


// ************************
// *** INITIAL SETTINGS ***
// ************************
var g_streamID = false;
var g_hostname = "" ;
var g_isound_url = "";
var g_isound_debug = "";
var g_control_cgi = "";
var g_stream_port = "";
var g_proxy_path = "";
var g_isoundreq = false;
var isoundUseXmlHttpReq = false;
//var isoundUseXmlHttpReq = true;
var g_TargetObject = "";


// ************************
// *** HELPER FUNCTIONS ***
// ************************
function isound_xmlhttpreq(url)
{
	/*
	*** DESCRIPTION ***
		Create xmlhttp object and issue request

	*** USAGE ***
		e.g. ok = isound_xmlhttpreq(<http-address>);

	*** PARAMETERS ***
		url : Complete http-adress. E.g. complete_command from sendCommand()
			  REQUIRED

	*** VARIABLES ***
		ok  : Status (true / false)
		req : Handle to XMLHTTPRequest Object / ActiveX Object

	*** RETURN VALUE ***
		ok : true - success
		     false - failure
	*/

	var ok = false;
	var req = false;

    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest)
	{
    	try
		{
			req = new XMLHttpRequest();
        }
	catch(e)
	{
		if(g_isound_debug)
		{
			alert("no xmlhttp");
			req = false;
		}
        }
    }
	// branch for IE/Windows ActiveX version
	else if(window.ActiveXObject)
	{
       	try
		{
        	req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
        	try
			{
          		req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
          		req = false;
        	}
		}
    }

    if(req)
	{
		try
		{
			req.onreadystatechange = isound_processReqChange;
			req.open("GET", url, true);
			req.send("");
			ok = true;
		}
		catch (err)
		{
			if(g_isound_debug)
			{
				alert("xmlhttp error"); //+ err.name + " " + err.message);
			}
			ok=false;
		}
    }
    g_isoundreq = req;
    return ok;
}

function sendCommandXmlHttpReq(cmd)
{
	//g_isound_debug=1;
	/*
	*** DESCRIPTION ***
		Send iSound command to server.

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sendCommand('setsound&sid.mp3&bgm.pcm~setsound&sid.mp3&vox.pcm')">sendCommand()</a>

	*** PARAMETERS ***
		cmd : Command string. See iSound manual for further information
			  REQUIRED

	*** VARIABLES ***
		target           : Retrieves the target object by calling isound_getTargetObject()
		complete_command : Assembles the complete command
		ok               : Status for sending commands with xmlhttp-object

	*** RETURN VALUE ***
		none
	*/

	try {

	alert("isound req: " + cmd);

	var target = isound_getTargetObject();
	var complete_command = "";
	var ok = false;

	var my_control_cgi;
	//my_control_cgi = g_control_cgi;
	my_control_cgi = "cgi-bin/control-debug.cgi?";
	//my_control_cgi = "cgi-bin/control.cgi?";

	if (g_proxy_path !="")
	{
		complete_command = "http://" + g_hostname + ":" + g_stream_port + "/" + g_proxy_path + "/" + my_control_cgi + cmd;
	}
	else
	{
		complete_command = "http://" + g_hostname + ":" + g_stream_port + "/" + my_control_cgi + cmd;
	}

	if(g_isound_debug<3)
	{

		if(g_isound_debug)
		{
		    //complete_command = "http://" + g_hostname + ":" + g_stream_port + "/cgi-bin/control-reply.cgi?" + cmd;
		    alert("isound: Sending REQ " + complete_command);
		}

		ok = isound_xmlhttpreq(complete_command);

		if(!ok)
		{
			// old method: location.href
			if(g_isound_debug)
				alert("isound: Sending HREF " + complete_command);
			target.location.href = complete_command;
		}
	}
	else
	{
		alert("isound Emulation: NOT Sending " + complete_command);
	}
	}
	catch(e)
	{

	}

}

// logging/debugging
function isound_log(text)
{
	if(document.getElementById("isoundDebug"))
	{
		document.getElementById("isoundDebug").innerHTML += text + "<br />";
	}
	else
	{
		//alert("isound sendCommand: "+cmd);
	}
}

function sendCommand(cmd)
{
	//g_isound_debug=1;
	/*
	*** DESCRIPTION ***
		Send iSound command to server.

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sendCommand('setsound&sid.mp3&bgm.pcm~setsound&sid.mp3&vox.pcm')">sendCommand()</a>

	*** PARAMETERS ***
		cmd : Command string. See iSound manual for further information
			  REQUIRED

	*** VARIABLES ***
		target           : Retrieves the target object by calling isound_getTargetObject()
		complete_command : Assembles the complete command
		ok               : Status for sending commands with xmlhttp-object

	*** RETURN VALUE ***
		none
	*/


	var controlcmd = "/" + g_control_cgi + cmd; // assemble control command, eg. "/cgi-bin/control.cgi?help"
	isound_log(controlcmd);
	//controlcmd = encodeURI(controlcmd);
	//isound_log(controlcmd);

	//try to send Http Request first if condigured
	if(isoundUseXmlHttpReq)
	{
	    if(sendCommandXmlHttpReq(cmd))
	    	return;
	}

	//FIXME: try to send AXPlayer command first
	if(!isound_sendCommand_ax(controlcmd))
		return;

	var target = isound_getTargetObject();
	var complete_command = "";
	var ok = false;

	if (g_proxy_path !="")
	{
		complete_command = "http://" + g_hostname + ":" + g_stream_port + "/" + g_proxy_path + "/" + g_control_cgi + cmd;
	}
	else
	{
		complete_command = "http://" + g_hostname + ":" + g_stream_port + "/" + g_control_cgi + cmd;
	}

	if(g_isound_debug<3)
	{

	    // now send the command via http location to the server
	    // new method: xmlHttpRequest
	    if(isoundUseXmlHttpReq)
	    {
	        if(g_isound_debug)
		{
		    //complete_command = "http://" + g_hostname + ":" + g_stream_port + "/cgi-bin/control-reply.cgi?" + cmd;
		    alert("isound: Sending REQ " + complete_command);
		}

		ok = isound_xmlhttpreq(complete_command);
 	    }

 	    if(!ok)
	    {
			// old method: location.href
			if(g_isound_debug)
				alert("isound: Sending HREF " + complete_command);
			target.location.href = complete_command;
	    }
	}
	else
	{
		alert("isound Emulation: NOT Sending " + complete_command);
	}

}

function sendCommandTranslate(cmd)
{
	//g_isound_debug=1;
	/*
	*** DESCRIPTION ***
		Send iSound command to server.

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sendCommand('setsound&sid.mp3&bgm.pcm~setsound&sid.mp3&vox.pcm')">sendCommand()</a>

	*** PARAMETERS ***
		cmd : Command string. See iSound manual for further information
			  REQUIRED

	*** VARIABLES ***
		target           : Retrieves the target object by calling isound_getTargetObject()
		complete_command : Assembles the complete command
		ok               : Status for sending commands with xmlhttp-object

	*** RETURN VALUE ***
		none
	*/


	var controlcmd = "/" + g_control_cgi + cmd; // assemble control command, eg. "/cgi-bin/control.cgi?help"
	isound_log(controlcmd);
	controlcmd = encodeURI(controlcmd);
	isound_log(controlcmd);

//alert(controlcmd);

	//try to send Http Request first if condigured
	if(isoundUseXmlHttpReq)
	{
	    if(sendCommandXmlHttpReq(cmd))
	    	return;
	}

	//FIXME: try to send AXPlayer command first
	if(!isound_sendCommand_ax(controlcmd))
		return;

	var target = isound_getTargetObject();
	var complete_command = "";
	var ok = false;

	if (g_proxy_path !="")
	{
		complete_command = "http://" + g_hostname + ":" + g_stream_port + "/" + g_proxy_path + "/" + g_control_cgi + cmd;
	}
	else
	{
		complete_command = "http://" + g_hostname + ":" + g_stream_port + "/" + g_control_cgi + cmd;
	}

	if(g_isound_debug<3)
	{

	    // now send the command via http location to the server
	    // new method: xmlHttpRequest
	    if(isoundUseXmlHttpReq)
	    {
	        if(g_isound_debug)
		{
		    //complete_command = "http://" + g_hostname + ":" + g_stream_port + "/cgi-bin/control-reply.cgi?" + cmd;
		    alert("isound: Sending REQ " + complete_command);
		}

		ok = isound_xmlhttpreq(complete_command);
 	    }

 	    if(!ok)
	    {
			// old method: location.href
			if(g_isound_debug)
				alert("isound: Sending HREF " + complete_command);
			target.location.href = complete_command;
	    }
	}
	else
	{
		alert("isound Emulation: NOT Sending " + complete_command);
	}

}


// *********************
// *** DEBUG RELATED ***
// *********************
function isound_processReqChange()
{
	/*
	*** DESCRIPTION ***
		Simulates XMLHTTP communication when in debug mode

	*** USAGE ***
		e.g. req.onreadystatechange = isound_processReqChange;

	*** PARAMETERS ***
		none

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	//alert("isound_processReqChange: " + g_isoundreq.readyState);

	var resp = ""
	try {
	if(g_isoundreq.status)
		resp = g_isoundreq.status + " " + g_isoundreq.statusText + " " + g_isoundreq.responseText;
	}catch(e) {
		return;
	}

	// logging/debugging
	if(document.getElementById("isoundDebug"))
	{
		document.getElementById("isoundDebug").innerHTML += resp + "<br />";
	}
	else if (g_isoundreq.readyState == 4)
	{
	    // only if req shows "loaded"
		if(g_isound_debug)
		{
			alert("request status/answer: " + resp);
			if (g_isoundreq.status == 200)
			{
				// only if "OK"
			}
			else
			{
			}
		}
    	}
}

function isound_setTargetObject(obj)
{
	/*
	*** DESCRIPTION ***
		This function sets the target object for sendCommand

	*** USAGE ***
		e.g. var myTarget = isound_setTargetObject(parent.FrameName)

	*** PARAMETERS ***
		obj : Window object
			  REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		g_TargetObject
	*/

	g_TargetObject = obj;

	return g_TargetObject;
}

// send ax player command with UseCGI
//FIXME dependent from global object AXPlayer
function isound_sendCommand_ax(cmd)
{
	var r = -1;
	try {
		if(AXPlayer)
		{
			try {
				r = AXPlayer.UseCGI(cmd);
			} catch(e) {
				r=1;	// probably old AXPlayer without UseCGI
			}
			if(r<0)
			{
				//alert("AXPlayer CGI Error: " + cmd);
			}
		}
	} catch(e) {
		r=2;	// no AXPlayer
	}
	return r;
}


function isound_getTargetObject()
{
	/*
	*** DESCRIPTION ***
		This function returns the target object for sendCommand.
		Default 'this'

	*** USAGE ***
		e.g. var myTarget = isound_getTargetObject()

	*** PARAMETERS ***
		none

	*** VARIABLES ***
		target : Target object or default (this)

	*** RETURN VALUE ***
		target : Target object or default (this)
	*/

	var target = "";

	if (!g_TargetObject)
	{
		target = this;
	}
	else
	{
		target = g_TargetObject;
	}

	return target;
}

function isound_debugmode(dbg)
{
	/*
	*** DESCRIPTION ***
		Set isound debug mode.

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:isound_debugmode(1);">isound_debugmode(1)</a>

	*** PARAMETERS ***
		dbg : Debug-Level
		      0 - Off
			  1 - On. WITHOUT reply messages from the server
			  2 - On. WITH reply messages from the server
			  3 - On. Emulation. No command is send to the server
			  REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	g_isound_debug = dbg;
	switch (dbg)
	{
		case 0:
			alert("Switching off iSound Debug Mode");
			g_control_cgi = "cgi-bin/control.cgi?";
			break;
		case 1:
			alert("Switching on iSound Debug Mode without reply mode");
			g_control_cgi = "cgi-bin/control.cgi?";
			break;
		case 2:
			alert("Switching on iSound Debug Mode and control reply mode");
			g_control_cgi = "cgi-bin/control-reply.cgi?";
			break;
		case 3:
			alert("Switching on iSound Emulation mode (no server access)");
			break;
	}
}

function isound_debugmsg()
{
	/*
	*** DESCRIPTION ***
		Returns the hostname and streamid if debug mode is on (>1)

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:isound_debugmsg();">isound_debugmsg()</a>

	*** PARAMETERS ***
		none

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(g_isound_debug)
	{
		alert("iSound host: " + g_hostname + " id:" + g_streamID);
	}
}


// **********************
// *** STREAM RELATED ***
// **********************
function stream_init(hostname, customer_id, stream_port, control_cgi, streamID, proxy_path)
{
	/*
	*** DESCRIPTION ***
		Initialize stream for customer and return streamID.

	*** USAGE ***
		e.g. <body onLoad="stream_init('<your_isound_server>','','','','sid.mp3','','')">

	*** PARAMETERS ***
		hostname	: Hostname of iSound server
					  REQUIRED
		customer_id : Not in use
		stream_port : Streaming port. Default 8081
					  OPTIONAL
		control_cgi : Path to CGI-Interface. Default 'cgi-bin/control.cgi'
					  OPTIONAL
		streamID	: Name of the stream id. Default generated unix time
					  OPTIONAL
		proxy_path  : Path of webservers proxy. Default ''
					  OPTIONAL

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		g_streamID : Global variable with generated or given stream id
	*/

	g_hostname     = hostname;
	g_proxy_path   = proxy_path;
	g_isound_debug = 0;

	if(stream_port!="")
	{
		g_stream_port = stream_port;
	}
	else
	{
		g_stream_port = 8081;
	}

	// set control.cgi path
	if(control_cgi!="")
	{
		g_control_cgi = control_cgi;
	}
	else
	{
		g_control_cgi = "cgi-bin/control.cgi?";
	}
	if(streamID != "")
	{
		g_streamID = streamID;
	}
	else
	{
		var date = new Date();
		//g_streamID = "1.mp3";
		g_streamID = date.getTime() + ".mp3";
		//g_streamID = date.getTime() + ".flv";
		//g_streamID ="1.flv";
	}

	var autoOpen = "autoopen/";
	//var autoOpen = "openstream/";
	//var autoOpen = "";

	if (proxy_path != "")
	{
		g_isound_url = "http://" + g_hostname + ":" + g_stream_port + "/" + g_proxy_path + "/" + autoOpen + g_streamID;
	}
	else
	{
		g_isound_url = "http://" + g_hostname + ":" + g_stream_port + "/" + autoOpen + g_streamID ;
	}

	return g_streamID;
}

function stream_getSID()
{
	/*
	*** DESCRIPTION ***
		Return current streamID.

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:alert(stream_getSID());">stream_getSID()</a>

	*** PARAMETERS ***
		none

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		g_streamID : Global variable
	*/

	return g_streamID;
}

function stream_getURL()
{
	/*
	*** DESCRIPTION ***
		Return current streaming URL.

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:alert(stream_getURL());">stream_getURL()</a>

	*** PARAMETERS ***
		none

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		g_isound_url : Global variable with complete http streaming address
	*/

	return g_isound_url;
}

function stream_openStream(streamID, bitrate, channels, notifyUrl, sound)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to open a stream using passed streamid

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:stream_openStream('test_sid.mp3');">stream_openStream()</a>

	*** PARAMETERS ***
		streamID : The name of the stream to open
				   REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();

	//alert(streamID + " / " + bitrate + " / " + sound);

	var ostr = "openstream&" + streamID;
	var bit = "";
	var chan = "&1";
	var nurl = "";
	if(channels)
	{
	   	chan = "&" + channels;
	}
	if(bitrate)
	{
		bit = "&mp3&" + bitrate + chan;
		if(notifyUrl)
		{
			bit = bit + "&" + notifyUrl;
		}
	}

	if(!sound)
	{
	    sendCommand(ostr + bit);
	}
	else
		sendCommand(ostr + bit + "~setsound" + "&" + streamID + "&" + sound);
}

function stream_closeStream(streamID)
{
	if(!streamID)
		streamID = stream_getSID();

	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to close a stream using passed streamid

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:stream_closeStream('test_sid.mp3');">stream_closeStream()</a>

	*** PARAMETERS ***
		streamID : The name of the stream to close
				   REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	sendCommand("closestream&" + streamID);
}


// *********************
// *** SOUND RELATED ***
// *********************
function sound_start(streamID, fname, volume, fade_time, loop)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to start a sound on specified stream

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sound_start('sid.mp3','vox.pcm',150,'0.05',1)">sound_start()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of sound file
					REQUIRED
		volume	  : Volumelevel (0-255). Default 150
					OPTIONAL
		fade_time : Fadein time in seconds. Default 0.01
					OPTIONAL
		loop	  : Number of times this sound will be repeated 0 means infinity. Default 1
					OPTIONAL

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();
	if(!volume)
		sendCommand("setsound&" + streamID + "&" + fname);
	else
	sendCommand("setsound&" + streamID + "&" + fname + "&" + volume + "&" + fade_time + "&" + loop);
}

function sound_stop(streamID,fname, volume, fade_time)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to stop a sound on specified stream

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sound_stop('sid.mp3','vox.pcm','','0.5')">sound_stop()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of sound file
					REQUIRED
		volume	  : Not in use
		fade_time : Fadeout time in seconds. Default 0.01
					OPTIONAL

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();

	if(!fade_time)
		sendCommand("stopsound&" + streamID + "&" + fname);
	else
	sendCommand("stopsound&" + streamID + "&" + fname + "&" + fade_time);
}

function sound_stopstart(streamID, curName, fname, volume, fade_time, loop)
{
        /*
        *** DESCRIPTION ***
                Calls the helper function 'sendCommand' to stop a sound and start another sound on specified stream
        */

    	if(!streamID)
	    	streamID = stream_getSID();

        var cmd = "stopsound&" + streamID + "&" + curName + "~" + "setsound&" + streamID + "&" + fname + "&" + volume + "&" + fade_time + "&" + loop;
        //alert(cmd);
        sendCommand(cmd);
}

function sound_pause(streamID, fname)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to pause a sound on stream

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sound_pause('sid.mp3','vox.pcm')">sound_pause()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of sound file
					REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();
	sendCommand("pausesound&" + streamID + "&" + fname);
}

function sound_resume(streamID, fname)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to resume a sound on stream

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sound_resume('sid.mp3','vox.pcm')">sound_resume()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of sound file
					REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();
	sendCommand("resumesound&" + streamID + "&" + fname);
}

function sound_setVol(streamID, fname, volume)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to set the volume level of a playing sound

	*** USAGE ***
		e.g. <a href="javascript:sound_setVol('sid.mp3','vox.pcm',160)">sound_setVol()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of sound file
					REQUIRED
		volume	  : Volume level (0-255)

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();
	sendCommand("setvolsound&" + streamID + "&" + fname + "&" + volume);
}

// *********************
// *** VIDEO RELATED ***
// *********************
function video_start(streamID, fname)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to start a sound on specified stream

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sound_start('sid.mp3','vox.pcm',150,'0.05',1)">sound_start()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of video file
					REQUIRED
		volume	  : Volumelevel (0-255). Default 150
					OPTIONAL
		fade_time : Fadein time in seconds. Default 0.01
					OPTIONAL
		loop	  : Number of times this sound will be repeated 0 means infinity. Default 1
					OPTIONAL

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();
		
	sendCommand("setvideo&" + streamID + "&" + fname);
}

function video_stop(streamID,fname)
{
	/*
	*** DESCRIPTION ***
		Calls the helper function 'sendCommand' to stop a sound on specified stream

	*** USAGE ***
		e.g. <a href="#" onclick="javascript:sound_stop('sid.mp3','vox.pcm','','0.5')">sound_stop()</a>

	*** PARAMETERS ***
		streamID  : The name of the stream
					REQUIRED
		fname	  : Name of video file
					REQUIRED

	*** VARIABLES ***
		none

	*** RETURN VALUE ***
		none
	*/

	if(!streamID)
		streamID = stream_getSID();

	sendCommand("stopvideo&" + streamID + "&" + fname);
}

// *********************
// *** MetaData ***
// *********************
function onMetaData(isdevent,isdcontent,streamID)
{

	/*
	*** DESCRIPTION ***
		This function is called if the video iSound player receive MetaData from the VideoStream

	*** PARAMETERS ***
		streamID  : The name of the stream
					
		isdevent  : The event which is set for the current Stream (streamID)
			    (setsound,stopsound,endsound)
			    (setvideo,stopvideo,endviedeo)

		isdcontent: contains the actual full path of sound or video e.g. "video/demo/audiantis.flv"
	
	*/
alert(isdevent);
alert(isdcontent);
alert(streamID);
}
