<%@ Page Language="C#" AutoEventWireup="true" Inherits="video" Codebehind="video.aspx.cs" %>

<html>
<head>
<title>网站快车最好的建站程序</title>
<Link Rel="STYLESHEET" Href="style/webMain.css" Type="text/css">
<style>
.btnimg{cursor:hand}
body,div,td,a{font-size:12px}
</style>
</head>

<body bgcolor="#FFFFFF">

<table width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="552" height="473" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="35" colspan="3"><img src="images/player/bg_03.gif" width="552" height="35"></td>
      </tr>
      <tr>
        <td width="42" rowspan="2" background="images/player/bg_05.gif"><img src="images/player/bg_05.gif" width="42" height="10"></td>
        <td width="469" height="350" bgcolor="#000000" style="color:#CCFF33;" ><div ID=playerBox></div><div id="loadBox"></div></td>
        <td width="41" background="images/player/bg_07.gif"><img src="images/player/bg_07.gif" width="41" height="10"></td>
      </tr>
      <tr>
        <td height="30" colspan="2" background="images/player/bg_11.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="90%" height="30" align="center"><table width="450" border="0" cellpadding="0" cellspacing="0" style="background:url(images/player/scr.gif); background-position:center; background-repeat:no-repeat;">
                <tr>
                  <td style="width:1px;height:10px;"></td>
                  <td width="448" align="left" valign="top" id="minscr"><img src="images/player/scr_where.gif" alt="播放进度" name="playscr" id="playscr" style="position:static;z-index:10;cursor:hand;"></td>
                  <td id="maxscr" style="width:1"></td>
                </tr>
              </table></td>
              <td width="10%" align="left" style=" background:url(images/player/bg_07.gif); background-position:right; background-repeat:repeat-y;">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td id="moviestate" style="font-size:10px; font-family:'Times New Roman', Times, serif;"><span style="color:#FFFFFF;">00:00:00</span><br>00:00:00</td>
                  </tr>
                </table></td>
            </tr>
          </table></td>
        </tr>
      <tr>
        <td height="40" colspan="3" background="images/player/bg_15.gif" id="controlBox"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="12%"><img src="images/player/bg_13.gif" width="19" height="40"></td>
              <td width="35%"><img src="images/player/btn_play.gif" alt="播放/暂停" name="playbtn" width="29" height="20" class="btnimg" id=playbtn onClick="_play()"> <img src="images/player/btn_stop.gif" alt="停止" name="stopbtn" class="btnimg" id=stopbtn onClick="_stop()"> <img src="images/player/btn_skipback.gif" alt="快退" name="skipbackbtn" class="btnimg" id=skipbackbtn onClick="_skipBack()"> <img src="images/player/btn_speed.gif" alt="快进" name="speedbtn" class="btnimg" id=speedbtn onClick="_speed()"></td>
              <td width="25%" align="right"><img src="images/player/btn_fullscreen.gif" alt="全屏" name="fullbtn" class="btnimg" id=fullbtn onClick="_fullScreen()"> <img src="images/player/btn_unmute.gif" alt="静音" name="mutebtn" width="29" height="20" class="btnimg" id=mutebtn onClick="_mute()"></td>
              <td width="26%"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width=15 align="center"><font color=#ffffff>-</font></td>
                  <td width="49" align="center" valign="top" background="images/player/vol_bg.gif" id="minvol" style="padding-left:1px; padding-right:1px; padding-top:1px;"><img id="volscr" src="images/player/vol_btn.gif" alt="音量调节" style="position:static;z-index:10;cursor:hand;"></td>
                  <td width=15 align="center" id="maxvol"><font color=#ffffff>+</font></td>
                </tr>
              </table></td>
              <td width="2%" align="right"><img src="images/player/bg_18.gif" width="11" height="40"></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="18" colspan="3" valign="top" background="images/player/bg_19.gif" ID="playerversion" style="font-size:12px;padding-left:15px;">&nbsp;</td>
      </tr>
    </table>
	  </td>
    </tr>
</table>
</body>

</html>


<script type="text/jscript" language="javascript">
//播放器初始设置
var isMute=false;//静音
var step=60;//快进(快退)单位,秒
var _min,_max,_minvol,_maxvol;

var LoadingStr=getLoading();
var loadingTime=3;//加载时间
var loadingNum=0;
var loaded=0;

window.onload=function(){setup();}
window.onresize=function(){volscr.style.position="static";setup();}
function setup(){
	_min=getLeft(minscr);
	_max=getLeft(maxscr)-12;//播放进度
	_minvol=getLeft(minvol);
	_maxvol=getLeft(maxvol)-8;//音量
}

window.onerror = killErrors;

