//视频处理 ——————————————————————————
var video;
var pauseTime = -1;
function VideoInit(){
try{
video = document.getElementById(“myVideo”);
//监听视频播放结束事件
video.addEventListener(“ended”, function()
{
//alert(“播放结束。”);
closeAdv();
}, true);
// 发生错误
video.addEventListener(“error”,function(){
//alert(video.error.code);
//switch (video.error.code)
//{
//case MediaError.MEDIA_ERROR_ABORTED:
// alert(“视频的下载过程被中止。”);
// break;
//case MediaError.MEDIA_ERROR_NETWORK:
// alert(“网络发生故障,视频的下载过程被中止。”);
// break;
//case MediaError.MEDIA_ERROR_DECODE:
// alert(“解码失败。”);
// break;
//case MediaError.MEDIA_ERROR_SRC_NOT_SUPPORTED:
// alert(“不支持播放的视频格式。”);
// break;
//default:
// alert(“发生未知错误。”);
//}
closeAdv();
},false);
pauseTime = -1;
$(‘#autoTime’).everyTime(1000,function(){
if(pauseTime != -1){
temptime-=1;
$(“#myLastTime”).text(temptime);
if(temptime
temptime = 0;
}
}
});
}catch(e){
//closeAdv();
}
}
function play()
{
pauseTime = 0;
// 播放视频
video.play();
setTimeout(‘closeAdv()’,40000);
$(“#autoPlay”).removeAttr(“disabled”);
$(“#autoPause”).removeAttr(“disabled”);
}
function closeAdv(){
$(“.adv”).fadeOut(“slow”,function(){
$(“.main”).fadeIn(“slow”);
});
}
function pause()
{
//暂停播放
video.pause();
pauseTime = -1;
//清除倒计时
$(“#autoPlay”).removeAttr(“disabled”);
$(“#autoPause”).removeAttr(“disabled”);
}
//视频处理 ——————————————————————————