//LOGO if(logo_off===1){ videoObject["logo"]="logo.png";} //智能显示图片及控件 if (is_mobile()) { videoObject["video"]["pic"] = "img/jiazai.gif"; } if ("undefined" !== typeof yqplay && "undefined" !== typeof yqplay.list_array) { if (yqplay.list_array && yqplay.list_array.length > 0 && live === 0) { videoObject["next"] = "video_next"; videoObject["list"] = "yqplay.onlist"; if (!is_mobile()) { videoObject["front"] = "video_front";} } } // 调用dplayer, api参考 :https://dplayer.js.org/#/zh-Hans/?id=api player = new DPlayer(videoObject); //p2p信息 if(_GET('p2pinfo')!=="0" ){ $("#stats").show(); player.on('stats', function (stats) { _totalP2PDownloaded = stats.totalP2PDownloaded; _totalP2PUploaded = stats.totalP2PUploaded; updateStats(); }); player.on('peerId', function (peerId) { _peerId = peerId; }); player.on('peers', function (peers) { _peerNum = peers.length; updateStats(); }); } //绑定准备就绪回调 player.on("loadedmetadata", function () {loadedmetadataHandler();}); //绑定播放结束回调 player.on("ended", function () {endedHandler();}); //绑定错误回调 player.on("error", function () {"undefined" !== typeof yqplay && yqplay.errorHandler();}); //全屏play player.on("fullscreen", function () {$("#stats").hide();}); //退出全屏 player.on("fullscreen_cancel", function (){$("#stats").show();}); //视频就绪回调,用来监控播放开始 function loadedmetadataHandler() { if ( seektime===1 && !live && headtime > 0 && player.video.currentTime < headtime) { player.seek(headtime); player.notice("继续上次播放"); } else { player.notice("视频已就绪"); } player.on("timeupdate", function () { timeupdateHandler(); }); } //播放进度回调 function timeupdateHandler() { setCookie("time_"+ videoUrl,player.video.currentTime,24); } //播放结束回调 function endedHandler() { setCookie("time_"+ videoUrl,"",-1); if(parent.MacPlayer.PlayLinkNext!=''){ top.location.href = parent.MacPlayer.PlayLinkNext; }else { player.notice("视频播放已结束"); } } //播放下集 function video_next() { if ("undefined" !== typeof yqplay && "undefined" !== typeof yqplay.playlist_array) if (Number(yqplay.part) + 1 >= yqplay.playlist_array.length) { return false; } yqplay.part++; myplay(yqplay.playlist_array[yqplay.part]); } //播放上集 function video_front() { if ("undefined" !== typeof yqplay && "undefined" !== typeof yqplay.playlist_array) if (Number(yqplay.part) <= 0) { return false; } yqplay.part--; myplay(yqplay.playlist_array[yqplay.part]); } //调用播放 function myplay(url) { videoUrl=url; headtime= Number(getCookie("time_"+ videoUrl)); player.switchVideo({url: url}); player.play(); if ("undefined" !== typeof yqplay) { if (yqplay.title && !live) { parent.document.title = "正在播放:【" + yqplay.title + "】part " + (Number(yqplay.part) + 1) + "-- " + yqplay.mytitle; } } } function updateStats() { var text = ''; document.getElementById('stats').innerText = text; } $("#stats").css("color",random_rgb(0,100)); $("#stats").mousemove(function(){ $("#stats").css("color",random_rgb());});