!function() { function b(a, b) { return parseInt(a.style[b] || getComputedStyle(a, null).getPropertyValue(b)) } function c(a, b) { return new RegExp("(\\s|^)" + b + "(\\s|$)").test(a.className) } function d(a, b) { a.classList ? a.classList.add(b) : c(a, b) || (a.className += "" + b) } function e(a, b) { a.classList ? a.classList.remove(b) : c(a, b) && (a.className = a.className.replace(new RegExp("(\\s|^)" + b + "(\\s|$)"), " ").replace(/^\s+|\s+$/g, "")) } function f(a, b) { (!isFinite(a) || 0 > a) && (a = 0); var c = b.alwaysShowHours ? [0] : []; return Math.floor(a / 3600) % 24 && c.push(Math.floor(a / 3600) % 24), c.push(Math.floor(a / 60) % 60), c.push(Math.floor(a % 60)), c = c.join(":"), 1 == b.timeFormatType && (c = c.replace(/(:|^)([0-9])(?=:|$)/g, "$10$2")), c } function g() { return document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen } function h(a) { var b, c; switch (a = a.toLowerCase().split("?")[0], b = a.substring(a.lastIndexOf(".") + 1), c = /mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov/gi.test(b) ? "video/": "audio/", b) { case "mp4": case "m4v": case "m4a": return c + "mp4"; case "webm": case "webma": case "webmv": return c + "webm"; case "ogg": case "oga": case "ogv": return c + "ogg"; case "m3u8": return "application/x-mpegurl"; case "ts": return c + "mp2t"; default: return c + b } } function i(a, b) { return a && !b ? h(a) : b && ~b.indexOf(";") ? b.substr(0, b.indexOf(";")) : b } function j(b, c, d) { var f, g, h, e = []; if (c.type) if ("string" == typeof c.type) e.push({ type: c.type, url: d }); else for (f = 0; f < c.type.length; f++) e.push({ type: c.type[f], url: d }); else if (null !== d) e.push({ type: i(d, b.getAttribute("type")), url: d }); else for (f = 0; f < b.children.length; f++) g = b.children[f], 1 == g.nodeType && "source" == g.tagName.toLowerCase() && (d = g.getAttribute("src"), e.push({ type: i(d, g.getAttribute("type")), url: d })); if (a.features.isBustedAndroid && (b.canPlayType = function(a) { return /video\/(mp4|m4v)/i.test(a) ? "maybe": "" }), a.features.isChromium && (b.canPlayType = function(a) { return /video\/(webm|ogv|ogg)/i.test(a) ? "maybe": "" }), a.features.supportsCanPlayType) for (f = 0; f < e.length; f++) if ("video/m3u8" == e[f].type || "" !== b.canPlayType(e[f].type).replace(/no/, "") || "" !== b.canPlayType(e[f].type.replace(/mp3/, "mpeg")).replace(/no/, "") || "" !== b.canPlayType(e[f].type.replace(/m4a/, "mp4")).replace(/no/, "")) { h = !0; break } return h } var k, a = {}; var owfts,owft = true,wof = document.getElementsByClassName("zy_media"); //2019-3-23 添加开关 a.config = { type: "", mediaTitle: "", nativeControls: !1, autoplay: !1, preload: "none", videoWidth: "100%", videoHeight: "auto", aspectRation: 16 / 9, audioWidth: "100%", audioHeight: 44, autoLoop: !1, timeFormatType: 1, alwaysShowHours: !1, alwaysShowControls: !1, hideVideoControlsOnLoad: !1, enableFullscreen: !0, pauseOtherPlayers: !0, duration: 0, success: null, error: null }, function(a) { var b = window.navigator.userAgent.toLowerCase(), c = document.createElement("video"); a.isiOS = /iphone|ipod|ipad/i.test(b) && !window.MSStream, a.isAndroid = /android/i.test(b) && !window.MSStream, a.isBustedAndroid = /android 2\.[12]/i.test(b), a.isChromium = /chromium/i.test(b), a.hasTouch = "ontouchstart" in window, a.supportsCanPlayType = "undefined" != typeof c.canPlayType, a.isVendorBigPlay = /iphone/i.test(b) && !window.MSStream, a.isVendorControls = /baidu/i.test(b), a.isVendorFullscreen = /micromessenger|weibo/i.test(b), a.isVendorAutoplay = /v819mini/i.test(b) || a.isiOS, a.nativeFullscreenPrefix = function() { return c.requestFullScreen ? "": c.webkitRequestFullScreen ? "webkit": c.mozRequestFullScreen ? "moz": c.msRequestFullScreen ? "ms": "-" } (), a.hasOldNativeFullScreen = "-" == a.nativeFullscreenPrefix && c.webkitEnterFullscreen, a.hasOldNativeFullScreen && /mac os x 10_5/i.test(b) && (a.nativeFullscreenPrefix = "-", a.hasOldNativeFullScreen = !1) } (a.features = {}), k = 0, a.players = {}, a.MediaPlayer = function(b, c) { var e, f, g, i, d = this; if (!b.isInstantiated && (b.isInstantiated = !0, d.media = b, f = d.media.tagName.toLowerCase(), /audio|video/.test(f))) { d.isVideo = "video" === f, d.options = {}; for (e in a.config) d.options[e] = a.config[e]; try { for (e in c) d.options[e] = c[e]; g = JSON.parse(d.media.getAttribute("data-config")); for (e in g) d.options[e] = g[e] } catch(h) {} d.options.autoplay && (d.options.autoplay = !a.features.isVendorAutoplay), d.isVideo || (d.options.alwaysShowControls = !0), d.options.nativeControls || a.features.isVendorControls ? d.media.setAttribute("controls", "controls") : (i = d.media.getAttribute("src"), i = "" === i ? null: i, j(d.media, d.options, i) ? (d.id = "zym_" + k++, a.players[d.id] = d, d.init()) : alert("不支持此" + (d.isVideo ? "视": "音") + "频")) } }, a.MediaPlayer.prototype = { isControlsVisible: !0, isFullScreen: !1, setPlayerSize: function(a) { var f, g, d = this, e = b(d.container, "width"); a > e && (d.width = e), d.enableAutoSize && (f = d.media.videoWidth, g = d.media.videoHeight, f && g && Math.abs(d.options.aspectRation - f / g) < .1 && (d.options.aspectRation = f / g), d.height = parseInt(e / d.options.aspectRation)), d.container.style.width = d.width + "px", // d.media.style.height = d.container.style.height = d.height + "px" //2019-3-23 原插件代码 d.media.style.height = d.container.style.height = 250 + "px" //2019-3-23 修改视频高度 }, showControls: function() { var a = this; a.isControlsVisible || (a.controls.style.bottom = "-45px", a.options.mediaTitle && (a.title.style.top = "-35px"), a.isControlsVisible = !0) }, hideControls: function() { var a = this; a.isControlsVisible && !a.options.alwaysShowControls && (a.controls.style.bottom = "0px", a.options.mediaTitle && (a.title.style.top = "0px"), a.isControlsVisible = !1) }, setControlsTimer: function(a) { var b = this; clearTimeout(b.controlsTimer), b.controlsTimer = setTimeout(function() { b.hideControls() }, a) }, updateTimeline: function(a) { var g, c = this, d = void 0 !== a ? a.target: c.media, e = null, f = b(c.slider, "width"); d.buffered && d.buffered.length > 0 && d.buffered.end && d.duration ? e = d.buffered.end(d.buffered.length - 1) / d.duration: void 0 !== d.bytesTotal && d.bytesTotal > 0 && void 0 !== d.bufferedBytes ? e = d.bufferedBytes / d.bytesTotal: a && a.lengthComputable && 0 !== a.total && (e = a.loaded / a.total), null !== e && (e = Math.min(1, Math.max(0, e)), c.loaded.style.width = f * e + "px", c.media.paused && setTimeout(function() { c.loaded.style.width = f * e + "px", c.updateTimeline() }, 300)), void 0 !== c.media.currentTime && c.media.duration && (g = Math.round(f * c.media.currentTime / c.media.duration), c.current.style.width = g + "px", c.handle.style.left = g - Math.round(b(c.handle, "width") / 2) + "px") }, updateTime: function() { var a = this; // console.log(a.media.currentTime) //2019-3-23 视频当前播放时间 /* 2019-3-23 * 播放时,判断data-off 属性值是否为0,如果为0时,当不执行弹出报名窗口; */ if(wof[0].getAttribute("data-off") == 0){ owft = false; } // if(owft){ // if(a.media.currentTime >= 10){ // document.getElementsByClassName("zy_playpause_btn")[0].click(); // wpopup(); //当播放视频时,观看10秒后暂停,弹出报名窗口; // owft=false; // } // } a.currentTime.innerHTML = f(a.media.currentTime, a.options), (a.options.duration > 1 || a.media.duration > 1) && (a.durationDuration.innerHTML = f(a.options.duration > 1 ? a.options.duration: a.media.duration, a.options)) }, buildPlaypause: function() { function c(c) { (a.media.isUserClick || a.options.autoplay) && ("play" === c ? (e(b, "zy_play"), d(b, "zy_pause")) : (e(b, "zy_pause"), d(b, "zy_play"))) } var a = this, b = document.createElement("div"); var poay = document.getElementsByClassName("poay")[0]; //2019-3-24 获取大的播放按钮 b.className = "zy_playpause_btn zy_play", a.controls.appendChild(b), //2019-3-24 监听大的播放按钮 poay.addEventListener("click", function() { /* 2019-3-23 * 这里处理播放按钮事件,当未报名时,观看到十秒后再次点击播放按钮时,弹出报名窗口; * 如果报名后 data-off 属性值为 0 时,点击播放按钮,只起到暂停及播放功能 */ (wof[0].getAttribute("data-off") == 0) ? (owfts = true) : (owfts = owft); if(owfts){ a.media.isUserClick = !0, a.media.paused ? (a.media.play(), a.media.paused || a.options.alwaysShowControls || a.setControlsTimer(3e3)) : a.media.pause() }else{ wpopup(); //当未报名时,点击播放按钮继续弹出报名窗口; } }), b.addEventListener("click", function() { /* 2019-3-23 * 这里处理播放按钮事件,当未报名时,观看到十秒后再次点击播放按钮时,弹出报名窗口; * 如果报名后 data-off 属性值为 0 时,点击播放按钮,只起到暂停及播放功能 */ (wof[0].getAttribute("data-off") == 0) ? (owfts = true) : (owfts = owft); if(owfts){ a.media.isUserClick = !0, a.media.paused ? (a.media.play(), a.media.paused || a.options.alwaysShowControls || a.setControlsTimer(3e3)) : a.media.pause() }else{ wpopup(); //当未报名时,点击播放按钮继续弹出报名窗口; } }), a.media.addEventListener("play", function() { c("play") poay.style.display="none"; //2019-3-24 当播放时,大的播放按钮直接隐藏 }), a.media.addEventListener("playing", function() { c("play") }), a.media.addEventListener("pause", function() { c("pse") }), a.media.addEventListener("paused", function() { c("pse") }) }, enterFullScreen: function() { var c = this; if (c.normalHeight = b(c.container, "height"), c.normalWidth = b(c.container, "width"), "-" != a.features.nativeFullscreenPrefix) c.container[a.features.nativeFullscreenPrefix + "RequestFullScreen"](); else if (a.features.hasOldNativeFullScreen) return c.media.webkitEnterFullscreen(), void 0; d(document.documentElement, "zy_fullscreen"), c.media.style.width = c.container.style.width = "100%", c.media.style.height = c.container.style.height = "100%", d(c.fullscreenBtn, "zy_unfullscreen"), c.isFullScreen = !0 }, exitFullScreen: function() { var b = this; (g() || b.isFullScreen) && ("-" != a.features.nativeFullscreenPrefix ? document[a.features.nativeFullscreenPrefix + "CancelFullScreen"]() : a.features.hasOldNativeFullScreen && document.webkitExitFullscreen()), e(document.documentElement, "zy_fullscreen"), b.media.style.width = b.container.style.width = b.normalWidth + "px", b.media.style.height = b.container.style.height = b.normalHeight + "px", e(b.fullscreenBtn, "zy_unfullscreen"), b.isFullScreen = !1 }, buildContainer: function() { var a = this; a.container = a.media.parentNode, a.container.style.overflow = "hidden", a.container.style.height = (a.isVideo ? b(a.container, "width") / a.options.aspectRation: a.options.audioHeight) + "px", a.container.innerHTML = '
' + (a.options.mediaTitle ? '