1/*! 2* MediaElement.js 3* HTML5 <video> and <audio> shim and player 4* http://mediaelementjs.com/ 5* 6* Creates a JavaScript object that mimics HTML5 MediaElement API 7* for browsers that don't understand HTML5 or can't play the provided codec 8* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3 9* 10* Copyright 2010-2014, John Dyer (http://j.hn) 11* License: MIT 12* 13*/ 14var mejs = mejs || {}; 15mejs.version = "2.14.2"; 16mejs.meIndex = 0; 17mejs.plugins = { 18 silverlight: [{ 19 version: [3, 0], 20 types: ["video/mp4", "video/m4v", "video/mov", "video/wmv", "audio/wma", "audio/m4a", "audio/mp3", "audio/wav", "audio/mpeg"] 21 } 22 ], 23 flash: [{ 24 version: [9, 0, 124], 25 types: ["video/mp4", "video/m4v", "video/mov", "video/flv", "video/rtmp", "video/x-flv", "audio/flv", "audio/x-flv", "audio/mp3", "audio/m4a", "audio/mpeg", "video/youtube", "video/x-youtube"] 26 } 27 ], 28 youtube: [{ 29 version: null, 30 types: ["video/youtube", "video/x-youtube", "audio/youtube", "audio/x-youtube"] 31 } 32 ], 33 vimeo: [{ 34 version: null, 35 types: ["video/vimeo", 36 "video/x-vimeo"] 37 } 38 ] 39}; 40mejs.Utility = { 41 encodeUrl: function(a) { 42 return encodeURIComponent(a) 43 }, 44 escapeHTML: function(a) { 45 return a.toString().split("&").join("&").split("<").join("<").split('"').join(""") 46 }, 47 absolutizeUrl: function(a) { 48 var b = document.createElement("div"); 49 b.innerHTML = '<a href="' + this.escapeHTML(a) + '">x</a>'; 50 return b.firstChild.href 51 }, 52 getScriptPath: function(a) { 53 for (var b = 0, c, d = "", e = "", g, f, i = document.getElementsByTagName("script"), k = i.length, h = a.length; b < k; b++) { 54 g = i[b].src; 55 c = g.lastIndexOf("/"); 56 if (c>-1) { 57 f = g.substring(c + 58 1); 59 g = g.substring(0, c + 1) 60 } else { 61 f = g; 62 g = "" 63 } 64 for (c = 0; c < h; c++) { 65 e = a[c]; 66 e = f.indexOf(e); 67 if (e>-1) { 68 d = g; 69 break 70 } 71 } 72 if (d !== "") 73 break 74 } 75 return d 76 }, 77 secondsToTimeCode: function(a, b, c, d) { 78 if (typeof c == "undefined") 79 c = false; 80 else if (typeof d == "undefined") 81 d = 25; 82 var e = Math.floor(a / 3600)%24, g = Math.floor(a / 60)%60, f = Math.floor(a%60); 83 a = Math.floor((a%1 * d).toFixed(3)); 84 return (b || e > 0 ? (e < 10 ? "0" + e : e) + ":" : "") + (g < 10 ? "0" + g : g) + ":" + (f < 10 ? "0" + f : f) + (c ? ":" + (a < 10 ? "0" + a : a) : "") 85 }, 86 timeCodeToSeconds: function(a, b, c, d) { 87 if (typeof c == "undefined") 88 c = false; 89 else if (typeof d == 90 "undefined") 91 d = 25; 92 a = a.split(":"); 93 b = parseInt(a[0], 10); 94 var e = parseInt(a[1], 10), g = parseInt(a[2], 10), f = 0, i = 0; 95 if (c) 96 f = parseInt(a[3]) / d; 97 return i = b * 3600 + e * 60 + g + f 98 }, 99 convertSMPTEtoSeconds: function(a) { 100 if (typeof a != "string") 101 return false; 102 a = a.replace(",", "."); 103 var b = 0, c = a.indexOf(".")!=-1 ? a.split(".")[1].length: 0, d = 1; 104 a = a.split(":").reverse(); 105 for (var e = 0; e < a.length; e++) { 106 d = 1; 107 if (e > 0) 108 d = Math.pow(60, e); 109 b += Number(a[e]) * d 110 } 111 return Number(b.toFixed(c)) 112 }, 113 removeSwf: function(a) { 114 var b = document.getElementById(a); 115 if (b && /object|embed/i.test(b.nodeName)) 116 if (mejs.MediaFeatures.isIE) { 117 b.style.display = 118 "none"; 119 (function() { 120 b.readyState == 4 ? mejs.Utility.removeObjectInIE(a) : setTimeout(arguments.callee, 10) 121 })() 122 } else 123 b.parentNode.removeChild(b) 124 }, 125 removeObjectInIE: function(a) { 126 if (a = document.getElementById(a)) { 127 for (var b in a) 128 if (typeof a[b] == "function") 129 a[b] = null; 130 a.parentNode.removeChild(a) 131 } 132 } 133}; 134mejs.PluginDetector = { 135 hasPluginVersion: function(a, b) { 136 var c = this.plugins[a]; 137 b[1] = b[1] || 0; 138 b[2] = b[2] || 0; 139 return c[0] > b[0] || c[0] == b[0] && c[1] > b[1] || c[0] == b[0] && c[1] == b[1] && c[2] >= b[2] ? true : false 140 }, 141 nav: window.navigator, 142 ua: window.navigator.userAgent.toLowerCase(), 143 plugins: [], 144 addPlugin: function(a, b, c, d, e) { 145 this.plugins[a] = this.detectPlugin(b, c, d, e) 146 }, 147 detectPlugin: function(a, b, c, d) { 148 var e = [0, 0, 0], g; 149 if (typeof this.nav.plugins != "undefined" && typeof this.nav.plugins[a] == "object") { 150 if ((c = this.nav.plugins[a].description) && 151 !(typeof this.nav.mimeTypes != "undefined" && this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)) { 152 e = c.replace(a, "").replace(/^\s+/, "").replace(/\sr/gi, ".").split("."); 153 for (a = 0; a < e.length; a++) 154 e[a] = parseInt(e[a].match(/\d+/), 10) 155 } 156 } else if (typeof window.ActiveXObject != "undefined") 157 try { 158 if (g = new ActiveXObject(c)) 159 e = d(g) 160 } catch (f) {} 161 return e 162 } 163}; 164mejs.PluginDetector.addPlugin("flash", "Shockwave Flash", "application/x-shockwave-flash", "ShockwaveFlash.ShockwaveFlash", function(a) { 165 var b = []; 166 if (a = a.GetVariable("$version")) { 167 a = a.split(" ")[1].split(","); 168 b = [parseInt(a[0], 10), parseInt(a[1], 10), parseInt(a[2], 10)] 169 } 170 return b 171}); 172mejs.PluginDetector.addPlugin("silverlight", "Silverlight Plug-In", "application/x-silverlight-2", "AgControl.AgControl", function(a) { 173 var b = [0, 0, 0, 0], c = function(d, e, g, f) { 174 for (; d.isVersionSupported(e[0] + "." + e[1] + "." + e[2] + "." + e[3]);) 175 e[g] += f; 176 e[g] -= f 177 }; 178 c(a, b, 0, 1); 179 c(a, b, 1, 1); 180 c(a, b, 2, 1E4); 181 c(a, b, 2, 1E3); 182 c(a, b, 2, 100); 183 c(a, b, 2, 10); 184 c(a, b, 2, 1); 185 c(a, b, 3, 1); 186 return b 187}); 188mejs.MediaFeatures = { 189 init: function() { 190 var a = this, b = document, c = mejs.PluginDetector.nav, d = mejs.PluginDetector.ua.toLowerCase(), e, g = ["source", "track", "audio", "video"]; 191 a.isiPad = d.match(/ipad/i) !== null; 192 a.isiPhone = d.match(/iphone/i) !== null; 193 a.isiOS = a.isiPhone || a.isiPad; 194 a.isAndroid = d.match(/android/i) !== null; 195 a.isBustedAndroid = d.match(/android 2\.[12]/) !== null; 196 a.isBustedNativeHTTPS = location.protocol === "https:" && (d.match(/android [12]\./) !== null || d.match(/macintosh.* version.* safari/) !== null); 197 a.isIE = c.appName.toLowerCase().indexOf("microsoft") != 198 -1 || c.appName.toLowerCase().match(/trident/gi) !== null; 199 a.isChrome = d.match(/chrome/gi) !== null; 200 a.isFirefox = d.match(/firefox/gi) !== null; 201 a.isWebkit = d.match(/webkit/gi) !== null; 202 a.isGecko = d.match(/gecko/gi) !== null&&!a.isWebkit&&!a.isIE; 203 a.isOpera = d.match(/opera/gi) !== null; 204 a.hasTouch = "ontouchstart"in window; 205 a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect; 206 for (c = 0; c < g.length; c++) 207 e = document.createElement(g[c]); 208 a.supportsMediaTag = typeof e.canPlayType !== 209 "undefined" || a.isBustedAndroid; 210 try { 211 e.canPlayType("video/mp4") 212 } catch (f) { 213 a.supportsMediaTag = false 214 } 215 a.hasSemiNativeFullScreen = typeof e.webkitEnterFullscreen !== "undefined"; 216 a.hasNativeFullscreen = typeof e.requestFullscreen !== "undefined"; 217 a.hasWebkitNativeFullScreen = typeof e.webkitRequestFullScreen !== "undefined"; 218 a.hasMozNativeFullScreen = typeof e.mozRequestFullScreen !== "undefined"; 219 a.hasMsNativeFullScreen = typeof e.msRequestFullscreen !== "undefined"; 220 a.hasTrueNativeFullScreen = a.hasWebkitNativeFullScreen || a.hasMozNativeFullScreen || 221 a.hasMsNativeFullScreen; 222 a.nativeFullScreenEnabled = a.hasTrueNativeFullScreen; 223 if (a.hasMozNativeFullScreen) 224 a.nativeFullScreenEnabled = document.mozFullScreenEnabled; 225 else if (a.hasMsNativeFullScreen) 226 a.nativeFullScreenEnabled = document.msFullscreenEnabled; 227 if (a.isChrome) 228 a.hasSemiNativeFullScreen = false;
229 if (a.hasTrueNativeFullScreen) { 230 a.fullScreenEventName = ""; 231 if (a.hasWebkitNativeFullScreen) 232 a.fullScreenEventName = "webkitfullscreenchange"; 233 else if (a.hasMozNativeFullScreen) 234 a.fullScreenEventName = "mozfullscreenchange"; 235 else if (a.hasMsNativeFullScreen) 236 a.fullScreenEventName = "MSFullscreenChange"; 237 a.isFullScreen = function() { 238 if (e.mozRequestFullScreen) 239 return b.mozFullScreen; 240 else if (e.webkitRequestFullScreen) 241 return b.webkitIsFullScreen; 242 else if (e.hasMsNativeFullScreen) 243 return b.msFullscreenElement !== null 244 }; 245 a.requestFullScreen = function(i) { 246 if (a.hasWebkitNativeFullScreen) 247 i.webkitRequestFullScreen(); 248 else if (a.hasMozNativeFullScreen) 249 i.mozRequestFullScreen(); 250 else 251 a.hasMsNativeFullScreen && i.msRequestFullscreen() 252 }; 253 a.cancelFullScreen = 254 function() { 255 if (a.hasWebkitNativeFullScreen) 256 document.webkitCancelFullScreen(); 257 else if (a.hasMozNativeFullScreen) 258 document.mozCancelFullScreen(); 259 else 260 a.hasMsNativeFullScreen && document.msExitFullscreen() 261 } 262 } 263 if (a.hasSemiNativeFullScreen && d.match(/mac os x 10_5/i)) { 264 a.hasNativeFullScreen = false; 265 a.hasSemiNativeFullScreen = false 266 } 267 } 268}; 269mejs.MediaFeatures.init(); 270mejs.HtmlMediaElement = { 271 pluginType: "native", 272 isFullScreen: false, 273 setCurrentTime: function(a) { 274 this.currentTime = a 275 }, 276 setMuted: function(a) { 277 this.muted = a 278 }, 279 setVolume: function(a) { 280 this.volume = a 281 }, 282 stop: function() { 283 this.pause() 284 }, 285 setSrc: function(a) { 286 for (var b = this.getElementsByTagName("source"); b.length > 0;) 287 this.removeChild(b[0]); 288 if (typeof a == "string") 289 this.src = a; 290 else { 291 var c; 292 for (b = 0; b < a.length; b++) { 293 c = a[b]; 294 if (this.canPlayType(c.type)) { 295 this.src = c.src; 296 break 297 } 298 } 299 } 300 }, 301 setVideoSize: function(a, b) { 302 this.width = a; 303 this.height = b 304 } 305}; 306mejs.PluginMediaElement = function(a, b, c) { 307 this.id = a; 308 this.pluginType = b; 309 this.src = c; 310 this.events = {}; 311 this.attributes = {} 312}; 313mejs.PluginMediaElement.prototype = { 314 pluginElement: null, 315 pluginType: "", 316 isFullScreen: false, 317 playbackRate: -1, 318 defaultPlaybackRate: -1, 319 seekable: [], 320 played: [], 321 paused: true, 322 ended: false, 323 seeking: false, 324 duration: 0, 325 error: null, 326 tagName: "", 327 muted: false, 328 volume: 1, 329 currentTime: 0, 330 play: function() { 331 if (this.pluginApi != null) { 332 this.pluginType == "youtube" || this.pluginType == "vimeo" ? this.pluginApi.playVideo() : this.pluginApi.playMedia(); 333 this.paused = false 334 } 335 }, 336 load: function() { 337 if (this.pluginApi != null) { 338 this.pluginType == "youtube" || this.pluginType == 339 "vimeo" || this.pluginApi.loadMedia(); 340 this.paused = false 341 } 342 }, 343 pause: function() { 344 if (this.pluginApi != null) { 345 this.pluginType == "youtube" || this.pluginType == "vimeo" ? this.pluginApi.pauseVideo() : this.pluginApi.pauseMedia(); 346 this.paused = true 347 } 348 }, 349 stop: function() { 350 if (this.pluginApi != null) { 351 this.pluginType == "youtube" || this.pluginType == "vimeo" ? this.pluginApi.stopVideo() : this.pluginApi.stopMedia(); 352 this.paused = true 353 } 354 }, 355 canPlayType: function(a) { 356 var b, c, d, e = mejs.plugins[this.pluginType]; 357 for (b = 0; b < e.length; b++) { 358 d = e[b]; 359 if (mejs.PluginDetector.hasPluginVersion(this.pluginType, 360 d.version)) 361 for (c = 0; c < d.types.length; c++) 362 if (a == d.types[c]) 363 return "probably" 364 } 365 return "" 366 }, 367 positionFullscreenButton: function(a, b, c) { 368 this.pluginApi != null && this.pluginApi.positionFullscreenButton && this.pluginApi.positionFullscreenButton(Math.floor(a), Math.floor(b), c) 369 }, 370 hideFullscreenButton: function() { 371 this.pluginApi != null && this.pluginApi.hideFullscreenButton && this.pluginApi.hideFullscreenButton() 372 }, 373 setSrc: function(a) { 374 if (typeof a == "string") { 375 this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a)); 376 this.src = mejs.Utility.absolutizeUrl(a) 377 } else { 378 var b, 379 c; 380 for (b = 0; b < a.length; b++) { 381 c = a[b]; 382 if (this.canPlayType(c.type)) { 383 this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src)); 384 this.src = mejs.Utility.absolutizeUrl(a); 385 break 386 } 387 } 388 } 389 }, 390 setCurrentTime: function(a) { 391 if (this.pluginApi != null) { 392 this.pluginType == "youtube" || this.pluginType == "vimeo" ? this.pluginApi.seekTo(a) : this.pluginApi.setCurrentTime(a); 393 this.currentTime = a 394 } 395 }, 396 setVolume: function(a) { 397 if (this.pluginApi != null) { 398 this.pluginType == "youtube" || this.pluginType == "vimeo" ? this.pluginApi.setVolume(a * 100) : this.pluginApi.setVolume(a); 399 this.volume = a 400 } 401 }, 402 setMuted: function(a) { 403 if (this.pluginApi != null) { 404 if (this.pluginType == "youtube" || this.pluginType == "vimeo") { 405 a ? this.pluginApi.mute() : this.pluginApi.unMute(); 406 this.muted = a; 407 this.dispatchEvent("volumechange") 408 } else 409 this.pluginApi.setMuted(a); 410 this.muted = a 411 } 412 }, 413 setVideoSize: function(a, b) { 414 if (this.pluginElement.style) { 415 this.pluginElement.style.width = a + "px"; 416 this.pluginElement.style.height = b + "px" 417 } 418 this.pluginApi != null && this.pluginApi.setVideoSize && this.pluginApi.setVideoSize(a, b) 419 }, 420 setFullscreen: function(a) { 421 this.pluginApi != 422 null && this.pluginApi.setFullscreen && this.pluginApi.setFullscreen(a) 423 }, 424 enterFullScreen: function() { 425 this.pluginApi != null && this.pluginApi.setFullscreen && this.setFullscreen(true) 426 }, 427 exitFullScreen: function() { 428 this.pluginApi != null && this.pluginApi.setFullscreen && this.setFullscreen(false) 429 }, 430 addEventListener: function(a, b) { 431 this.events[a] = this.events[a] || []; 432 this.events[a].push(b) 433 }, 434 removeEventListener: function(a, b) { 435 if (!a) { 436 this.events = {}; 437 return true 438 } 439 var c = this.events[a]; 440 if (!c) 441 return true; 442 if (!b) { 443 this.events[a] = []; 444 return true 445 } 446 for (var d = 447 0; d < c.length; d++) 448 if (c[d] === b) { 449 this.events[a].splice(d, 1); 450 return true 451 } 452 return false 453 }, 454 dispatchEvent: function(a) { 455 var b, c, d = this.events[a]; 456 if (d) { 457 c = Array.prototype.slice.call(arguments, 1); 458 for (b = 0; b < d.length; b++) 459 d[b].apply(null, c) 460 } 461 }, 462 hasAttribute: function(a) { 463 return a in this.attributes 464 }, 465 removeAttribute: function(a) { 466 delete this.attributes[a] 467 }, 468 getAttribute: function(a) { 469 if (this.hasAttribute(a)) 470 return this.attributes[a]; 471 return "" 472 }, 473 setAttribute: function(a, b) { 474 this.attributes[a] = b 475 }, 476 remove: function() { 477 mejs.Utility.removeSwf(this.pluginElement.id); 478 mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id) 479 } 480}; 481mejs.MediaPluginBridge = { 482 pluginMediaElements: {}, 483 htmlMediaElements: {}, 484 registerPluginElement: function(a, b, c) { 485 this.pluginMediaElements[a] = b; 486 this.htmlMediaElements[a] = c 487 }, 488 unregisterPluginElement: function(a) { 489 delete this.pluginMediaElements[a]; 490 delete this.htmlMediaElements[a] 491 }, 492 initPlugin: function(a) { 493 var b = this.pluginMediaElements[a], c = this.htmlMediaElements[a]; 494 if (b) { 495 switch (b.pluginType) { 496 case "flash": 497 b.pluginElement = b.pluginApi = document.getElementById(a); 498 break; 499 case "silverlight": 500 b.pluginElement = document.getElementById(b.id); 501 b.pluginApi = b.pluginElement.Content.MediaElementJS 502 } 503 b.pluginApi != null && b.success && b.success(b, c) 504 } 505 }, 506 fireEvent: function(a, b, c) { 507 var d, e; 508 if (a = this.pluginMediaElements[a]) { 509 b = { 510 type: b, 511 target: a 512 }; 513 for (d in c) { 514 a[d] = c[d]; 515 b[d] = c[d] 516 } 517 e = c.bufferedTime || 0; 518 b.target.buffered = b.buffered = { 519 start: function() { 520 return 0 521 }, 522 end: function() { 523 return e 524 }, 525 length: 1 526 }; 527 a.dispatchEvent(b.type, b) 528 } 529 } 530}; 531mejs.MediaElementDefaults = { 532 mode: "auto", 533 plugins: ["flash", "silverlight", "youtube", "vimeo"], 534 enablePluginDebug: false, 535 httpsBasicAuthSite: false, 536 type: "", 537 pluginPath: mejs.Utility.getScriptPath(["mediaelement.js", "mediaelement.min.js", "mediaelement-and-player.js", "mediaelement-and-player.min.js"]), 538 flashName: "flashmediaelement.swf", 539 flashStreamer: "", 540 enablePluginSmoothing: false, 541 enablePseudoStreaming: false, 542 pseudoStreamingStartQueryParam: "start", 543 silverlightName: "silverlightmediaelement.xap", 544 defaultVideoWidth: 480, 545 defaultVideoHeight: 270, 546 pluginWidth: -1, 547 pluginHeight: -1, 548 pluginVars: [], 549 timerRate: 250, 550 startVolume: 0.8, 551 success: function() {}, 552 error: function() {} 553}; 554mejs.MediaElement = function(a, b) { 555 return mejs.HtmlMediaElementShim.create(a, b) 556}; 557mejs.HtmlMediaElementShim = { 558 create: function(a, b) { 559 var c = mejs.MediaElementDefaults, d = typeof a == "string" ? document.getElementById(a): a, e = d.tagName.toLowerCase(), g = e === "audio" || e === "video", f = g ? d.getAttribute("src"): d.getAttribute("href"); 560 e = d.getAttribute("poster"); 561 var i = d.getAttribute("autoplay"), k = d.getAttribute("preload"), h = d.getAttribute("controls"), j; 562 for (j in b) 563 c[j] = b[j]; 564 f = typeof f == "undefined" || f === null || f == "" ? null : f; 565 e = typeof e == "undefined" || e === null ? "" : e;
566 k = typeof k == "undefined" || k === null || k === "false" ? 567 "none" : k; 568 i=!(typeof i == "undefined" || i === null || i === "false"); 569 h=!(typeof h == "undefined" || h === null || h === "false"); 570 j = this.determinePlayback(d, c, mejs.MediaFeatures.supportsMediaTag, g, f); 571 j.url = j.url !== null ? mejs.Utility.absolutizeUrl(j.url) : ""; 572 if (j.method == "native") { 573 if (mejs.MediaFeatures.isBustedAndroid) { 574 d.src = j.url; 575 d.addEventListener("click", function() { 576 d.play() 577 }, false) 578 } 579 return this.updateNative(j, c, i, k) 580 } else if (j.method !== "") 581 return this.createPlugin(j, c, e, i, k, h); 582 else { 583 this.createErrorMessage(j, c, e); 584 return this 585 } 586 }, 587 determinePlayback: function(a, b, c, d, e) { 588 var g = [], f, i, k, h = { 589 method: "", 590 url: "", 591 htmlMediaElement: a, 592 isVideo: a.tagName.toLowerCase() != "audio" 593 }, j; 594 if (typeof b.type != "undefined" && b.type !== "") 595 if (typeof b.type == "string") 596 g.push({ 597 type: b.type, 598 url: e 599 }); 600 else 601 for (f = 0; f < b.type.length; f++) 602 g.push({ 603 type: b.type[f], 604 url: e 605 }); 606 else if (e !== null) { 607 k = this.formatType(e, a.getAttribute("type")); 608 g.push({ 609 type: k, 610 url: e 611 }) 612 } else 613 for (f = 0; f < a.childNodes.length; f++) { 614 i = a.childNodes[f]; 615 if (i.nodeType == 1 && i.tagName.toLowerCase() == "source") { 616 e = i.getAttribute("src"); 617 k = this.formatType(e, i.getAttribute("type")); 618 i = i.getAttribute("media"); 619 if (!i ||!window.matchMedia || window.matchMedia && window.matchMedia(i).matches) 620 g.push({ 621 type: k, 622 url: e 623 }) 624 } 625 } 626 if (!d && g.length > 0 && g[0].url !== null && this.getTypeFromFile(g[0].url).indexOf("audio")>-1) 627 h.isVideo = false; 628 if (mejs.MediaFeatures.isBustedAndroid) 629 a.canPlayType = function(m) { 630 return m.match(/video\/(mp4|m4v)/gi) !== null ? "maybe" : "" 631 }; 632 if (c && (b.mode === "auto" || b.mode === "auto_plugin" || b.mode === "native")&&!(mejs.MediaFeatures.isBustedNativeHTTPS && 633 b.httpsBasicAuthSite === true)) { 634 if (!d) { 635 f = document.createElement(h.isVideo ? "video" : "audio"); 636 a.parentNode.insertBefore(f, a); 637 a.style.display = "none"; 638 h.htmlMediaElement = a = f 639 } 640 for (f = 0; f < g.length; f++) 641 if (a.canPlayType(g[f].type).replace(/no/, "") !== "" || a.canPlayType(g[f].type.replace(/mp3/, "mpeg")).replace(/no/, "") !== "" || a.canPlayType(g[f].type.replace(/m4a/, "mp4")).replace(/no/, "") !== "") { 642 h.method = "native"; 643 h.url = g[f].url; 644 break 645 } 646 if (h.method === "native") { 647 if (h.url !== null) 648 a.src = h.url; 649 if (b.mode !== "auto_plugin") 650 return h 651 } 652 } 653 if (b.mode === 654 "auto" || b.mode === "auto_plugin" || b.mode === "shim") 655 for (f = 0; f < g.length; f++) { 656 k = g[f].type; 657 for (a = 0; a < b.plugins.length; a++) { 658 e = b.plugins[a]; 659 i = mejs.plugins[e]; 660 for (c = 0; c < i.length; c++) { 661 j = i[c]; 662 if (j.version == null || mejs.PluginDetector.hasPluginVersion(e, j.version)) 663 for (d = 0; d < j.types.length; d++) 664 if (k == j.types[d]) { 665 h.method = e; 666 h.url = g[f].url; 667 return h 668 } 669 } 670 } 671 } 672 if (b.mode === "auto_plugin" && h.method === "native") 673 return h; 674 if (h.method === "" && g.length > 0) 675 h.url = g[0].url; 676 return h 677 }, 678 formatType: function(a, b) { 679 return a&&!b ? this.getTypeFromFile(a) : 680 b&&~b.indexOf(";") ? b.substr(0, b.indexOf(";")) : b 681 }, 682 getTypeFromFile: function(a) { 683 a = a.split("?")[0]; 684 a = a.substring(a.lastIndexOf(".") + 1).toLowerCase(); 685 return (/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a) ? "video" : "audio") + "/" + this.getTypeFromExtension(a) 686 }, 687 getTypeFromExtension: function(a) { 688 switch (a) { 689 case "mp4": 690 case "m4v": 691 case "m4a": 692 return "mp4"; 693 case "webm": 694 case "webma": 695 case "webmv": 696 return "webm"; 697 case "ogg": 698 case "oga": 699 case "ogv": 700 return "ogg"; 701 default: 702 return a 703 } 704 }, 705 createErrorMessage: function(a, b, c) { 706 var d = 707 a.htmlMediaElement, e = document.createElement("div"); 708 e.className = "me-cannotplay"; 709 try { 710 e.style.width = d.width + "px"; 711 e.style.height = d.height + "px" 712 } catch (g) {} 713 e.innerHTML = b.customError ? b.customError : c !== "" ? '<a href="' + a.url + '"><img src="' + c + '" width="100%" height="100%" /></a>' : '<a href="' + a.url + '"><span>' + mejs.i18n.t("Download File") + "</span></a>"; 714 d.parentNode.insertBefore(e, d); 715 d.style.display = "none"; 716 b.error(d) 717 }, 718 createPlugin: function(a, b, c, d, e, g) { 719 c = a.htmlMediaElement; 720 var f = 1, i = 1, k = "me_" + a.method + "_" + mejs.meIndex++, 721 h = new mejs.PluginMediaElement(k, a.method, a.url), j = document.createElement("div"), m; 722 h.tagName = c.tagName; 723 for (m = 0; m < c.attributes.length; m++) { 724 var q = c.attributes[m]; 725 q.specified == true && h.setAttribute(q.name, q.value) 726 } 727 for (m = c.parentNode; m !== null && m.tagName.toLowerCase() !== "body" && m.parentNode != null;) { 728 if (m.parentNode.tagName.toLowerCase() === "p") { 729 m.parentNode.parentNode.insertBefore(m, m.parentNode); 730 break 731 } 732 m = m.parentNode 733 } 734 if (a.isVideo) { 735 f = b.pluginWidth > 0 ? b.pluginWidth : b.videoWidth > 0 ? b.videoWidth : c.getAttribute("width") !== 736 null ? c.getAttribute("width") : b.defaultVideoWidth; 737 i = b.pluginHeight > 0 ? b.pluginHeight : b.videoHeight > 0 ? b.videoHeight : c.getAttribute("height") !== null ? c.getAttribute("height") : b.defaultVideoHeight; 738 f = mejs.Utility.encodeUrl(f); 739 i = mejs.Utility.encodeUrl(i) 740 } else if (b.enablePluginDebug) { 741 f = 320; 742 i = 240 743 } 744 h.success = b.success; 745 mejs.MediaPluginBridge.registerPluginElement(k, h, c); 746 j.className = "me-plugin"; 747 j.id = k + "_container"; 748 a.isVideo ? c.parentNode.insertBefore(j, c) : document.body.insertBefore(j, document.body.childNodes[0]); 749 d = ["id=" + k, "isvideo=" + (a.isVideo ? "true" : "false"), "autoplay=" + (d ? "true" : "false"), "preload=" + e, "width="
749+ f, "startvolume=" + b.startVolume, "timerrate=" + b.timerRate, "flashstreamer=" + b.flashStreamer, "height=" + i, "pseudostreamstart=" + b.pseudoStreamingStartQueryParam]; 750 if (a.url !== null) 751 a.method == "flash" ? d.push("file=" + mejs.Utility.encodeUrl(a.url)) : d.push("file=" + a.url); 752 b.enablePluginDebug && d.push("debug=true"); 753 b.enablePluginSmoothing && d.push("smoothing=true"); 754 b.enablePseudoStreaming && d.push("pseudostreaming=true"); 755 g && d.push("controls=true"); 756 if (b.pluginVars) 757 d = d.concat(b.pluginVars); 758 switch (a.method) { 759 case "silverlight": 760 j.innerHTML = '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + k + '" name="' + k + '" width="' + f + '" height="' + i + '" class="mejs-shim"><param name="initParams" value="' + d.join(",") + '" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="' + 761 b.pluginPath + b.silverlightName + '" /></object>'; 762 break; 763 case "flash": 764 if (mejs.MediaFeatures.isIE) { 765 a = document.createElement("div"); 766 j.appendChild(a); 767 a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="' + k + '" width="' + f + '" height="' + i + '" class="mejs-shim"><param name="movie" value="' + b.pluginPath + b.flashName + "?x=" + new Date + '" /><param name="flashvars" value="' + d.join("&") + '" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="scale" value="default" /></object>' 768 } else 769 j.innerHTML = 770 '<embed id="' + k + '" name="' + k + '" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="' + b.pluginPath + b.flashName + '" flashvars="' + d.join("&") + '" width="' + f + '" height="' + i + '" scale="default"class="mejs-shim"></embed>'; 771 break; 772 case "youtube": 773 if (a.url.lastIndexOf("youtu.be")!=-1) { 774 a = a.url.substr(a.url.lastIndexOf("/") + 1); 775 if (a.indexOf("?") != 776 -1) 777 a = a.substr(0, a.indexOf("?")) 778 } else 779 a = a.url.substr(a.url.lastIndexOf("=") + 1); 780 youtubeSettings = { 781 container: j, 782 containerId: j.id, 783 pluginMediaElement: h, 784 pluginId: k, 785 videoId: a, 786 height: i, 787 width: f 788 }; 789 mejs.PluginDetector.hasPluginVersion("flash", [10, 0, 0]) ? mejs.YouTubeApi.createFlash(youtubeSettings) : mejs.YouTubeApi.enqueueIframe(youtubeSettings); 790 break; 791 case "vimeo": 792 b = k + "_player"; 793 h.vimeoid = a.url.substr(a.url.lastIndexOf("/") + 1); 794 j.innerHTML = '<iframe src="//player.vimeo.com/video/' + h.vimeoid + "?api=1&portrait=0&byline=0&title=0&player_id=" + 795 b + '" width="' + f + '" height="' + i + '" frameborder="0" class="mejs-shim" id="' + b + '"></iframe>'; 796 if (typeof $f == "function") { 797 var l = $f(j.childNodes[0]); 798 l.addEvent("ready", function() { 799 function o(n, p, r, s) { 800 n = { 801 type: r, 802 target: p 803 }; 804 if (r == "timeupdate") { 805 p.currentTime = n.currentTime = s.seconds; 806 p.duration = n.duration = s.duration 807 } 808 p.dispatchEvent(n.type, n) 809 } 810 l.playVideo = function() { 811 l.api("play") 812 }; 813 l.pauseVideo = function() { 814 l.api("pause") 815 }; 816 l.seekTo = function(n) { 817 l.api("seekTo", n) 818 }; 819 l.addEvent("play", function() { 820 o(l, h, "play"); 821 o(l, h, "playing") 822 }); 823 l.addEvent("pause", function() { 824 o(l, h, "pause") 825 }); 826 l.addEvent("finish", function() { 827 o(l, h, "ended") 828 }); 829 l.addEvent("playProgress", function(n) { 830 o(l, h, "timeupdate", n) 831 }); 832 h.pluginApi = l; 833 mejs.MediaPluginBridge.initPlugin(k) 834 }) 835 } else 836 console.warn("You need to include froogaloop for vimeo to work") 837 } 838 c.style.display = "none"; 839 c.removeAttribute("autoplay"); 840 return h 841 }, 842 updateNative: function(a, b) { 843 var c = a.htmlMediaElement, d; 844 for (d in mejs.HtmlMediaElement) 845 c[d] = mejs.HtmlMediaElement[d]; 846 b.success(c, c); 847 return c 848 } 849}; 850mejs.YouTubeApi = { 851 isIframeStarted: false, 852 isIframeLoaded: false, 853 loadIframeApi: function() { 854 if (!this.isIframeStarted) { 855 var a = document.createElement("script"); 856 a.src = "//www.youtube.com/player_api"; 857 var b = document.getElementsByTagName("script")[0]; 858 b.parentNode.insertBefore(a, b); 859 this.isIframeStarted = true 860 } 861 }, 862 iframeQueue: [], 863 enqueueIframe: function(a) { 864 if (this.isLoaded) 865 this.createIframe(a); 866 else { 867 this.loadIframeApi(); 868 this.iframeQueue.push(a) 869 } 870 }, 871 createIframe: function(a) { 872 var b = a.pluginMediaElement, c = new YT.Player(a.containerId, 873 { 874 height: a.height, 875 width: a.width, 876 videoId: a.videoId, 877 playerVars: { 878 controls: 0 879 }, 880 events: { 881 onReady: function() { 882 a.pluginMediaElement.pluginApi = c; 883 mejs.MediaPluginBridge.initPlugin(a.pluginId); 884 setInterval(function() { 885 mejs.YouTubeApi.createEvent(c, b, "timeupdate") 886 }, 250) 887 }, 888 onStateChange: function(d) { 889 mejs.YouTubeApi.handleStateChange(d.data, c, b) 890 } 891 } 892 }) 893 }, 894 createEvent: function(a, b, c) { 895 c = { 896 type: c, 897 target: b 898 }; 899 if (a && a.getDuration) { 900 b.currentTime = c.currentTime = a.getCurrentTime(); 901 b.duration = c.duration = a.getDuration(); 902 c.paused = b.paused; 903 c.ended = b.ended; 904 c.muted = a.isMuted(); 905 c.volume = a.getVolume() / 100; 906 c.bytesTotal = a.getVideoBytesTotal(); 907 c.bufferedBytes = a.getVideoBytesLoaded(); 908 var d = c.bufferedBytes / c.bytesTotal * c.duration; 909 c.target.buffered = c.buffered = { 910 start: function() { 911 return 0 912 }, 913 end: function() { 914 return d 915 }, 916 length: 1 917 } 918 } 919 b.dispatchEvent(c.type, c) 920 }, 921 iFrameReady: function() { 922 for (this.isIframeLoaded = this.isLoaded = true; this.iframeQueue.length > 0;) 923 this.createIframe(this.iframeQueue.pop()) 924 }, 925 flashPlayers: {}, 926 createFlash: function(a) { 927 this.flashPlayers[a.pluginId] = 928 a; 929 var b, c = "//www.youtube.com/apiplayer?enablejsapi=1&playerapiid=" + a.pluginId + "&version=3&autoplay=0&controls=0&modestbranding=1&loop=0"; 930 if (mejs.MediaFeatures.isIE) { 931 b = document.createElement("div"); 932 a.container.appendChild(b); 933 b.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/s
933hockwave/cabs/flash/swflash.cab" id="' + a.pluginId + '" width="' + a.width + '" height="' + a.height + '" class="mejs-shim"><param name="movie" value="' + 934 c + '" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>' 935 } else 936 a.container.innerHTML = '<object type="application/x-shockwave-flash" id="' + a.pluginId + '" data="' + c + '" width="' + a.width + '" height="' + a.height + '" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>' 937 }, 938 flashReady: function(a) { 939 var b = this.flashPlayers[a], c = 940 document.getElementById(a), d = b.pluginMediaElement; 941 d.pluginApi = d.pluginElement = c; 942 mejs.MediaPluginBridge.initPlugin(a); 943 c.cueVideoById(b.videoId); 944 a = b.containerId + "_callback"; 945 window[a] = function(e) { 946 mejs.YouTubeApi.handleStateChange(e, c, d) 947 }; 948 c.addEventListener("onStateChange", a); 949 setInterval(function() { 950 mejs.YouTubeApi.createEvent(c, d, "timeupdate") 951 }, 250) 952 }, 953 handleStateChange: function(a, b, c) { 954 switch (a) { 955 case -1: 956 c.paused = true; 957 c.ended = true; 958 mejs.YouTubeApi.createEvent(b, c, "loadedmetadata"); 959 break; 960 case 0: 961 c.paused = false; 962 c.ended = true; 963 mejs.YouTubeApi.createEvent(b, c, "ended"); 964 break; 965 case 1: 966 c.paused = false; 967 c.ended = false; 968 mejs.YouTubeApi.createEvent(b, c, "play"); 969 mejs.YouTubeApi.createEvent(b, c, "playing"); 970 break; 971 case 2: 972 c.paused = true; 973 c.ended = false; 974 mejs.YouTubeApi.createEvent(b, c, "pause"); 975 break; 976 case 3: 977 mejs.YouTubeApi.createEvent(b, c, "progress") 978 } 979 } 980}; 981function onYouTubePlayerAPIReady() { 982 mejs.YouTubeApi.iFrameReady() 983} 984function onYouTubePlayerReady(a) { 985 mejs.YouTubeApi.flashReady(a) 986} 987window.mejs = mejs; 988window.MediaElement = mejs.MediaElement; 989(function(a, b) { 990 var c = { 991 locale: { 992 language: "", 993 strings: {} 994 }, 995 methods: {} 996 }; 997 c.getLanguage = function() { 998 return (c.locale.language || window.navigator.userLanguage || window.navigator.language).substr(0, 2).toLowerCase() 999 }; 1000 if (typeof mejsL10n != "undefined") 1001 c.locale.language = mejsL10n.language; 1002 c.methods.checkPlain = function(d) { 1003 var e, g, f = { 1004 "&": "&", 1005 '"': """, 1006 "<": "<", 1007 ">": ">" 1008 }; 1009 d = String(d); 1010 for (e in f) 1011 if (f.hasOwnProperty(e)) { 1012 g = RegExp(e, "g"); 1013 d = d.replace(g, f[e]) 1014 } 1015 return d 1016 }; 1017 c.methods.t = function(d, e) { 1018 if (c.locale.strings && 1019 c.locale.strings[e.context] && c.locale.strings[e.context][d]) 1020 d = c.locale.strings[e.context][d]; 1021 return c.methods.checkPlain(d) 1022 }; 1023 c.t = function(d, e) { 1024 if (typeof d === "string" && d.length > 0) { 1025 var g = c.getLanguage(); 1026 e = e || { 1027 context: g 1028 }; 1029 return c.methods.t(d, e) 1030 } else 1031 throw { 1032 name: "InvalidArgumentException", 1033 message: "First argument is either not a string or empty." 1034 }; 1035 }; 1036 b.i18n = c 1037})(document, mejs); 1038(function(a) { 1039 if (typeof mejsL10n != "undefined") 1040 a[mejsL10n.language] = mejsL10n.strings 1041})(mejs.i18n.locale.strings); 1042(function(a) { 1043 if (typeof a.de === "undefined") 1044 a.de = { 1045 Fullscreen: "Vollbild", 1046 "Go Fullscreen": "Vollbild an", 1047 "Turn off Fullscreen": "Vollbild aus", 1048 Close: "Schlie\u00dfen" 1049 } 1050})(mejs.i18n.locale.strings); 1051(function(a) { 1052 if (typeof a.zh === "undefined") 1053 a.zh = { 1054 Fullscreen: "\u5168\u87a2\u5e55", 1055 "Go Fullscreen": "\u5168\u5c4f\u6a21\u5f0f", 1056 "Turn off Fullscreen": "\u9000\u51fa\u5168\u5c4f\u6a21\u5f0f", 1057 Close: "\u95dc\u9589" 1058 } 1059})(mejs.i18n.locale.strings); 1060 1061/*! 1062 * MediaElementPlayer 1063 * http://mediaelementjs.com/ 1064 * 1065 * Creates a controller bar for HTML5 <video> add <audio> tags 1066 * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper) 1067 * 1068 * Copyright 2010-2013, John Dyer (http://j.hn/) 1069 * License: MIT 1070 * 1071 */ 1072if (typeof jQuery != "undefined") 1073 mejs.$ = jQuery; 1074else if (typeof ender != "undefined") 1075 mejs.$ = ender; 1076(function(f) { 1077 mejs.MepDefaults = { 1078 poster: "", 1079 showPosterWhenEnded: false, 1080 defaultVideoWidth: 480, 1081 defaultVideoHeight: 270, 1082 videoWidth: -1, 1083 videoHeight: -1, 1084 defaultAudioWidth: 400, 1085 defaultAudioHeight: 30, 1086 defaultSeekBackwardInterval: function(a) { 1087 return a.duration * 0.05 1088 }, 1089 defaultSeekForwardInterval: function(a) { 1090 return a.duration * 0.05 1091 }, 1092 audioWidth: -1, 1093 audioHeight: -1, 1094 startVolume: 0.8, 1095 loop: false, 1096 autoRewind: true, 1097 enableAutosize: true, 1098 alwaysShowHours: false,
1099 showTimecodeFrameCount: false, 1100 framesPerSecond: 25, 1101 autosizeProgress: true, 1102 alwaysShowControls: false, 1103 hideVideoControlsOnLoad: false, 1104 clickToPlayPause: true, 1105 iPadUseNativeControls: false, 1106 iPhoneUseNativeControls: false, 1107 AndroidUseNativeControls: false, 1108 features: ["playpause", "current", "progress", "duration", "tracks", "volume", "fullscreen"], 1109 isVideo: true, 1110 enableKeyboard: true, 1111 pauseOtherPlayers: true, 1112 keyActions: [{ 1113 keys: [32, 179], 1114 action: function(a, b) { 1115 b.paused || b.ended ? a.play() : a.pause() 1116 } 1117 }, { 1118 keys: [38], 1119 action: function(a, b) { 1120 b.setVolume(Math.min(b.volume + 0.1, 1)) 1121 } 1122 }, { 1123 keys: [40], 1124 action: function(a, b) { 1125 b.setVolume(Math.max(b.volume - 1126 0.1, 0)) 1127 } 1128 }, { 1129 keys: [37, 227], 1130 action: function(a, b) { 1131 if (!isNaN(b.duration) && b.duration > 0) { 1132 if (a.isVideo) { 1133 a.showControls(); 1134 a.startControlsTimer() 1135 } 1136 var c = Math.max(b.currentTime - a.options.defaultSeekBackwardInterval(b), 0); 1137 b.setCurrentTime(c) 1138 } 1139 } 1140 }, { 1141 keys: [39, 228], 1142 action: function(a, b) { 1143 if (!isNaN(b.duration) && b.duration > 0) { 1144 if (a.isVideo) { 1145 a.showControls(); 1146 a.startControlsTimer() 1147 } 1148 var c = Math.min(b.currentTime + a.options.defaultSeekForwardInterval(b), b.duration); 1149 b.setCurrentTime(c) 1150 } 1151 } 1152 }, { 1153 keys: [70], 1154 action: function(a) { 1155 if (typeof a.enterFullScreen != 1156 "undefined") 1157 a.isFullScreen ? a.exitFullScreen() : a.enterFullScreen() 1158 } 1159 } 1160 ] 1161 }; 1162 mejs.mepIndex = 0; 1163 mejs.players = {}; 1164 mejs.MediaElementPlayer = function(a, b) { 1165 if (!(this instanceof mejs.MediaElementPlayer)) 1166 return new mejs.MediaElementPlayer(a, b); 1167 this.$media = this.$node = f(a); 1168 this.node = this.media = this.$media[0]; 1169 if (typeof this.node.player != "undefined") 1170 return this.node.player; 1171 else 1172 this.node.player = this; 1173 if (typeof b == "undefined") 1174 b = this.$node.data("mejsoptions"); 1175 this.options = f.extend({}, mejs.MepDefaults, b); 1176 this.id = "mep_" + mejs.mepIndex++; 1177 mejs.players[this.id] = this; 1178 this.init(); 1179 return this 1180 }; 1181 mejs.MediaElementPlayer.prototype = { 1182 hasFocus: false, 1183 controlsAreVisible: true, 1184 init: function() { 1185 var a = this, b = mejs.MediaFeatures, c = f.extend(true, {}, a.options, { 1186 success: function(d, g) { 1187 a.meReady(d, g) 1188 }, 1189 error: function(d) { 1190 a.handleError(d) 1191 } 1192 }), e = a.media.tagName.toLowerCase(); 1193 a.isDynamic = e !== "audio" && e !== "video"; 1194 a.isVideo = a.isDynamic ? a.options.isVideo : e !== "audio" && a.options.isVideo; 1195 if (b.isiPad && a.options.iPadUseNativeControls || b.isiPhone && a.options.iPhoneUseNativeControls) { 1196 a.$media.attr("controls", 1197 "controls"); 1198 b.isiPad && a.media.getAttribute("autoplay") !== null && a.play() 1199 } else if (!(b.isAndroid && a.options.AndroidUseNativeControls)) { 1200 a.$media.removeAttr("controls"); 1201 a.container = f('<div id="' + a.id + '" class="mejs-container ' + (mejs.MediaFeatures.svg ? "svg" : "no-svg") + '"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media); 1202 a.container.addClass((b.isAndroid ? 1203 "mejs-android " : "") + (b.isiOS ? "mejs-ios " : "") + (b.isiPad ? "mejs-ipad " : "") + (b.isiPhone ? "mejs-iphone " : "") + (a.isVideo ? "mejs-video " : "mejs-audio ")); 1204 if (b.isiOS) { 1205 b = a.$media.clone(); 1206 a.container.find(".mejs-mediaelement").append(b); 1207 a.$media.remove(); 1208 a.$node = a.$media = b; 1209 a.node = a.media = b[0] 1210 } else 1211 a.container.find(".mejs-mediaelement").append(a.$media); 1212 a.controls = a.container.find(".mejs-controls"); 1213 a.layers = a.container.find(".mejs-layers"); 1214 b = a.isVideo ? "video" : "audio"; 1215 e = b.substring(0, 1).toUpperCase() + b.substring(1); 1216 a.width = a.options[b + "Width"] > 0 || a.options[b + "Width"].toString().indexOf("%")>-1 ? a.options[b + "Width"] : a.media.style.width !== "" && a.media.style.width !== null ? a.media.style.width : a.media.getAttribute("width") !== null ? a.$media.attr("width") : a.options["default" + e + "Width"]; 1217 a.height = a.options[b + "Height"] > 0 || a.options[b + "Height"].toString().indexOf("%")>-1 ? a.options[b + "Height"] : a.media.style.height !== "" && a.media.style.height !== null ? a.media.style.height : a.$media[0].getAttribute("height") !== null ? a.$media.attr("height") : 1218 a.options["default" + e + "Height"]; 1219 a.setPlayerSize(a.width, a.height); 1220 c.pluginWidth = a.width; 1221 c.pluginHeight = a.height 1222 } 1223 mejs.MediaElement(a.$media[0], c); 1224 typeof a.container != "undefined" && a.controlsAreVisible && a.container.trigger("controlsshown") 1225 }, 1226 showControls: function(a) { 1227 var b = this; 1228 a = typeof a == "undefined" || a; 1229 if (!b.controlsAreVisible) { 1230 if (a) { 1231 b.controls.css("visibility", "visible").stop(true, true).fadeIn(200, function() { 1232 b.controlsAreVisible = true; 1233 b.container.trigger("controlsshown") 1234 }); 1235 b.container.find(".mejs-control").css("visibility", 1236 "visible").stop(true, true).fadeIn(200, function() { 1237 b.controlsAreVisible = true 1238 }) 1239 } else { 1240 b.controls.css("visibility", "visible").css("display", "block"); 1241 b.container.find(".mejs-control").css("visibility", "visible").css("display", "block"); 1242 b.controlsAreVisible = true; 1243 b.container.trigger("controlsshown") 1244 } 1245 b.setControlsSize() 1246 } 1247 }, 1248 hideControls: function(a) { 1249 var b = this; 1250 a = typeof a == "undefined" || a; 1251 if (!(!b.controlsAreVisible || b.options.alwaysShowControls)) 1252 if (a) { 1253 b.controls.stop(true, true).fadeOut(200, function() { 1254 f(this).css("visibility", 1255 "hidden").css("display", "block"); 1256 b.controlsAreVisible = false;
1257 b.container.trigger("controlshidden") 1258 }); 1259 b.container.find(".mejs-control").stop(true, true).fadeOut(200, function() { 1260 f(this).css("visibility", "hidden").css("display", "block") 1261 }) 1262 } else { 1263 b.controls.css("visibility", "hidden").css("display", "block"); 1264 b.container.find(".mejs-control").css("visibility", "hidden").css("display", "block"); 1265 b.controlsAreVisible = false; 1266 b.container.trigger("controlshidden") 1267 } 1268 }, 1269 controlsTimer: null, 1270 startControlsTimer: function(a) { 1271 var b = 1272 this; 1273 a = typeof a != "undefined" ? a : 1500; 1274 b.killControlsTimer("start"); 1275 b.controlsTimer = setTimeout(function() { 1276 b.hideControls(); 1277 b.killControlsTimer("hide") 1278 }, a) 1279 }, 1280 killControlsTimer: function() { 1281 if (this.controlsTimer !== null) { 1282 clearTimeout(this.controlsTimer); 1283 delete this.controlsTimer; 1284 this.controlsTimer = null 1285 } 1286 }, 1287 controlsEnabled: true, 1288 disableControls: function() { 1289 this.killControlsTimer(); 1290 this.hideControls(false); 1291 this.controlsEnabled = false 1292 }, 1293 enableControls: function() { 1294 this.showControls(false); 1295 this.controlsEnabled = true 1296 }, 1297 meReady: function(a, b) { 1298 var c = this, e = mejs.MediaFeatures, d = b.getAttribute("autoplay"); 1299 d=!(typeof d == "undefined" || d === null || d === "false"); 1300 var g; 1301 if (!c.created) { 1302 c.created = true; 1303 c.media = a; 1304 c.domNode = b; 1305 if (!(e.isAndroid && c.options.AndroidUseNativeControls)&&!(e.isiPad && c.options.iPadUseNativeControls)&&!(e.isiPhone && c.options.iPhoneUseNativeControls)) { 1306 c.buildposter(c, c.controls, c.layers, c.media); 1307 c.buildkeyboard(c, c.controls, c.layers, c.media); 1308 c.buildoverlays(c, c.controls, c.layers, c.media); 1309 c.findTracks(); 1310 for (g in c.options.features) { 1311 e = 1312 c.options.features[g]; 1313 if (c["build" + e]) 1314 try { 1315 c["build" + e](c, c.controls, c.layers, c.media) 1316 } catch (k) {} 1317 } 1318 c.container.trigger("controlsready"); 1319 c.setPlayerSize(c.width, c.height); 1320 c.setControlsSize(); 1321 if (c.isVideo) { 1322 if (mejs.MediaFeatures.hasTouch) 1323 c.$media.bind("touchstart", function() { 1324 if (c.controlsAreVisible) 1325 c.hideControls(false); 1326 else 1327 c.controlsEnabled && c.showControls(false) 1328 }); 1329 else { 1330 c.clickToPlayPauseCallback = function() { 1331 if (c.options.clickToPlayPause) 1332 c.media.paused ? c.play() : c.pause() 1333 }; 1334 c.media.addEventListener("click", 1335 c.clickToPlayPauseCallback, false); 1336 c.container.bind("mouseenter mouseover", function() { 1337 if (c.controlsEnabled) 1338 if (!c.options.alwaysShowControls) { 1339 c.killControlsTimer("enter"); 1340 c.showControls(); 1341 c.startControlsTimer(2500) 1342 } 1343 }).bind("mousemove", function() { 1344 if (c.controlsEnabled) { 1345 c.controlsAreVisible || c.showControls(); 1346 c.options.alwaysShowControls || c.startControlsTimer(2500) 1347 } 1348 }).bind("mouseleave", function() { 1349 c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls && c.startControlsTimer(1E3) 1350 }) 1351 } 1352 c.options.hideVideoControlsOnLoad && 1353 c.hideControls(false); 1354 d&&!c.options.alwaysShowControls && c.hideControls(); 1355 c.options.enableAutosize && c.media.addEventListener("loadedmetadata", function(j) { 1356 if (c.options.videoHeight <= 0 && c.domNode.getAttribute("height") === null&&!isNaN(j.target.videoHeight)) { 1357 c.setPlayerSize(j.target.videoWidth, j.target.videoHeight); 1358 c.setControlsSize(); 1359 c.media.setVideoSize(j.target.videoWidth, j.target.videoHeight) 1360 } 1361 }, false) 1362 } 1363 a.addEventListener("play", function() { 1364 for (var j in mejs.players) { 1365 var m = mejs.players[j]; 1366 m.id != c.id && 1367 c.options.pauseOtherPlayers&&!m.paused&&!m.ended && m.pause(); 1368 m.hasFocus = false 1369 } 1370 c.hasFocus = true 1371 }, false); 1372 c.media.addEventListener("ended", function() { 1373 if (c.options.autoRewind) 1374 try { 1375 c.media.setCurrentTime(0) 1376 } catch (j) {} 1377 c.media.pause(); 1378 c.setProgressRail && c.setProgressRail(); 1379 c.setCurrentRail && c.setCurrentRail(); 1380 if (c.options.loop) 1381 c.play(); 1382 else 1383 !c.options.alwaysShowControls && c.controlsEnabled && c.showControls() 1384 }, false); 1385 c.media.addEventListener("loadedmetadata", function() { 1386 c.updateDuration && c.updateDuration(); 1387 c.updateCurrent && 1388 c.updateCurrent(); 1389 if (!c.isFullScreen) { 1390 c.setPlayerSize(c.width, c.height); 1391 c.setControlsSize() 1392 } 1393 }, false); 1394 setTimeout(function() { 1395 c.setPlayerSize(c.width, c.height); 1396 c.setControlsSize() 1397 }, 50); 1398 c.globalBind("resize", function() { 1399 c.isFullScreen || mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen || c.setPlayerSize(c.width, c.height); 1400 c.setControlsSize() 1401 }); 1402 c.media.pluginType == "youtube" && c.container.find(".mejs-overlay-play").hide() 1403 } 1404 d && a.pluginType == "native" && c.play(); 1405 if (c.options.success)typeof c.options.success == 1406 "string" ? window[c.options.success](c.media, c.domNode, c): c.options.success(c.media, c.domNode, c) 1407 } 1408 }, handleError: function(a) { 1409 this.controls.hide(); 1410 this.options.error && this.options.error(a) 1411 }, setPlayerSize: function(a, b) { 1412 if (typeof a != "undefined") 1413 this.width = a; 1414 if (typeof b != "undefined") 1415 this.height = b; 1416 if (this.height.toString().indexOf("%") > 0 || this.$node.css("max-width") === "100%" || parseInt(this.$node.css("max-width").replace(/px/, ""), 10) / this.$n
1416ode.offsetParent().width() === 1 || this.$node[0].currentStyle && this.$node[0].currentStyle.maxWidth === 1417 "100%") { 1418 var c = this.isVideo ? this.media.videoWidth && this.media.videoWidth > 0 ? this.media.videoWidth: this.options.defaultVideoWidth: this.options.defaultAudioWidth, e = this.isVideo ? this.media.videoHeight && this.media.videoHeight > 0 ? this.media.videoHeight: this.options.defaultVideoHeight: this.options.defaultAudioHeight, d = this.container.parent().closest(":visible").width(); 1419 c = this.isVideo ||!this.options.autosizeProgress ? parseInt(d * e / c, 10) : e; 1420 if (isNaN(c)) 1421 c = this.container.parent().closest(":visible").height(); 1422 if (this.container.parent()[0].tagName.toLowerCase() === 1423 "body") { 1424 d = f(window).width(); 1425 c = f(window).height() 1426 } 1427 if (c != 0 && d != 0) { 1428 this.container.width(d).height(c); 1429 this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%"); 1430 this.isVideo && this.media.setVideoSize && this.media.setVideoSize(d, c); 1431 this.layers.children(".mejs-layer").width("100%").height("100%") 1432 } 1433 } else { 1434 this.container.width(this.width).height(this.height); 1435 this.layers.children(".mejs-layer").width(this.width).height(this.height) 1436 } 1437 d = this.layers.find(".mejs-overlay-play"); 1438 c = d.find(".mejs-overlay-button"); 1439 d.height(this.container.height() - this.controls.height()); 1440 c.css("margin-top", "-" + (c.height() / 2 - this.controls.height() / 2).toString() + "px") 1441 }, setControlsSize: function() { 1442 var a = 0, b = 0, c = this.controls.find(".mejs-time-rail"), e = this.controls.find(".mejs-time-total"); 1443 this.controls.find(".mejs-time-current"); 1444 this.controls.find(".mejs-time-loaded"); 1445 var d = c.siblings(), g = d.last(), k = null; 1446 if (!(!this.container.is(":visible") ||!c.length ||!c.is(":visible"))) { 1447 if (this.options&&!this.options.autosizeProgress) 1448 b = parseInt(c.css("width")); 1449 if (b === 0 ||!b) { 1450 d.each(function() { 1451 var j = f(this); 1452 if (j.css("position") != "absolute" && j.is(":visible")) 1453 a += f(this).outerWidth(true) 1454 }); 1455 b = this.controls.width() - a - (c.outerWidth(true) - c.width()) 1456 } 1457 do { 1458 c.width(b); 1459 e.width(b - (e.outerWidth(true) - e.width())); 1460 if (g.css("position") != "absolute") { 1461 k = g.position(); 1462 b-- 1463 } 1464 } 1465 while (k != null && k.top > 0 && b > 0); 1466 this.setProgressRail && this.setProgressRail(); 1467 this.setCurrentRail && this.setCurrentRail() 1468 } 1469 }, buildposter: function(a, b, c, e) { 1470 var d = f('<div class="mejs-poster mejs-layer"></div>').appendTo(c); 1471 b = a.$media.attr("poster"); 1472 if (a.options.poster !== "") 1473 b = a.options.poster; 1474 b !== "" && b != null ? this.setPoster(b) : d.hide(); 1475 e.addEventListener("play", function() { 1476 d.hide() 1477 }, false); 1478 a.options.showPosterWhenEnded && a.options.autoRewind && e.addEventListener("ended", function() { 1479 d.show() 1480 }, false) 1481 }, setPoster: function(a) { 1482 var b = this.container.find(".mejs-poster"), c = b.find("img"); 1483 if (c.length == 0) 1484 c = f('<img width="100%" height="100%" />').appendTo(b); 1485 c.attr("src", a); 1486 b.css({ 1487 "background-image": "url(" + a + ")" 1488 }) 1489 }, buildoverlays: function(a, 1490 b, c, e) { 1491 var d = this; 1492 if (a.isVideo) { 1493 var g = f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c), k = f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c), j = f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).bind("click touchstart", function() { 1494 d.options.clickToPlayPause && e.paused && e.play() 1495 }); 1496 e.addEventListener("play", function() { 1497 j.hide(); 1498 g.hide(); 1499 b.find(".mejs-time-buffering").hide(); 1500 k.hide() 1501 }, false); 1502 e.addEventListener("playing", function() { 1503 j.hide(); 1504 g.hide(); 1505 b.find(".mejs-time-buffering").hide(); 1506 k.hide() 1507 }, false); 1508 e.addEventListener("seeking", function() { 1509 g.show(); 1510 b.find(".mejs-time-buffering").show() 1511 }, false); 1512 e.addEventListener("seeked", function() { 1513 g.hide(); 1514 b.find(".mejs-time-buffering").hide() 1515 }, false); 1516 e.addEventListener("pause", function() { 1517 mejs.MediaFeatures.isiPhone || j.show() 1518 }, false); 1519 e.addEventListener("waiting", function() { 1520 g.show(); 1521 b.find(".mejs-time-buffering").show() 1522 }, 1523 false); 1524 e.addEventListener("loadeddata", function() { 1525 g.show(); 1526 b.find(".mejs-time-buffering").show() 1527 }, false); 1528 e.addEventListener("canplay", function() { 1529 g.hide(); 1530 b.find(".mejs-time-buffering").hide() 1531 }, false); 1532 e.addEventListener("error", function() { 1533 g.hide(); 1534 b.find(".mejs-time-buffering").hide(); 1535 k.show(); 1536 k.find("mejs-overlay-error").html("Error loading this resource") 1537 }, false) 1538 } 1539 }, buildkeyboard: function(a, b, c, e) { 1540 this.globalBind("keydown", function(d) { 1541 if (a.hasFocus && a.options.enableKeyboard) 1542 for (var g = 0, k = a.options.keyActions.length; g < 1543 k; g++) 1544 for (var j = a.options.keyActions[g], m = 0, q = j.keys.length; m < q; m++) 1545 if (d.keyCode == j.keys[m]) { 1546 d.preventDefault(); 1547 j.action(a, e, d.keyCode); 1548 return false 1549 } 1550 return true 1551 }); 1552 this.globalBind("click", function(d) { 1553 a.hasFocus = f(d.target).closest(".mejs-container").length != 0 1554 }) 1555 }, findTracks: function() { 1556 var a = this, b = a.$media.find("track"); 1557 a.tracks = []; 1558 b.each(function(c, e) { 1559 e = f(e); 1560 a.tracks.push({ 1561 srclang: e.attr("srclang") ? e.attr("srclang").toLowerCase(): "", 1562 src: e.attr("src"), 1563 kind: e.attr("kind"), 1564 label: e.attr("label") || "",
1565 entries: [], 1566 isLoaded: false 1567 }) 1568 }) 1569 }, changeSkin: function(a) { 1570 this.container[0].className = "mejs-container " + a; 1571 this.setPlayerSize(this.width, this.height); 1572 this.setControlsSize() 1573 }, play: function() { 1574 this.load(); 1575 this.media.play() 1576 }, pause: function() { 1577 try { 1578 this.media.pause() 1579 } catch (a) {} 1580 }, load: function() { 1581 this.isLoaded || this.media.load(); 1582 this.isLoaded = true 1583 }, setMuted: function(a) { 1584 this.media.setMuted(a) 1585 }, setCurrentTime: function(a) { 1586 this.media.setCurrentTime(a) 1587 }, getCurrentTime: function() { 1588 return this.media.currentTime 1589 }, setVolume: function(a) { 1590 this.media.setVolume(a) 1591 }, 1592 getVolume: function() { 1593 return this.media.volume 1594 }, setSrc: function(a) { 1595 this.media.setSrc(a) 1596 }, remove: function() { 1597 var a, b; 1598 for (a in this.options.features) { 1599 b = this.options.features[a]; 1600 if (this["clean" + b]) 1601 try { 1602 this["clean" + b](this) 1603 } catch (c) {} 1604 } 1605 if (this.isDynamic) 1606 this.$node.insertBefore(this.container); 1607 else { 1608 this.$media.prop("controls", true); 1609 this.$node.clone().show().insertBefore(this.container); 1610 this.$node.remove() 1611 } 1612 this.media.pluginType !== "native" && this.media.remove(); 1613 delete mejs.players[this.id]; 1614 typeof this.container == 1615 "object" && this.container.remove(); 1616 this.globalUnbind(); 1617 delete this.node.player 1618 } 1619 }; 1620 (function() { 1621 function a(c, 1622 e) { 1623 var d = { 1624 d: [], 1625 w: [] 1626 }; 1627 f.each((c || "").split(" "), function(g, k) { 1628 var j = k + "." + e; 1629 if (j.indexOf(".") === 0) { 1630 d.d.push(j); 1631 d.w.push(j) 1632 } else 1633 d[b.test(k) ? "w": "d"].push(j) 1634 }); 1635 d.d = d.d.join(" "); 1636 d.w = d.w.join(" "); 1637 return d 1638 } 1639 var b = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/; mejs.MediaElementPlayer.prototype.globalBind = function(c, e, d) { 1640 c = a(c, this.id); 1641 c.d && f(document).bind(c.d, e, d); 1642 c.w && f(window).bind(c.w, e, d) 1643 }; 1644 mejs.MediaElementPlayer.prototype.globalUnbind = function(c, e) { 1645 c = a(c, this.id); 1646 c.d && f(document).unbind(c.d, e); 1647 c.w && f(window).unbind(c.w, e) 1648 } 1649 })(); 1650 if (typeof jQuery != "undefined") 1651 jQuery.fn.mediaelementplayer = function(a) { 1652 a === false ? this.each(function() { 1653 var b = jQuery(this).data("mediaelementplayer"); 1654 b && b.remove(); 1655 jQuery(this).removeData("mediaelementplayer") 1656 }) : this.each(function() { 1657 jQuery(this).data("mediaelementplayer", new mejs.MediaElementPlayer(this, 1658 a)) 1659 }); 1660 return this 1661 }; 1662 f(document).ready(function() { 1663 f(".mejs-player").mediaelementplayer() 1664 }); 1665 window.MediaElementPlayer = mejs.MediaElementPlayer 1666})(mejs.$); 1667(function(f) { 1668 f.extend(mejs.MepDefaults, { 1669 playpauseText: mejs.i18n.t("Play/Pause") 1670 }); 1671 f.extend(MediaElementPlayer.prototype, { 1672 buildplaypause: function(a, b, c, e) { 1673 var d = f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="' + this.id + '" title="' + this.options.playpauseText + '" aria-label="' + this.options.playpauseText + '"></button></div>').appendTo(b).click(function(g) { 1674 g.preventDefault(); 1675 e.paused ? e.play() : e.pause(); 1676 return false 1677 }); 1678 e.addEventListener("play", function() { 1679 d.removeClass("mejs-play").addClass("mejs-pause") 1680 }, 1681 false); 1682 e.addEventListener("playing", function() { 1683 d.removeClass("mejs-play").addClass("mejs-pause") 1684 }, false); 1685 e.addEventListener("pause", function() { 1686 d.removeClass("mejs-pause").addClass("mejs-play") 1687 }, false); 1688 e.addEventListener("paused", function() { 1689 d.removeClass("mejs-pause").addClass("mejs-play") 1690 }, false) 1691 } 1692 }) 1693})(mejs.$); 1694(function(f) { 1695 f.extend(mejs.MepDefaults, { 1696 stopText: "Stop" 1697 }); 1698 f.extend(MediaElementPlayer.prototype, { 1699 buildstop: function(a, b, c, e) { 1700 f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="' + this.id + '" title="' + this.options.stopText + '" aria-label="' + this.options.stopText + '"></button></div>').appendTo(b).click(function() { 1701 e.paused || e.pause(); 1702 if (e.currentTime > 0) { 1703 e.setCurrentTime(0); 1704 e.pause(); 1705 b.find(".mejs-time-current").width("0px"); 1706 b.find(".mejs-time-handle").css("left", 1707 "0px"); 1708 b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0)); 1709 b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0)); 1710 c.find(".mejs-poster").show() 1711 } 1712 }) 1713 } 1714 }) 1715})(mejs.$); 1716(function(f) { 1717 f.extend(MediaElementPlayer.prototype, { 1718 buildprogress: function(a, b, c, e) { 1719 f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(b); 1720 b.find(".mejs-time-buffering").hide(); 1721 var d = 1722 this, g = b.find(".mejs-time-total"); 1723 c = b.find(".mejs-time-loaded"); 1724 var k = b.find(".mejs-time-current"), j = b.find(".mejs-time-handle"), m = b.find(".mejs-time-float"), q = b.find(".mejs-time-float-current"), p = function(h) { 1725 h = h.originalEvent.changedTouches ? h.originalEvent.changedTouches[0].pageX : h.pageX; 1726 var l = g.offset(), r = g.outerWidth(true), n = 0, o = n = 0; 1727 if (e.duration) { 1728 if (h < l.left) 1729 h = l.left; 1730 else if (h > r + l.left) 1731 h = r + l.left; 1732 o = h - l.left; 1733 n = o / r; 1734 n = n <= 0.02 ? 0 : n * e.duration; 1735 t && n !== e.currentTime && e.setCurrentTime(n); 1736 if (!mejs.MediaFeatures.hasTouch) { 1737 m.css("left", 1738 o); 1739 q.html(mejs.Utility.secondsToTimeCode(n)); 1740 m.show() 1741 } 1742 } 1743 }, t = false;
1744 g.bind("mousedown touchstart", function(h) { 1745 if (h.which === 1 || h.which === 0) { 1746 t = true; 1747 p(h); 1748 d.globalBind("mousemove.dur touchmove.dur", function(l) { 1749 p(l) 1750 }); 1751 d.globalBind("mouseup.dur touchend.dur", function() { 1752 t = false; 1753 m.hide(); 1754 d.globalUnbind(".dur") 1755 }); 1756 return false 1757 } 1758 }).bind("mouseenter", function() { 1759 d.globalBind("mousemove.dur", function(h) { 1760 p(h) 1761 }); 1762 mejs.MediaFeatures.hasTouch || m.show() 1763 }).bind("mouseleave", function() { 1764 if (!t) { 1765 d.globalUnbind(".dur"); 1766 m.hide() 1767 } 1768 }); 1769 e.addEventListener("progress", function(h) { 1770 a.setProgressRail(h); 1771 a.setCurrentRail(h) 1772 }, false); 1773 e.addEventListener("timeupdate", function(h) { 1774 a.setProgressRail(h); 1775 a.setCurrentRail(h) 1776 }, false); 1777 d.loaded = c; 1778 d.total = g; 1779 d.current = k; 1780 d.handle = j 1781 }, 1782 setProgressRail: function(a) { 1783 var b = a != undefined ? a.target: this.media, c = null; 1784 if (b && b.buffered && b.buffered.length > 0 && b.buffered.end && b.duration) 1785 c = b.buffered.end(0) / b.duration; 1786 else if (b && b.bytesTotal != undefined && b.bytesTotal > 0 && b.bufferedBytes != undefined) 1787 c = b.bufferedBytes / b.bytesTotal; 1788 else if (a && a.lengthComputable && a.total != 0) 1789 c = a.loaded / a.total; 1790 if (c !== null) { 1791 c = Math.min(1, Math.max(0, c)); 1792 this.loaded && this.total && this.loaded.width(this.total.width() * c) 1793 } 1794 }, 1795 setCurrentRail: function() { 1796 if (this.media.currentTime != undefined && this.media.duration) 1797 if (this.total && this.handle) { 1798 var a = Math.round(this.total.width() * this.media.currentTime / this.media.duration), b = a - Math.round(this.handle.outerWidth(true) / 2); 1799 this.current.width(a); 1800 this.handle.css("left", b) 1801 } 1802 } 1803 }) 1804})(mejs.$); 1805(function(f) { 1806 f.extend(mejs.MepDefaults, { 1807 duration: -1, 1808 timeAndDurationSeparator: "<span> | </span>" 1809 }); 1810 f.extend(MediaElementPlayer.prototype, { 1811 buildcurrent: function(a, b, c, e) { 1812 f('<div class="mejs-time"><span class="mejs-currenttime">' + (a.options.alwaysShowHours ? "00:" : "") + (a.options.showTimecodeFrameCount ? "00:00:00" : "00:00") + "</span></div>").appendTo(b); 1813 this.currenttime = this.controls.find(".mejs-currenttime"); 1814 e.addEventListener("timeupdate", function() { 1815 a.updateCurrent() 1816 }, false) 1817 }, 1818 buildduration: function(a, b, 1819 c, e) { 1820 if (b.children().last().find(".mejs-currenttime").length > 0) 1821 f(this.options.timeAndDurationSeparator + '<span class="mejs-duration">' + (this.options.duration > 0 ? mejs.Utility.secondsToTimeCode(this.options.duration, this.options.alwaysShowHours || this.media.duration > 3600, this.options.showTimecodeFrameCount, this.options.framesPerSecond || 25) : (a.options.alwaysShowHours ? "00:" : "") + (a.options.showTimecodeFrameCount ? "00:00:00" : "00:00")) + "</span>").appendTo(b.find(".mejs-time")); 1822 else { 1823 b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"); 1824 f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">' + (this.options.duration > 0 ? mejs.Utility.secondsToTimeCode(this.options.duration, this.options.alwaysShowHours || this.media.duration >
1824 3600, this.options.showTimecodeFrameCount, this.options.framesPerSecond || 25) : (a.options.alwaysShowHours ? "00:" : "") + (a.options.showTimecodeFrameCount ? "00:00:00" : "00:00")) + "</span></div>").appendTo(b) 1825 } 1826 this.durationD = this.controls.find(".mejs-duration"); 1827 e.addEventListener("timeupdate", function() { 1828 a.updateDuration() 1829 }, 1830 false) 1831 }, 1832 updateCurrent: function() { 1833 if (this.currenttime) 1834 this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime, this.options.alwaysShowHours || this.media.duration > 3600, this.options.showTimecodeFrameCount, this.options.framesPerSecond || 25)) 1835 }, 1836 updateDuration: function() { 1837 this.container.toggleClass("mejs-long-video", this.media.duration > 3600); 1838 if (this.durationD && (this.options.duration > 0 || this.media.duration)) 1839 this.durationD.html(mejs.Utility.secondsToTimeCode(this.options.duration > 0 ? this.options.duration : 1840 this.media.duration, this.options.alwaysShowHours, this.options.showTimecodeFrameCount, this.options.framesPerSecond || 25)) 1841 } 1842 }) 1843})(mejs.$); 1844(function(f) { 1845 f.extend(mejs.MepDefaults, { 1846 muteText: mejs.i18n.t("Mute Toggle"), 1847 hideVolumeOnTouchDevices: true, 1848 audioVolume: "horizontal", 1849 videoVolume: "vertical" 1850 }); 1851 f.extend(MediaElementPlayer.prototype, { 1852 buildvolume: function(a, b, c, e) { 1853 if (!((mejs.MediaFeatures.isAndroid || mejs.MediaFeatures.isiOS) && this.options.hideVolumeOnTouchDevices)) { 1854 var d = this, g = d.isVideo ? d.options.videoVolume: d.options.audioVolume, k = g == "horizontal" ? f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="' + 1855 d.id + '" title="' + d.options.muteText + '" aria-label="' + d.options.muteText + '"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b): f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="' + d.id + '" title="' + d.options.muteText + '" aria-label="' + d.options.muteText + '"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(b), 1856 j = d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"), m = d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"), q = d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"), p = d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"), t = function(n, o) { 1857 if (!j.is(":visible") && typeof o == "undefined") { 1858 j.show(); 1859 t(n, true); 1860 j.hide() 1861 } else { 1862 n = Math.max(0, n); 1863 n = Math.min(n, 1); 1864 n == 0 ? k.removeClass("mejs-mute").addClass("mejs-unmute") : k.removeClass("mejs-unmute").addClass("mejs-mute"); 1865 if (g == "vertical") { 1866 var s = m.height(), u = m.position(), v = s - s * n; 1867 p.css("top", Math.round(u.top + v - p.height() / 2)); 1868 q.height(s - v); 1869 q.css("top", u.top + v) 1870 } else { 1871 s = m.width(); 1872 u = m.position(); 1873 s = s * n; 1874 p.css("left", Math.round(u.left + s - p.width() / 2)); 1875 q.width(Math.round(s)) 1876 } 1877 } 1878 }, h = function(n) { 1879 var o = null, s = m.offset(); 1880 if (g == "vertical") { 1881 o = m.height(); 1882 parseInt(m.css("top").replace(/px/, ""), 10); 1883 o = (o - (n.pageY - s.top)) / o; 1884 if (s.top == 0 || s.left == 0) 1885 return 1886 } else { 1887 o = m.width();
1888 o = (n.pageX - s.left) / o 1889 } 1890 o = Math.max(0, o); 1891 o = Math.min(o, 1); 1892 t(o); 1893 o == 0 ? e.setMuted(true) : 1894 e.setMuted(false); 1895 e.setVolume(o) 1896 }, l = false, r = false; 1897 k.hover(function() { 1898 j.show(); 1899 r = true 1900 }, function() { 1901 r = false; 1902 !l && g == "vertical" && j.hide() 1903 }); 1904 j.bind("mouseover", function() { 1905 r = true 1906 }).bind("mousedown", function(n) { 1907 h(n); 1908 d.globalBind("mousemove.vol", function(o) { 1909 h(o) 1910 }); 1911 d.globalBind("mouseup.vol", function() { 1912 l = false; 1913 d.globalUnbind(".vol"); 1914 !r && g == "vertical" && j.hide() 1915 }); 1916 l = true; 1917 return false 1918 }); 1919 k.find("button").click(function() { 1920 e.setMuted(!e.muted) 1921 }); 1922 e.addEventListener("volumechange", function() { 1923 if (!l) 1924 if (e.muted) { 1925 t(0); 1926 k.removeClass("mejs-mute").addClass("mejs-unmute") 1927 } else { 1928 t(e.volume); 1929 k.removeClass("mejs-unmute").addClass("mejs-mute") 1930 } 1931 }, false); 1932 if (d.container.is(":visible")) { 1933 t(a.options.startVolume); 1934 a.options.startVolume === 0 && e.setMuted(true); 1935 e.pluginType === "native" && e.setVolume(a.options.startVolume) 1936 } 1937 } 1938 } 1939 }) 1940})(mejs.$); 1941(function(f) { 1942 f.extend(mejs.MepDefaults, { 1943 usePluginFullScreen: true, 1944 newWindowCallback: function() { 1945 return "" 1946 }, 1947 fullscreenText: mejs.i18n.t("Fullscreen") 1948 }); 1949 f.extend(MediaElementPlayer.prototype, { 1950 isFullScreen: false, 1951 isNativeFullScreen: false, 1952 isInIframe: false, 1953 buildfullscreen: function(a, b, c, e) { 1954 if (a.isVideo) { 1955 a.isInIframe = window.location != window.parent.location; 1956 if (mejs.MediaFeatures.hasTrueNativeFullScreen) { 1957 c = function() { 1958 if (a.isFullScreen) 1959 if (mejs.MediaFeatures.isFullScreen()) { 1960 a.isNativeFullScreen = true; 1961 a.setControlsSize() 1962 } else { 1963 a.isNativeFullScreen = 1964 false; 1965 a.exitFullScreen() 1966 } 1967 }; 1968 mejs.MediaFeatures.hasMozNativeFullScreen ? a.globalBind(mejs.MediaFeatures.fullScreenEventName, c) : a.container.bind(mejs.MediaFeatures.fullScreenEventName, c) 1969 } 1970 var d = this, g = f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="' + d.id + '" title="' + d.options.fullscreenText + '" aria-label="' + d.options.fullscreenText + '"></button></div>').appendTo(b); 1971 if (d.media.pluginType === "native" ||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox) 1972 g.click(function() { 1973 mejs.MediaFeatures.hasTrueNativeFullScreen && 1974 mejs.MediaFeatures.isFullScreen() || a.isFullScreen ? a.exitFullScreen() : a.enterFullScreen() 1975 }); 1976 else { 1977 var k = null; 1978 if (function() { 1979 var h = document.createElement("x"), l = document.documentElement, r = window.getComputedStyle; 1980 if (!("pointerEvents"in h.style)) 1981 return false;
1982 h.style.pointerEvents = "auto"; 1983 h.style.pointerEvents = "x"; 1984 l.appendChild(h); 1985 r = r && r(h, "").pointerEvents === "auto"; 1986 l.removeChild(h); 1987 return !!r 1988 }()&&!mejs.MediaFeatures.isOpera) { 1989 var j = false, m = function() { 1990 if (j) { 1991 for (var h in q) 1992 q[h].hide(); 1993 g.css("pointer-events", 1994 ""); 1995 d.controls.css("pointer-events", ""); 1996 d.media.removeEventListener("click", d.clickToPlayPauseCallback); 1997 j = false 1998 } 1999 }, q = {}; 2000 b = ["top", "left", "right", "bottom"]; 2001 var p, t = function() { 2002 var h = g.offset().left - d.container.offset().left, l = g.offset().top - d.container.offset().top, r = g.outerWidth(true), n = g.outerHeight(true), o = d.container.width(), s = d.container.height(); 2003 for (p in q) 2004 q[p].css({ 2005 position: "absolute", 2006 top: 0, 2007 left: 0 2008 }); 2009 q.top.width(o).height(l); 2010 q.left.width(h).height(n).css({ 2011 top: l 2012 }); 2013 q.right.width(o - h - r).height(n).css({ 2014 top: l, 2015 left: h + r 2016 }); 2017 q.bottom.width(o).height(s - n - l).css({ 2018 top: l + n 2019 }) 2020 }; 2021 d.globalBind("resize", function() { 2022 t() 2023 }); 2024 p = 0; 2025 for (c = b.length; p < c; p++) 2026 q[b[p]] = f('<div class="mejs-fullscreen-hover" />').appendTo(d.container).mouseover(m).hide(); 2027 g.on("mouseover", function() { 2028 if (!d.isFullScreen) { 2029 var h = g.offset(), l = a.container.offset(); 2030 e.positionFullscreenButton(h.left - l.left, h.top - l.top, false); 2031 g.css("pointer-events", "none"); 2032 d.controls.css("pointer-events", "none"); 2033 d.media.addEventListener("click", d.clickToPlayPauseCallback); 2034 for (p in q) 2035 q[p].show(); 2036 t(); 2037 j = true 2038 } 2039 }); 2040 e.addEventListener("fullscreenchange", function() { 2041 d.isFullScreen=!d.isFullScreen; 2042 d.isFullScreen ? d.media.removeEventListener("click", d.clickToPlayPauseCallback) : d.media.addEventListener("click", d.clickToPlayPauseCallback); 2043 m() 2044 }); 2045 d.globalBind("mousemove", function(h) { 2046 if (j) { 2047 var l = g.offset(); 2048 if (h.pageY < l.top || h.pageY > l.top + g.outerHeight(true) || h.pageX < l.left || h.pageX > l.left + g.outerWidth(true)) { 2049 g.css("pointer-events", ""); 2050 d.controls.css("pointer-events", ""); 2051 j = false 2052 } 2053 } 2054 }) 2055 } else 2056 g.on("mouseover", 2057 function() { 2058 if (k !== null) { 2059 clearTimeout(k); 2060 delete k 2061 } 2062 var h = g.offset(), l = a.container.offset(); 2063 e.positionFullscreenButton(h.left - l.left, h.top - l.top, true) 2064 }).on("mouseout", function() { 2065 if (k !== null) { 2066 clearTimeout(k); 2067 delete k 2068 } 2069 k = setTimeout(function() { 2070 e.hideFullscreenButton() 2071 }, 1500) 2072 }) 2073 } 2074 a.fullscreenBtn = g; 2075 d.globalBind("keydown", function(h) { 2076 if ((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen() || d.isFullScreen) && h.keyCode == 27) 2077 a.exitFullScreen() 2078 }) 2079 } 2080 }, 2081 cleanfullscreen: function(a) { 2082 a.exitFullScreen() 2083 }, 2084 containerSizeTimeout: null, 2085 enterFullScreen: function() { 2086 var a = this; 2087 if (!(a.media.pluginType !== "native" && (mejs.MediaFeatures.isFirefox || a.options.usePluginFullScreen))) { 2088 f(document.documentElement).addClass("mejs-fullscreen"); 2089 normalHeight = a.container.height(); 2090 normalWidth = a.container.width(); 2091 if (a.media.pluginType === "native") 2092 if (mejs.MediaFeatures.hasTrueNativeFullScreen) { 2093 mejs.MediaFeatures.requestFullScreen(a.container[0]); 2094 a.isInIframe && setTimeout(function c() { 2095 if (a.isNativeFullScreen) { 2096 var e = (window.devicePixelRatio || 2097 1) * f(window).width(), d = screen.width; 2098 Math.abs(d - e) > d * 0.0020 ? a.exitFullScreen() : setTimeout(c, 500) 2099 } 2100 }, 500) 2101 } else if (mejs.MediaFeatures.hasSemiNativeFullScreen) { 2102 a.media.webkitEnterFullscreen(); 2103 return 2104 } 2105 if (a.isInIframe) { 2106 var b = a.options.newWindowCallback(this); 2107 if (b !== "") 2108 if (mejs.MediaFeatures.hasTrueNativeFullScreen) 2109 setTimeout(function() { 2110 if (!a.isNativeFullScreen) { 2111 a.pause(); 2112 window.open(b, a.id, "top=0,left=0,width="
2112+ screen.availWidth + ",height=" + screen.availHeight + ",resizable=yes,scrollbars=no,status=no,toolbar=no") 2113 } 2114 }, 2115 250); 2116 else { 2117 a.pause(); 2118 window.open(b, a.id, "top=0,left=0,width=" + screen.availWidth + ",height=" + screen.availHeight + ",resizable=yes,scrollbars=no,status=no,toolbar=no"); 2119 return 2120 } 2121 } 2122 a.container.addClass("mejs-container-fullscreen").width("100%").height("100%"); 2123 a.containerSizeTimeout = setTimeout(function() { 2124 a.container.css({ 2125 width: "100%", 2126 height: "100%" 2127 }); 2128 a.setControlsSize() 2129 }, 500); 2130 if (a.media.pluginType === "native") 2131 a.$media.width("100%").height("100%"); 2132 else { 2133 a.container.find(".mejs-shim").width("100%").height("100%"); 2134 a.media.setVideoSize(f(window).width(), f(window).height()) 2135 } 2136 a.layers.children("div").width("100%").height("100%"); 2137 a.fullscreenBtn && a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen"); 2138 a.setControlsSize(); 2139 a.isFullScreen = true 2140 } 2141 }, 2142 exitFullScreen: function() { 2143 clearTimeout(this.containerSizeTimeout); 2144 if (this.media.pluginType !== "native" && mejs.MediaFeatures.isFirefox) 2145 this.media.setFullscreen(false); 2146 else { 2147 if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || 2148 this.isFullScreen)) 2149 mejs.MediaFeatures.cancelFullScreen(); 2150 f(document.documentElement).removeClass("mejs-fullscreen"); 2151 this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight); 2152 if (this.media.pluginType === "native") 2153 this.$media.width(normalWidth).height(normalHeight); 2154 else { 2155 this.container.find(".mejs-shim").width(normalWidth).height(normalHeight); 2156 this.media.setVideoSize(normalWidth, normalHeight) 2157 } 2158 this.layers.children("div").width(normalWidth).height(normalHeight); 2159 this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"); 2160 this.setControlsSize(); 2161 this.isFullScreen = false 2162 } 2163 } 2164 }) 2165})(mejs.$); 2166(function(f) { 2167 f.extend(mejs.MepDefaults, { 2168 startLanguage: "", 2169 tracksText: mejs.i18n.t("Captions/Subtitles"), 2170 hideCaptionsButtonWhenEmpty: true, 2171 toggleCaptionsButtonWhenOnlyOne: false, 2172 slidesSelector: "" 2173 }); 2174 f.extend(MediaElementPlayer.prototype, { 2175 hasChapters: false, 2176 buildtracks: function(a, b, c, e) { 2177 if (a.tracks.length != 0) { 2178 var d; 2179 if (this.domNode.textTracks) 2180 for (d = this.domNode.textTracks.length-1; d >= 0; d--) 2181 this.domNode.textTracks[d].mode = "hidden"; 2182 a.chapters = f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).hide(); 2183 a.captions = 2184 f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover"><span class="mejs-captions-text"></span></div></div>').prependTo(c).hide(); 2185 a.captionsText = a.captions.find(".mejs-captions-text"); 2186 a.captionsButton = f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="' + this.id + '" title="' + this.options.tracksText + '" aria-label="' + this.options.tracksText + '"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="' + 2187 a.id + '_captions" id="' + a.id + '_captions_none" value="none" checked="checked" /><label for="' + a.id + '_captions_none">' + mejs.i18n.t("None") + "</label></li></ul></div></div>").appendTo(b); 2188 for (d = b = 0; d < a.tracks.length; d++) 2189 a.tracks[d].kind == "subtitles" && b++; 2190 this.options.toggleCaptionsButtonWhenOnlyOne && b == 1 ? a.captionsButton.on("click", function() { 2191 a.setTrack(a.selectedTrack == null ? a.tracks[0].srclang : "none") 2192 }) : a.captionsButton.hover(function() { 2193 f(this).find(".mejs-captions-selector").css("visibility", "visible") 2194 }, 2195 function() { 2196 f(this).find(".mejs-captions-selector").css("visibility", "hidden") 2197 }).on("click", "input[type=radio]", function() { 2198 lang = this.value; 2199 a.setTrack(lang) 2200 }); 2201 a.options.alwaysShowControls ? a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover") : a.container.bind("controlsshown", function() { 2202 a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover") 2203 }).bind("controlshidden", function() { 2204 e.paused || a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover") 2205 }); 2206 a.trackToLoad =- 1; 2207 a.selectedTrack = null; 2208 a.isLoadingTrack = false;
2209 for (d = 0; d < a.tracks.length; d++) 2210 a.tracks[d].kind == "subtitles" && a.addTrackButton(a.tracks[d].srclang, a.tracks[d].label); 2211 a.loadNextTrack(); 2212 e.addEventListener("timeupdate", function() { 2213 a.displayCaptions() 2214 }, false); 2215 if (a.options.slidesSelector != "") { 2216 a.slidesContainer = f(a.options.slidesSelector); 2217 e.addEventListener("timeupdate", function() { 2218 a.displaySlides() 2219 }, false) 2220 } 2221 e.addEventListener("loadedmetadata", function() { 2222 a.displayChapters() 2223 }, false); 2224 a.container.hover(function() { 2225 if (a.hasChapters) { 2226 a.chapters.css("visibility", 2227 "visible"); 2228 a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight()) 2229 } 2230 }, function() { 2231 a.hasChapters&&!e.paused && a.chapters.fadeOut(200, function() { 2232 f(this).css("visibility", "hidden"); 2233 f(this).css("display", "block") 2234 }) 2235 }); 2236 a.node.getAttribute("autoplay") !== null && a.chapters.css("visibility", "hidden") 2237 } 2238 }, 2239 setTrack: function(a) { 2240 var b; 2241 if (a == "none") { 2242 this.selectedTrack = null; 2243 this.captionsButton.removeClass("mejs-captions-enabled") 2244 } else 2245 for (b = 0; b < this.tracks.length; b++) 2246 if (this.tracks[b].srclang == a) { 2247 this.selectedTrack == 2248 null && this.captionsButton.addClass("mejs-captions-enabled"); 2249 this.selectedTrack = this.tracks[b]; 2250 this.captions.attr("lang", this.selectedTrack.srclang); 2251 this.displayCaptions(); 2252 break 2253 } 2254 }, 2255 loadNextTrack: function() { 2256 this.trackToLoad++; 2257 if (this.trackToLoad < this.tracks.length) { 2258 this.isLoadingTrack = true; 2259 this.loadTrack(this.trackToLoad) 2260 } else { 2261 this.isLoadingTrack = false; 2262 this.checkForTracks() 2263 } 2264 }, 2265 loadTrack: function(a) { 2266 var b = this, c = b.tracks[a]; 2267 f.ajax({ 2268 url: c.src, 2269 dataType: "text", 2270 success: function(e) { 2271 c.entries = typeof e == "string" && 2272 /<tt\s+xml/ig.exec(e) ? mejs.TrackFormatParser.dfxp.parse(e) : mejs.TrackFormatParser.webvvt.parse(e); 2273 c.isLoaded = true; 2274 b.enableTrackButton(c.srclang, c.label); 2275 b.loadNextTrack(); 2276 c.kind == "chapters" && b.media.addEventListener("play", function() { 2277 b.media.duration > 0 && b.displayChapters(c) 2278 }, false); 2279 c.kind == "slides" && b.setupSlides(c) 2280 }, 2281 error: function() { 2282 b.loadNextTrack() 2283 } 2284 }) 2285 }, 2286 enableTrackButton: function(a, b) { 2287 if (b === "") 2288 b = mejs.language.codes[a] || a; 2289 this.captionsButton.find("input[value=" + a + "]").prop("disabled", false).siblings("label").html(b); 2290 this.options.startLanguage == a && f("#" + this.id + "_captions_" + a).click(); 2291 this.adjustLanguageBox() 2292 }, 2293 addTrackButton: function(a, b) { 2294 if (b === "") 2295 b = mejs.language.codes[a] || a; 2296 this.captionsButton.find("ul").append(f('<li><input type="radio" name="' + this.id + '_captions" id="' + this.id + "_captions_" + a + '" value="' + a + '" disabled="disabled" /><label for="' + this.id + "_captions_" + a + '">' + b + " (loading)</label></li>")); 2297 this.adjustLanguageBox(); 2298 this.container.find(".mejs-captions-translations option[value=" + a + "]").remove() 2299 }, 2300 adjustLanguageBox: function() { 2301 this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true) + this.captionsButton.find(".mejs-captions-translations").outerHeight(true)) 2302 }, 2303 checkForTracks: function() { 2304 var a = false;
2305 if (this.options.hideCaptionsButtonWhenEmpty) { 2306 for (i = 0; i < this.tracks.length; i++) 2307 if (this.tracks[i].kind == "subtitles") { 2308 a = true; 2309 break 2310 } 2311 if (!a) { 2312 this.captionsButton.hide(); 2313 this.setControlsSize() 2314 } 2315 } 2316 }, 2317 displayCaptions: function() { 2318 if (typeof this.tracks != 2319 "undefined") { 2320 var a, b = this.selectedTrack; 2321 if (b != null && b.isLoaded) 2322 for (a = 0; a < b.entries.times.length; a++) 2323 if (this.media.currentTime >= b.entries.times[a].start && this.media.currentTime <= b.entries.times[a].stop) { 2324 this.captionsText.html(b.entries.text[a]); 2325 this.captions.show().height(0); 2326 return 2327 } 2328 this.captions.hide() 2329 } 2330 }, 2331 setupSlides: function(a) { 2332 this.slides = a; 2333 this.slides.entries.imgs = [this.slides.entries.text.length]; 2334 this.showSlide(0) 2335 }, 2336 showSlide: function(a) { 2337 if (!(typeof this.tracks == "undefined" || typeof this.slidesContainer == 2338 "undefined")) { 2339 var b = this, c = b.slides.entries.text[a], e = b.slides.entries.imgs[a]; 2340 if (typeof e == "undefined" || typeof e.fadeIn == "undefined") 2341 b.slides.entries.imgs[a] = e = f('<img src="' + c + '">').on("load", function() { 2342 e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut() 2343 }); 2344 else 2345 !e.is(":visible")&&!e.is(":animated") && e.fadeIn().siblings(":visible").fadeOut() 2346 } 2347 }, 2348 displaySlides: function() { 2349 if (typeof this.slides != "undefined") { 2350 var a = this.slides, b; 2351 for (b = 0; b < a.entries.times.length; b++) 2352 if (this.media.currentTime >= 2353 a.entries.times[b].start && this.media.currentTime <= a.entries.times[b].stop) { 2354 this.showSlide(b); 2355 break 2356 } 2357 } 2358 }, 2359 displayChapters: function() { 2360 var a; 2361 for (a = 0; a < this.tracks.length; a++) 2362 if (this.tracks[a].kind == "chapters" && this.tracks[a].isLoaded) { 2363 this.drawChapters(this.tracks[a]); 2364 this.hasChapters = true; 2365 break 2366 } 2367 }, 2368 drawChapters: function(a) { 2369 var b = this, c, e, d = e = 0; 2370 b.chapters.empty(); 2371 for (c = 0; c < a.entries.times.length; c++) { 2372 e = a.entries.times[c].stop - a.entries.times[c].start; 2373 e = Math.floor(e / b.media.duration * 100); 2374 if (e + d > 100 || c == a.entries.times.length - 2375 1 && e + d < 100) 2376 e = 100 - d; 2377 b.chapters.append(f('<div class="mejs-chapter" rel="' + a.entries.times[c].start + '" style="left: ' + d.toString() + "%;width: " + e.toString() + '%;"><div class="mejs-chapter-block' + (c == a.entries.times.length-1 ? " mejs-chapter-block-last" : "") + '"><span class="ch-title">' + a.entries.text[c] + '</span><span class="ch-time">' + mejs.Utility.secondsToTimeCode(a.entries.times[c].start) + "–" + mejs.Utility.secondsToTimeCode(a.entries.times[c].stop) + "</span></div></div>")); 2378 d += e 2379 } 2380 b.chapters.find("div.mejs-chapter").click(function() { 2381 b.media.setCurrentTime(parseFloat(f(this).attr("rel"))); 2382 b.media.paused && b.media.play() 2383 }); 2384 b.chapters.show() 2385 } 2386 }); 2387 mejs.language = { 2388 codes: { 2389 af: "Afrikaans", 2390 sq: "Albanian", 2391 ar: "Arabic", 2392 be: "Belarusian", 2393 bg: "Bulgarian", 2394 ca: "Catalan", 2395 zh: "Chinese", 2396 "zh-cn": "Chinese Simplified", 2397 "zh-tw": "Chinese Traditional", 2398 hr: "Croatian", 2399 cs: "Czech", 2400 da: "Danish", 2401 nl: "Dutch", 2402 en: "English", 2403 et: "Estonian", 2404 tl: "Filipino", 2405 fi: "Finnish", 2406 fr: "French", 2407 gl: "Galician", 2408 de: "German", 2409 el: "Greek", 2410 ht: "Haitian Creole", 2411 iw: "Hebrew", 2412 hi: "Hindi", 2413 hu: "Hungarian", 2414 is: "Icelandic", 2415 id: "Indonesian", 2416 ga: "Irish", 2417 it: "Italian", 2418 ja: "Japanese", 2419 ko: "Korean", 2420 lv: "Latvian", 2421 lt: "Lithuanian", 2422 mk: "Macedonian", 2423 ms: "Malay", 2424 mt: "Maltese",
2425 no: "Norwegian", 2426 fa: "Persian", 2427 pl: "Polish", 2428 pt: "Portuguese", 2429 ro: "Romanian", 2430 ru: "Russian", 2431 sr: "Serbian", 2432 sk: "Slovak", 2433 sl: "Slovenian", 2434 es: "Spanish", 2435 sw: "Swahili", 2436 sv: "Swedish", 2437 tl: "Tagalog", 2438 th: "Thai", 2439 tr: "Turkish", 2440 uk: "Ukrainian", 2441 vi: "Vietnamese", 2442 cy: "Welsh", 2443 yi: "Yiddish" 2444 } 2445 }; 2446 mejs.TrackFormatParser = { 2447 webvvt: { 2448 pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/, 2449 pattern_timecode: /^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/, 2450 parse: function(a) { 2451 var b = 0; 2452 a = mejs.TrackFormatParser.split2(a, /\r?\n/); 2453 for (var c = { 2454 text: [], 2455 times: [] 2456 }, e, d; b < a.length; b++) 2457 if (this.pattern_identifier.exec(a[b])) { 2458 b++; 2459 if ((e = this.pattern_timecode.exec(a[b])) && b < a.length) { 2460 b++; 2461 d = a[b]; 2462 for (b++; a[b] !== "" && b < a.length;) { 2463 d = d + "\n" + a[b]; 2464 b++ 2465 } 2466 d = f.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>"); 2467 c.text.push(d); 2468 c.times.push({ 2469 start: mejs.Utility.convertSMPTEtoSeconds(e[1]) == 0 ? 0.2: mejs.Utility.convertSMPTEtoSeconds(e[1]), 2470 stop: mejs.Utility.convertSMPTEtoSeconds(e[3]), 2471 settings: e[5] 2472 }) 2473 } 2474 } 2475 return c 2476 } 2477 }, 2478 dfxp: { 2479 parse: function(a) { 2480 a = f(a).filter("tt"); 2481 var b = 0; 2482 b = a.children("div").eq(0); 2483 var c = b.find("p"); 2484 b = a.find("#" + b.attr("style")); 2485 var e, d; 2486 a = { 2487 text: [], 2488 times: [] 2489 }; 2490 if (b.length) { 2491 d = b.removeAttr("id").get(0).attributes; 2492 if (d.length) { 2493 e = {}; 2494 for (b = 0; b < d.length; b++) 2495 e[d[b].name.split(":")[1]] = d[b].value 2496 } 2497 } 2498 for (b = 0; b < c.length; b++) { 2499 var g; 2500 d = { 2501 start: null, 2502 stop: null, 2503 style: null 2504 }; 2505 if (c.eq(b).attr("begin")) 2506 d.start = mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin")); 2507 if (!d.start && c.eq(b-1).attr("end")) 2508 d.start = mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end")); 2509 if (c.eq(b).attr("end")) 2510 d.stop = mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end")); 2511 if (!d.stop && c.eq(b + 1).attr("begin")) 2512 d.stop = mejs.Utility.convertSMPTEtoSeconds(c.eq(b + 1).attr("begin")); 2513 if (e) { 2514 g = ""; 2515 for (var k in e) 2516 g += k + ":" + e[k] + ";" 2517 } 2518 if (g) 2519 d.style = g; 2520 if (d.start == 0) 2521 d.start = 0.2; 2522 a.times.push(d); 2523 d = f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, 2524 "<a href='$1' target='_blank'>$1</a>"); 2525 a.text.push(d); 2526 if (a.times.start == 0) 2527 a.times.start = 2 2528 } 2529 return a 2530 } 2531 }, 2532 split2: function(a, b) { 2533 return a.split(b) 2534 } 2535 }; 2536 if ("x\n\ny".split(/\n/gi).length != 3) 2537 mejs.TrackFormatParser.split2 = function(a, b) { 2538 var c = [], e = "", d; 2539 for (d = 0; d < a.length; d++) { 2540 e += a.substring(d, d + 1); 2541 if (b.test(e)) { 2542 c.push(e.replace(b, "")); 2543 e = "" 2544 } 2545 } 2546 c.push(e); 2547 return c 2548 } 2549})(mejs.$); 2550(function(f) { 2551 f.extend(mejs.MepDefaults, { 2552 contextMenuItems: [{ 2553 render: function(a) { 2554 if (typeof a.enterFullScreen == "undefined") 2555 return null; 2556 return a.isFullScreen ? mejs.i18n.t("Turn off Fullscreen") : mejs.i18n.t("Go Fullscreen") 2557 }, 2558 click: function(a) { 2559 a.isFullScreen ? a.exitFullScreen() : a.enterFullScreen() 2560 } 2561 }, { 2562 render: function(a) { 2563 return a.media.muted ? mejs.i18n.t("Unmute") : mejs.i18n.t("Mute") 2564 }, 2565 click: function(a) { 2566 a.media.muted ? a.setMuted(false) : a.setMuted(true) 2567 } 2568 }, { 2569 isSeparator: true 2570 }, { 2571 render: function() { 2572 return mejs.i18n.t("Download Video") 2573 }, 2574 click: function(a) { 2575 window.location.href = a.media.currentSrc 2576 } 2577 } 2578 ] 2579 }); 2580 f.extend(MediaElementPlayer.prototype, { 2581 buildcontextmenu: function(a) { 2582 a.contextMenu = f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide(); 2583 a.container.bind("contextmenu", function(b) { 2584 if (a.isContextMenuEnabled) { 2585 b.preventDefault(); 2586 a.renderContextMenu(b.clientX-1, b.clientY-1); 2587 return false 2588 } 2589 }); 2590 a.container.bind("click", function() { 2591 a.contextMenu.hide() 2592 }); 2593 a.contextMenu.bind("mouseleave", function() { 2594 a.startContextMenuTimer() 2595 }) 2596 }, 2597 cleancontextmenu: function(a) { 2598 a.contextMenu.remove() 2599 }, 2600 isContextMenuEnabled: true, 2601 enableContextMenu: function() { 2602 this.isContextMenuEnabled = true 2603 }, 2604 disableContextMenu: function() { 2605 this.isContextMenuEnabled = false 2606 }, 2607 contextMenuTimeout: null, 2608 startContextMenuTimer: function() { 2609 var a = this; 2610 a.killContextMenuTimer(); 2611 a.contextMenuTimer = setTimeout(function() { 2612 a.hideContextMenu(); 2613 a.killContextMenuTimer() 2614 }, 750) 2615 }, 2616 killContextMenuTimer: function() { 2617 var a = this.contextMenuTimer; 2618 if (a != null) { 2619 clearTimeout(a); 2620 delete a 2621 } 2622 }, 2623 hideContextMenu: function() { 2624 this.contextMenu.hide() 2625 }, 2626 renderContextMenu: function(a, 2627 b) { 2628 for (var c = this, e = "", d = c.options.contextMenuItems, g = 0, k = d.length; g < k; g++) 2629 if (d[g].isSeparator) 2630 e += '<div class="mejs-contextmenu-separator"></div>'; 2631 else { 2632 var j = d[g].render(c); 2633 if (j != null) 2634 e += '<div class="mejs-contextmenu-item" data-itemindex="' + g + '" id="element-' + Math.random() * 1E6 + '">' + j + "</div>" 2635 } 2636 c.contextMenu.empty().append(f(e)).css({ 2637 top: b, 2638 left: a 2639 }).show(); 2640 c.contextMenu.find(".mejs-contextmenu-item").each(function() { 2641 var m = f(this), q = parseInt(m.data("itemindex"), 10), p = c.options.contextMenuItems[q]; 2642 typeof p.show != 2643 "undefined" && p.show(m, c); 2644 m.click(function() { 2645 typeof p.click != "undefined" && p.click(c); 2646 c.contextMenu.hide() 2647 }) 2648 }); 2649 setTimeout(function() { 2650 c.killControlsTimer("rev3") 2651 }, 100) 2652 } 2653 }) 2654})(mejs.$); 2655(function(f) { 2656 f.extend(mejs.MepDefaults, { 2657 postrollCloseText: mejs.i18n.t("Close") 2658 }); 2659 f.extend(MediaElementPlayer.prototype, { 2660 buildpostroll: function(a, b, c) { 2661 var e = this.container.find('link[rel="postroll"]').attr("href"); 2662 if (typeof e !== "undefined") { 2663 a.postroll = f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">' + this.options.postrollCloseText + '</a>
2663<div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide(); 2664 this.media.addEventListener("ended", 2665 function() { 2666 f.ajax({ 2667 dataType: "html", 2668 url: e, 2669 success: function(d) { 2670 c.find(".mejs-postroll-layer-content").html(d) 2671 } 2672 }); 2673 a.postroll.show() 2674 }, false) 2675 } 2676 } 2677 }) 2678})(mejs.$); 2679 2680
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.