var filename="<%=filePath%>";
var playerType;
var realMedia="<object id='player' name='player1' classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='330' width='459'>"
	realMedia+="<param NAME='_ExtentX' value='5292'>"
	realMedia+="<param NAME='_ExtentY' value='4233'>"
	realMedia+="<param NAME='AUTOSTART' value='0'>"
	realMedia+="<param NAME='SHUFFLE' value='0'>"
	realMedia+="<param NAME='PREFETCH' value='0'>"
	realMedia+="<param NAME='NOLABELS' value='0'>"
	realMedia+="<param NAME='SRC' value='"+filename+"'>"
	realMedia+="<param NAME='CONTROLS' value='ImageWindow'>"
	realMedia+="<param NAME='CONSOLE' value='Clip1'>"
	realMedia+="<param NAME='LOOP' value='0'>"
	realMedia+="<param NAME='NUMLOOP' value='0'>"
	realMedia+="<param NAME='CENTER' value='0'>"
	realMedia+="<param NAME='VOLUME' value='50'>"
	realMedia+="<param NAME='MAINTAINASPECT' value='1'>"
	realMedia+="<param NAME='BACKGROUNDCOLOR' value='#000000'>"
	realMedia+="</object>"
var windowsMedia="<object id=\"player\" height=\"330\" width=\"459\" classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701standby=Loading Microsoft? Windows Media? Player components...\" type=\"application/x-oleobject\">"
	windowsMedia+="<param NAME=\"AutoStart\" VALUE=\"0\">"                //是否自动播放
	windowsMedia+="<param NAME=\"Balance\" VALUE=\"0\">"                  //调整左右声道平衡,同上面旧播放器代码
	windowsMedia+="<param name=\"enabled\" value=\"-1\">"                 //播放器是否可人为控制
	windowsMedia+="<param NAME=\"EnableContextMenu\" VALUE=\"-1\">"       //是否启用上下文菜单
	windowsMedia+="<param NAME=\"url\" VALUE=\""+filename+"\">"           //播放的文件地址
	windowsMedia+="<param NAME=\"PlayCount\" VALUE=\"1\">"                //播放次数控制,为整数
	windowsMedia+="<param name=\"rate\" value=\"1\">"                     //播放速率控制,1为正常,允许小数,1.0-2.0
	windowsMedia+="<param name=\"currentPosition\" value=\"0\">"          //控件设置:当前位置
	windowsMedia+="<param name=\"currentMarker\" value=\"0\">"            //控件设置:当前标记
	windowsMedia+="<param name=\"defaultFrame\" value=\"\">"              //显示默认框架
	windowsMedia+="<param name=\"invokeURLs\" value=\"0\">"               //脚本命令设置:是否调用URL
	windowsMedia+="<param name=\"baseURL\" value=\"\">"                   //脚本命令设置:被调用的URL
	windowsMedia+="<param name=\"stretchToFit\" value=\"1\">"             //是否按比例伸展
	windowsMedia+="<param name=\"volume\" value=\"60\">"                  //默认声音大小0%-100%,60则为60%
	windowsMedia+="<param name=\"mute\" value=\"0\">"                     //是否静音
	windowsMedia+="<param name=\"uiMode\" value=\"none\">"                //播放器显示模式:Full显示全部;mini最简化;None不显示播放控制,只显示视频窗口;invisible全部不显示
	windowsMedia+="<param name=\"windowlessVideo\" value=\"0\">"          //如果是0可以允许全屏,否则只能在窗口中查看
	windowsMedia+="<param name=\"fullScreen\" value=\"0\">"               //开始播放是否自动全屏
	windowsMedia+="<param name=\"enableErrorDialogs\" value=\"-1\">"      //是否启用错误提示报告
	windowsMedia+="</object>"

var swf="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"459\" height=\"330\">"
	swf+="<param name=\"movie\" value=\""+filename+"\">"
	swf+="<param name=\"quality\" value=\"high\">"
	swf+="<embed src=\""+filename+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"459\" height=\"330\"></embed>"
	swf+="</object>"

var	playerCode=""
var exArr=filename.split(".")
var exna=exArr[exArr.length-1];
exna=exna.toLowerCase()
switch (exna){
	case "rm" :playerCode=realMedia;playerType="RealPlayer";break;
	case "ra" :playerCode=realMedia;playerType="RealPlayer";break;
	case "ram" :playerCode=realMedia;playerType="RealPlayer";break;
	case "rmvb" :playerCode=realMedia;playerType="RealPlayer";break;
	case "swf" :playerCode=swf;playerType="SockWaver";break;
	default : playerCode=windowsMedia;playerType="MediaPlayer";break;
}

Loading();//加载

