function ProgressBar(obj){
	//开始时间
	ProgressBar.startTime=obj.startTime;
	//结束时间
	ProgressBar.endTime=obj.endTime;
	//录像总时间
	ProgressBar.totalSecond=obj.totalSecond;
}
ProgressBar.init=function(obj){
	ProgressBar(obj);
};
ProgressBar.secondToTime=function(second){
	var timeStamp=ProgressBar.startTime.getTime()+(second*1000);
	return new Date(timeStamp);
};
ProgressBar.percentToSecond=function(percent){
	var currentSecond=percent*ProgressBar.totalSecond;
	return currentSecond;
};
ProgressBar.showTimeTip=function(event,str){
	if(str=='over'){
		var currentSecond=ProgressBar.percentToSecond(event.offsetX/$("#videoControls").width());
		var currentDate=ProgressBar.secondToTime(currentSecond)
      	var year = currentDate.getFullYear();
        var month = currentDate.getMonth() + 1;
        var date = currentDate.getDate();
        var hour = currentDate.getHours();//得到小时
  	    var minu = currentDate.getMinutes();//得到分钟
  	    var sec = currentDate.getSeconds();//得到
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (date >= 0 && date <= 9) {
            date = "0" + date;
        }
          if (hour < 10) hour = "0" + hour;
	  	  if (minu < 10) minu = "0" + minu;
	  	  if (sec < 10) sec = "0" + sec;
	  	  
         var currentdate  = year + "-" + month + "-" + date+ " " + hour + ":" + minu + ":" + sec;
		if((event.offsetX+$("#timeTip").width())<$("#videoControls").width()){
			$("#timeTip").css({left:event.offsetX+"px"}).html(currentdate).show();
		}else{
			$("#timeTip").css({left:(event.offsetX-$("#timeTip").width())+"px"}).html(currentdate).show();
		}
		
	}else{
		$("#timeTip").hide();
		$("#videoControls").hide();
	}
	event.stopPropagation();
};

ProgressBar.sendMsg=function(event){
	var currentSecond=ProgressBar.percentToSecond(event.offsetX/$("#videoControls").width());
	var currentDate=ProgressBar.secondToTime(currentSecond)
  	var year = currentDate.getFullYear();
    var month = currentDate.getMonth() + 1;
    var date = currentDate.getDate();
    var hour = currentDate.getHours();//得到小时
    var minu = currentDate.getMinutes();//得到分钟
    var sec = currentDate.getSeconds();//得到
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (date >= 0 && date <= 9) {
        date = "0" + date;
    }
      if (hour < 10) hour = "0" + hour;
  	  if (minu < 10) minu = "0" + minu;
  	  if (sec < 10) sec = "0" + sec;
  	  
     var currentdate  = year + "-" + month + "-" + date+ " " + hour + ":" + minu + ":" + sec;
     
     console.log("currentdate",currentdate);
	
	event.stopPropagation();
};


ProgressBar.progress=function(obj){
	  var playProgress=$("#playProgress")[0];
	  var progressWrap=$("#progressWrap")[0];
	  var showProgress=$("#showProgress")[0];
     var percent = obj.currentTime/ ProgressBar.totalSecond;
    playProgress.style.width = percent * (progressWrap.offsetWidth)  + "px";
    showProgress.innerHTML = (percent * 100).toFixed(3) + "%";
}	;

ProgressBar.showVideoControls=function(event,str){
	if(str=='over'){
		$("#videoControls").show();
	}else{
		$("#videoControls").hide();
	}
	event.stopPropagation();
};