﻿
// 显示控件
function MediaplayControl(mWidth,mHeight)
{
	if (isInstall)
	{
		if(mWidth.toString()=="NaN"||mHeight.toString()=="NaN"||mWidth<0||mWidth>1024||mHeight<0||mHeight>728)
		{  
			mWidth=440;
			mHeight=350;
		}
		document.write("<div id=MediaPlayDIV><OBJECT ID=LiveMediaPlugInCtrl Height='"+mHeight+"' Width='"+mWidth+"' CLASSID='CLSID:9D8168F2-26F1-48FB-B7C7-65721B24ADC3' name=LiveMediaPlugInCtrl VIEWASTEXT></OBJECT></div>");
	}
}

function pluginversion_checkLive()
{
	if (isInstall)
	{
		if(LiveMediaPlugInCtrl.VersionNum>14120100)
	  	return true;
	  else
	  	return false;
	}
	return false;
}

function setPlayFile()
{
	 if (isInstall)
	 {  
		vmask.style.display = "none";
		doplive.style.display = "block"; 
	 }
	 if(!(pluginversion_checkLive()))
	 {
		vmask.style.display = "block";
		doplive.style.display = "none";		
	 }
}

function livemedia_checkLive()
{
	if (isInstall)
	{
		if(LiveMediaPlugInCtrl && LiveMediaPlugInCtrl.object && pluginversion_checkLive())
			return true;
		else
			return false;
	}
	return false;
}

function liveplayer_startp2p(playlink) 
{
	if (livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.RemoveChannelUrl();
		LiveMediaPlugInCtrl.AddChannelUrl(playlink, 100);
		LiveMediaPlugInCtrl.StartChannelPlaying();
	}
}

function liveplayer_stopp2p()
{
	if (livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.StopChannelPlaying();
	}
}

function liveplayer_addurl(playlink)
{
	if (livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.AddChannelUrl(playlink, 100);
	}
}

function liveplayer_autoplay(playlink)
{
	if (livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.AddChannelUrl(playlink, 100);
		LiveMediaPlugInCtrl.IsAutoStart = 1;
	}
}

function PlayByGroup(playlink)
{
	if(livemedia_checkLive())
	{
		liveplayer_startp2p(dopgroup[playlink]);
	}
}

function DrawImage(ImgD,FitWidth,FitHeight){     
	var image=new Image();     
	image.src=ImgD.src;     
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){ 
			
			ImgD.width=FitWidth;                 
			ImgD.height1=image.height*FitWidth/image.width;
		}
		else
		{
			ImgD.height = FitHeight;
			ImgD.width1  = FitHeight * image.width / image.height;
		}
	}
}

function getOs() 
{ 
   var OsObject = ""; 
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)
   { 
        return true;
   } 
} 

if(getOs())
{
 	alert("您的浏览器类型为:Firefox,请选择IE浏览器进行播放"); 
}

function playnbanew()
{
	if(livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.RemoveChannelUrl();
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2001], 100);
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2002], 100);
		LiveMediaPlugInCtrl.StartChannelPlaying();
	}
}

function playnbanew_auto()
{
	if(livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.RemoveChannelUrl();
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2001], 100);
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2002], 100);
		LiveMediaPlugInCtrl.IsAutoStart = 1;
	}
}

function playnbanew_gaoqing()
{
	if(livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.RemoveChannelUrl();
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2003], 100);
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2004], 100);
		LiveMediaPlugInCtrl.StartChannelPlaying();
	}
}

function playnbanew_auto_gaoqing()
{
	if(livemedia_checkLive())
	{
		LiveMediaPlugInCtrl.RemoveChannelUrl();
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2003], 100);
		LiveMediaPlugInCtrl.AddChannelUrl(dopgroup[2004], 100);
		LiveMediaPlugInCtrl.IsAutoStart = 1;
	}
}