var playerInfo="";
if (playerType=="RealPlayer"){
	playerInfo="如果不能正常播放,请先安装<a href='http://www.real.com/R/RC.061504_intl_r1choiceC_cn_cn.def.txt..R/forms.real.com/real/realone/intl/intl_realone.html?dc=524523522&lang=cn&type=rp10_cn&src=realplayer,061504_intl_r1choiceC_cn_cn' target=_blank>RealPlayer</a>播放器."
}
else if(playerType=="MediaPlayer"){
	playerInfo="如果不能正常播放,请先安装<a href='http://www.microsoft.com/downloads/Browse.aspx?displaylang=zh-cn&categoryid=4' target=_blank>Windows media player</a>播放器."
}
playerversion.innerHTML=playerInfo;



function _getmovetime(){
	var _times,_now;
	var _lan,_bl;
	_lan=_max-_min;
	if (playerType=="MediaPlayer"){
		_times=player.currentMedia.duration;
		_now=player.controls.currentPosition;
		moviestate.innerHTML="<span style=\"color:#FFFFFF;\">"+formattime(_now)+"</span><br>"+formattime(_times);
		_bl=_now/_times;
		if (isNaN(_bl)){_bl=0;}
		window.playscr.style.left=_min+_lan*_bl;
	}else if (playerType=="RealPlayer"){
		var _playState;
		_playState=player.GetPlayState();
		//if(_playState==1||_playState==2||_playState==5){Loading();}
		_times=player.GetLength()/1000;
		_now=player.GetPosition()/1000;
		moviestate.innerHTML="<span style=\"color:#FFFFFF;\">"+formattime(_now)+"</span><br>"+formattime(_times);
		_bl=_now/_times;
		if (isNaN(_bl)){_bl=0;}
		window.playscr.style.left=_min+_lan*_bl;
	}else{return;}
}

function _play(){//播放/暂停
var _playState;
	if (playerType=="MediaPlayer"){
		_playState=player.playState;
		if (_playState==3){player.controls.pause();playbtn.src="images/player/btn_play.gif";}
		else {player.controls.play();playbtn.src="images/player/btn_pause.gif";}
	}else if (playerType=="RealPlayer"){
		_playState=player.GetPlayState();
		if (_playState==4 || _playState==0){player.DoPlay();playbtn.src="images/player/btn_pause.gif";}
		else {player.DoPause();playbtn.src="images/player/btn_play.gif";}
	}else{return;}
}
function _stop(){//停止
	playbtn.src="images/player/btn_play.gif";
	if (playerType=="MediaPlayer"){
		player.controls.stop();
	}else if (playerType=="RealPlayer"){
		player.DoStop();
	}else{return;}
}
function _fullScreen(){//全屏
	if (playerType=="MediaPlayer"){
		if(player.playState==3){
			//alert("按ESC键可退出全屏模式.");
			player.fullscreen=1}
		else{alert("只有在播放模式下才能开启全屏!")};
	}else if (playerType=="RealPlayer"){
		if(player.GetPlayState()==3){
			//alert("按ESC键可退出全屏模式.");
			player.SetFullScreen();}
		else{alert("只有在播放模式下才能开启全屏!")};
	}else{return;}
}
function _speed(){//快进
	var _times;
	var _nowTime;
	var _newTime;
	if (playerType=="MediaPlayer"){
		if(player.playState==3){
			_times=player.currentMedia.duration;
			_nowTime=player.controls.currentPosition;
			_newTime=_nowTime+step;
			if(_newTime>_times){_newTime=_times}
			player.controls.currentPosition=_newTime;
		}
	}else if (playerType=="RealPlayer"){
		if(player.GetPlayState()==3){
			_times=player.GetLength();
			_nowTime=player.GetPosition();
			_newTime=_nowTime+step*1000;
			if(_newTime>_times){_newTime=_times};
			player.SetPosition(_newTime);
			}
	}else{return;}
}

function _skipBack(){//快退
	var _nowTime;
	var _newTime;
	if (playerType=="MediaPlayer"){
		if(player.playState==3){
			_nowTime=player.controls.currentPosition;
			_newTime=_nowTime-step;
			if(_newTime<0){_newTime=0}
			player.controls.currentPosition=_newTime;
		//alert(_times)
		}
	}else if (playerType=="RealPlayer"){
		if(player.GetPlayState()==3){
			_nowTime=player.GetPosition();
			_newTime=_nowTime-step*1000;
			if(_newTime<0){_newTime=0};
			player.SetPosition(_newTime);
		}
	}else{return;}
}

function _mute(){//静音
	isMute= isMute ? false : true;
	if (isMute){mutebtn.src="images/player/btn_mute.gif"}
	else{mutebtn.src="images/player/btn_unmute.gif"}
	if (playerType=="MediaPlayer"){
		player.settings.mute=isMute;
	}else if (playerType=="RealPlayer"){
		player.SetMute(isMute);
	}else{return;}
}

function _scrmove(inBL){//调整播放进度
	var _times,_newtime
	if (playerType=="MediaPlayer"){
		_times=player.currentMedia.duration;
		_newtime=parseInt(_times*inBL,10);
		if(_newtime>999999||_newtime<=0||isNaN(_newtime)){_newtime=1}
		player.controls.currentPosition=_newtime;
	}else if (playerType=="RealPlayer"){
		_times=player.GetLength();
		_newtime=parseInt(_times*inBL,10);
		if(_newtime>999999999||_newtime<=1000||isNaN(_newtime)){_newtime=1000}
		player.SetPosition(_newtime);
	}else{return;}
}

function _volce(inBL){//音量调节
	mutebtn.src="images/player/btn_unmute.gif"
	isMute=false;
	if (playerType=="MediaPlayer"){
		player.settings.volume=inBL;
	}else if (playerType=="RealPlayer"){
		player.SetVolume(inBL);
	}else{return;}
}

function _next(){//下一曲

}

function _back(){//上一曲
}

var mouseX,newT,tmpt,times;
window.playscr.onmousedown=function(){
	tmpt=getLeft(playscr);
	times=_max-_min;
	mouseX= parseInt(event.x,10);
	playscr.style.position="absolute";
	playscr.style.zIndex="10";
	window.playscr.setCapture();
	window.playscr.onmousemove=function(){
		newT=tmpt+(parseInt(event.x,10) -mouseX);
		if(newT>=(_max)){newT=_max;}else if(newT<_min){newT=_min}
		window.playscr.style.left=newT;
		moviestate.innerHTML="<a style='font-size:12px;'>进度:</a>"+parseInt(((newT-_min)/times)*100,10)+"%";
	}
}
window.playscr.onmouseup = function(){
	playscr.releaseCapture();
	window.playscr.onmousemove=null;
	var BL=(newT-_min)/times;
	_scrmove(BL);
}

var mousevX,newvol,tmpvol,vols;
window.volscr.onmousedown=function(){
	vols=_maxvol-_minvol;
	tmpvol=getLeft(volscr);
	mousevX= parseInt(event.x,10);
	volscr.style.position="absolute";
	volscr.style.zIndex="10";
	window.volscr.setCapture();
	window.volscr.onmousemove=function(){
		newvol=tmpvol+(parseInt(event.x,10) -mousevX);
		if(newvol>=(_maxvol)){newvol=_maxvol;}else if(newvol<_minvol){newvol=_minvol}
		window.volscr.style.left=newvol;
		moviestate.innerHTML="<a style='font-size:12px;'>音量:</a>"+parseInt(((newvol-_minvol)/vols)*100,10)+"%";
	}
}
window.volscr.onmouseup = function(){
	volscr.releaseCapture();
	window.volscr.onmousemove=null;
	var _bl=((newvol-_minvol)/vols)*100;
	_volce(_bl);
}


//格式化时间,输入以秒为单位
function formattime(innum){
var hh,mm,ss;
var reval="";
	hh=parseInt(innum/3600,10);
	mm=parseInt((innum-hh*3600)/60,10)
	ss=parseInt(innum-hh*3600-mm*60,10)
	if (hh>0){reval+=hh+":";}
	if (mm<10){reval+="0"+mm+":";}else{reval+=mm+":";};
	if (ss<10){reval+="0"+ss;}else{reval+=ss;};
	return reval;
}
function killErrors() {return true;}
//获得对象的X坐标（相对于页面）
function getLeft(e){var l=e.offsetLeft;while(e=e.offsetParent){l+=e.offsetLeft;}return l;}



function getLoading(){
//clearInterval
	var val1="Loading";
	var reVal=new Array();
	var tmpStr="";
	var i1=1;
	for (var i=1;i<=6;i++){tmpStr+=".";reVal[i]=val1+tmpStr;}
	return reVal;
}


function Loading(){
  var step=0.2;   //秒;
  loadingNum++;
  var tmpNum=loadingNum % 5;
  if (tmpNum==0){tmpNum=5};
  if (loadingNum*step<=loadingTime){
    playerBox.style.display="none";
	loadBox.style.display="";
	loadBox.innerHTML="<img src='' border=0 width=200 height=1 />"+LoadingStr[tmpNum];
	setTimeout("Loading()",step*1000);
  }else if(loaded==1){
  	playerBox.style.display="";
	loadBox.style.display="none";
	loadingNum=0
  }else{
	loaded=1;
  	playerBox.style.display="";
	loadBox.style.display="none";
    playerBox.innerHTML=playerCode;
	loadingNum=0;
    setInterval("_getmovetime()",1000);
	return;
  }
}

</script>



