1/*! @name videojs-contrib-ads @version 7.4.0 @license Apache-2.0 */ 2!(function (e, t) { 3 'object' == typeof exports && 'undefined' != typeof module 4 ? (module.exports = t( 5 require('video.js'), 6 require('global/window'), 7 require('global/document') 8 )) 9 : 'function' == typeof define && define.amd 10 ? define(['video.js', 'global/window', 'global/document'], t) 11 : ((e = e || self).videojsContribAds = t(e.videojs, e.window, e.document)); 12})(this, function (e, t, n) { 13 'use strict'; 14 ((e = e && e.hasOwnProperty('default') ? e.default : e), 15 (t = t && t.hasOwnProperty('default') ? t.default : t), 16 (n = n && n.hasOwnProperty('default') ? n.default : n)); 17 var a = '7.4.0'; 18 var r = function (e, t) { 19 ((t.isImmediatePropagationStopped = function () { 20 return !0; 21 }), 22 (t.cancelBubble = !0), 23 (t.isPropagationStopped = function () { 24 return !0; 25 })); 26 }, 27 o = function (e, t, n) { 28 (r(0, n), e.trigger({ type: t + n.type, originalEvent: n })); 29 }, 30 i = function (e, t) { 31 e.ads.isInAdMode() && 32 (e.ads.isContentResuming() ? e.ads._contentEnding && o(e, 'content', t) : o(e, 'ad', t)); 33 }, 34 s = function (e, t) { 35 e.ads.isInAdMode() 36 ? e.ads.isContentResuming() 37 ? (r(0, t), e.trigger('resumeended')) 38 : o(e, 'ad', t) 39 : e.ads._contentHasEnded || 40 e.ads.stitchedAds() || 41 (o(e, 'content', t), e.trigger('readyforpostroll')); 42 }, 43 d = function (e, t) { 44 if ( 45 !( 46 ('loadstart' === t.type && !e.ads._hasThereBeenALoadStartDuringPlayerLife) || 47 ('loadeddata' === t.type && !e.ads._hasThereBeenALoadedData) || 48 ('loadedmetadata' === t.type && !e.ads._hasThereBeenALoadedMetaData) 49 ) 50 ) 51 if (e.ads.inAdBreak()) o(e, 'ad', t); 52 else { 53 if (e.currentSrc() !== e.ads.contentSrc) return; 54 o(e, 'content', t); 55 } 56 }, 57 l = function (e, t) { 58 e.ads.inAdBreak() ? o(e, 'ad', t) : e.ads.isContentResuming() && o(e, 'content', t); 59 }; 60 function u(e) { 61 'playing' === e.type 62 ? i(this, e) 63 : 'ended' === e.type 64 ? s(this, e) 65 : 'loadstart' === e.type || 'loadeddata' === e.type || 'loadedmetadata' === e.type 66 ? d(this, e) 67 : 'play' === e.type 68 ? l(this, e) 69 : this.ads.isInAdMode() && 70 (this.ads.isContentResuming() ? o(this, 'content', e) : o(this, 'ad', e)); 71 } 72 function c() { 73 return (c = Object.assign 74 ? Object.assign.bind() 75 : function (e) { 76 for (var t = 1; t < arguments.length; t++) { 77 var n = arguments[t]; 78 for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]); 79 } 80 return e; 81 }).apply(this, arguments); 82 } 83 function p(e, t) { 84 ((e.prototype = Object.create(t.prototype)), (e.prototype.constructor = e), f(e, t)); 85 } 86 function f(e, t) { 87 return (f = Object.setPrototypeOf 88 ? Object.setPrototypeOf.bind() 89 : function (e, t) { 90 return ((e.__proto__ = t), e); 91 })(e, t); 92 } 93 var h = {}, 94 g = function () { 95 (!(function (n) { 96 if (e.dom.isInFrame() && 'function' != typeof t.__tcfapi) { 97 for (var a, r = t, o = {}; r; ) { 98 try { 99 if (r.frames.__tcfapiLocator) { 100 a = r; 101 break; 102 } 103 } catch (e) {} 104 if (r === t.top) break; 105 r = r.parent; 106 } 107 if (!a) return; 108 ((t.__tcfapi = function (e, t, n, r) { 109 var i = Math.random() + '', 110 s = { __tcfapiCall: { command: e, parameter: r, version: t, callId: i } }; 111 ((o[i] = n), a.postMessage(s, '*')); 112 }), 113 t.addEventListener( 114 'message', 115 function (e) { 116 var t = {}; 117 try { 118 t = 'string' == typeof e.data ? JSON.parse(e.data) : e.data; 119 } catch (e) {} 120 var n = t.__tcfapiReturn; 121 n && 122 'function' == typeof o[n.callId] && 123 (o[n.callId](n.returnValue, n.success), (o[n.callId] = null)); 124 }, 125 !1 126 )); 127 } 128 })(), 129 'function' == typeof t.__tcfapi && 130 t.__tcfapi('addEventListener', 2, function (e, t) { 131 t && (h = e); 132 })); 133 }, 134 y = '', 135 v = function (e, n) { 136 if ((void 0 === n && (n = t), n.__uspapi)) 137 n.__uspapi('getUSPData', 1, function (t, n) { 138 var a = n ? t.uspString : null; 139 ((y = a), e(a)); 140 }); 141 else { 142 var a = (function (e) { 143 for (var t = e.parent; t !== e.top; ) { 144 try { 145 if (t.frames && t.frames.__uspapiLocator) return t; 146 } catch (e) {} 147 t = t.parent; 148 } 149 try { 150 if (e.top.frames && e.top.frames.__uspapiLocator) return e.top; 151 } catch (e) {} 152 return null; 153 })(n); 154 if (!a) return void e(null); 155 var r = Math.random().toString(36).substring(2), 156 o = { __uspapiCall: { command: 'getUSPData', version: 1, c
156allId: r } }; 157 (n.addEventListener( 158 'message', 159 function t(a) { 160 if (a && a.data && a.data.__uspapiReturn && a.data.__uspapiReturn.callId === r) { 161 n.removeEventListener('message', t, !1); 162 var o = a.data.__uspapiReturn, 163 i = o.returnValue, 164 s = o.success ? i.uspString : null; 165 ((y = s), e(s)); 166 } 167 }, 168 !1 169 ), 170 a.postMessage(o, '*')); 171 } 172 }, 173 m = function (e, t) { 174 return t ? encodeURIComponent(e) : e; 175 }, 176 A = function (e, t) { 177 var n = {}; 178 return ( 179 ['description', 'tags', 'reference_id', 'ad_keys'].forEach(function (a) { 180 e && e[a] 181 ? (n['{mediainfo.' + a + '}'] = e[a]) 182 : t['{mediainfo.' + a + '}'] 183 ? (n['{mediainfo.' + a + '}'] = t['{mediainfo.' + a + '}']) 184 : (n['{mediainfo.' + a + '}'] = ''); 185 }), 186 ['custom_fields', 'customFields'].forEach(function (t) { 187 !(function (e, t, n) { 188 if (e && e[n]) 189 for (var a = e[n], r = Object.keys(a), o = 0; o < r.length; o++) 190 t['{mediainfo.' + n + '.' + r[o] + '}'] = a[r[o]]; 191 })(e, n, t); 192 }), 193 n 194 ); 195 }, 196 _ = function (e) { 197 var t = {}, 198 n = e.replace(/{([^}=]+)=([^}]*)}/g, function (e, n, a) { 199 return ((t['{' + n + '}'] = a), '{' + n + '}'); 200 }); 201 return { defaults: t, modifiedString: n }; 202 }, 203 S = function (a) { 204 return { 205 '{player.id}': a.options_['data-player'] || a.id_, 206 '{player.height}': a.currentHeight(), 207 '{player.width}': a.currentWidth(), 208 '{player.heightInt}': Math.round(a.currentHeight()), 209 '{player.widthInt}': Math.round(a.currentWidth()), 210 '{player.autoplay}': a.autoplay() ? 1 : 0, 211 '{player.muted}': a.muted() ? 1 : 0, 212 '{player.language}': a.language() || '', 213 '{mediainfo.id}': a.mediainfo ? a.mediainfo.id : '', 214 '{mediainfo.name}': a.mediainfo ? a.mediainfo.name : '', 215 '{mediainfo.duration}': a.mediainfo ? a.mediainfo.duration : '', 216 '{player.duration}': a.duration(), 217 '{player.durationInt}': Math.round(a.duration()), 218 '{player.live}': a.duration() === 1 / 0 ? 1 : 0, 219 '{player.pageUrl}': e.dom.isInFrame() ? n.referrer : t.location.href, 220 '{playlistinfo.id}': a.playlistinfo ? a.playlistinfo.id : '', 221 '{playlistinfo.name}': a.playlistinfo ? a.playlistinfo.name : '', 222 '{timestamp}': new Date().getTime(), 223 '{document.referrer}': n.referrer, 224 '{window.location.href}': t.location.href, 225 '{random}': Math.floor(1e12 * Math.random()), 226 }; 227 }, 228 b = function (e) { 229 var t = {}; 230 return ( 231 Object.keys(e).forEach(function (n) { 232 t['{tcf.' + n + '}'] = e[n]; 233 }), 234 (t['{tcf.gdprAppliesInt}'] = e.gdprApplies ? 1 : 0), 235 t 236 ); 237 }, 238 P = function () { 239 return { '{usp.uspString}': y }; 240 }, 241 k = function (n, a, r) { 242 var o = new RegExp('{pageVariable\\.([^}]+)}', 'g'), 243 i = {}, 244 s = (n.match(o) || []).concat( 245 Object.keys(r).filter(function (e) { 246 return o.test(e) && n.includes(r[e]); 247 }) 248 ); 249 if (s) 250 return ( 251 s.forEach(function (n) { 252 for ( 253 var r, o = n, s = n.slice(14, -1), d = s.split('.'), l = t, u = 0; 254 u < d.length; 255 u++ 256 ) 257 if (u === d.length - 1) r = l[d[u]]; 258 else if (void 0 === (l = l[d[u]])) break; 259 var c = typeof r; 260 null === r 261 ? (i[o] = 'null') 262 : void 0 === r 263 ? a[o] 264 ? (i[o] = a[o]) 265 : (e.log.warn('Page variable "' + s + '" not found'), (i[o] = '')) 266 : 'string' !== c && 'number' !== c && 'boolean' !== c 267 ? (e.log.warn('Page variable "' + s + '" is not a supported type'), (i[o] = '')) 268 : (i[o] = r); 269 }), 270 i 271 ); 272 }, 273 T = function (t, n, a, r, o) { 274 for (var i in (void 0 === r && (r = {}), n)) { 275 var s = r.hasOwnProperty(i) ? r[i] : i; 276 if (s.startsWith('r:')) 277 try { 278 var d = new RegExp(s.slice(2), 'g'); 279 t = t.replace(d, m(n[i], a)); 280 } catch (t) { 281 (o.ads.error({ errorType: e.Error.AdsMacroReplacementFailed, macro: i, error: t }), 282 e.log.warn( 283 'Unable to replace macro with regex "' + s + '". The provided regex may be invalid.' 284 )); 285 } 286 else t = t.split(s).join(m(n[i], a)); 287 } 288 return t; 289 }; 290 var C = { 291 processMetadataTracks: function (e, t) { 292 for ( 293 var n = e.textTracks(), 294 a = function (n) { 295 'metadata' === n.kind && (e.ads.cueTextTracks.setMetadataTrackMode(n), t(e, n)); 296 }, 297 r = 0; 298 r < n.length; 299 r++ 300 ) 301 a(n[r]); 302 n.addEventListener('addtrack', function (e) { 303 a(e.track); 304 }); 305 }, 306 setMetadataTrackMode: function (e) {}, 307 getSupportedAdCue: function (e, t) { 308 return t; 309 }, 310 isSupportedAdCue: function (e, t) { 311 return !0; 312 }, 313 getCueId: function (e, t) { 314 return t.id; 315 }, 316 }, 317 R = function (e, t) { 318 return void 0 !== t && e.ads.includedCues[t]; 319 }, 320 w = function (e, t) { 321 void 0 !== t && '' !== t && (e.ads.includedCues[t] = !0); 322 }; 323 function B() { 324 !1 !== this.ads._shouldBlockPlay && 325 (this.paused() || 326 (this.ads.debug('Playback was canceled by cancelContentPlay'), this.pause()), 327 (this.ads._cancelledPlay = !0)); 328 } 329 C.processAdTrack = function (t, n, a, r) { 330 t.ads.includedCues = {}; 331 for (var o = 0; o < n.length; o++) { 332 var i = n[o],
333 s = this.getSupportedAdCue(t, i); 334 if (!this.isSupportedAdCue(t, i)) 335 return void e.log.warn('Skipping as this is not a supported ad cue.', i); 336 var d = this.getCueId(t, i), 337 l = i.startTime; 338 if (R(t, d)) return void e.log('Skipping ad already seen with ID ' + d); 339 (r && r(t, s, d, l), a(t, s, d, l), w(t, d)); 340 } 341 }; 342 var M = {}, 343 L = e; 344 ((M.isMiddlewareMediatorSupported = function () { 345 return ( 346 !L.browser.IS_IOS && 347 !L.browser.IS_ANDROID && 348 !!(L.use && L.middleware && L.middleware.TERMINATOR) 349 ); 350 }), 351 (M.playMiddleware = function (t) { 352 return { 353 setSource: function (e, t) { 354 t(null, e); 355 }, 356 callPlay: function () { 357 if (t.ads && !0 === t.ads._shouldBlockPlay) 358 return ( 359 t.ads.debug('Using playMiddleware to block content playback'), 360 (t.ads._playBlocked = !0), 361 L.middleware.TERMINATOR 362 ); 363 }, 364 play: function (n, a) { 365 t.ads && t.ads._playBlocked && n 366 ? (t.ads.debug('Play call to Tech was terminated.'), 367 t.trigger('play'), 368 t.addClass('vjs-has-started'), 369 (t.ads._playBlocked = !1)) 370 : a && 371 a.catch && 372 a.catch(function (n) { 373 'NotAllowedError' !== n.name || e.browser.IS_SAFARI || t.trigger('pause'); 374 }); 375 }, 376 }; 377 }), 378 (M.testHook = function (e) { 379 L = e; 380 })); 381 var E = M.playMiddleware, 382 j = M.isMiddlewareMediatorSupported, 383 I = function () { 384 if (e.getPlugin) return Boolean(e.getPlugin('ads')); 385 var t = e.getComponent('Player'); 386 return Boolean(t && t.prototype.ads); 387 }; 388 var N = (function () { 389 function e() {} 390 return ( 391 (e.getState = function (t) { 392 if (t) return e.states_ && e.states_[t] ? e.states_[t] : void 0; 393 }), 394 (e.registerState = function (t, n) { 395 if ('string' != typeof t || !t) 396 throw new Error('Illegal state name, "' + t + '"; must be a non-empty string.'); 397 return (e.states_ || (e.states_ = {}), (e.states_[t] = n), n); 398 }), 399 e 400 ); 401 })(), 402 O = (function () { 403 function t(e) { 404 this.player = e; 405 } 406 t._getName = function () { 407 return 'Anonymous State'; 408 }; 409 var n = t.prototype; 410 return ( 411 (n.transitionTo = function (e) { 412 var t = this.player; 413 this.cleanup(t); 414 var n = new e(t); 415 ((t.ads._state = n), 416 t.ads.debug(this.constructor._getName() + ' -> ' + n.constructor._getName())); 417 for (var a = arguments.length, r = new Array(a > 1 ? a - 1 : 0), o = 1; o < a; o++) 418 r[o - 1] = arguments[o]; 419 n.init.apply(n, [t].concat(r)); 420 }), 421 (n.init = function () {}), 422 (n.cleanup = function () {}), 423 (n.onPlay = function () {}), 424 (n.onPlaying = function () {}), 425 (n.onEnded = function () {}), 426 (n.onAdEnded = function () {}), 427 (n.onAdsReady = function () { 428 e.log.warn('Unexpected adsready event'); 429 }), 430 (n.onAdsError = function () {}), 431 (n.onAdsCanceled = function () {}), 432 (n.onAdTimeout = function () {}), 433 (n.onAdStarted = function () {}), 434 (n.onAdSkipped = function () {}), 435 (n.onContentChanged = function () {}), 436 (n.onContentResumed = function () {}), 437 (n.onReadyForPostroll = function () { 438 e.log.warn('Unexpected readyforpostroll event'); 439 }), 440 (n.onNoPreroll = function () {}), 441 (n.onNoPostroll = function () {}), 442 (n.startLinearAdMode = function () { 443 e.log.warn( 444 'Unexpected startLinearAdMode invocation (State via ' + 445 this.constructor._getName() + 446 ')' 447 ); 448 }), 449 (n.endLinearAdMode = function () { 450 e.log.warn( 451 'Unexpected endLinearAdMode invocation (State via ' + this.constructor._getName() + ')' 452 ); 453 }), 454 (n.skipLinearAdMode = function () { 455 e.log.warn( 456 'Unexpected skipLinearAdMode invocation (State via ' + this.constructor._getName() + ')' 457 ); 458 }), 459 (n.isAdState = function () { 460 throw new Error('isAdState unimplemented for ' + this.constructor._getName()); 461 }), 462 (n.isWaitingForAdBreak = function () { 463 return !1; 464 }), 465 (n.isContentResuming = function () { 466 return !1; 467 }), 468 (n.inAdBreak = function () { 469 return !1; 470 }), 471 (n.handleEvent = function (e) { 472 var t = this.player; 473 'play' === e 474 ? this.onPlay(t) 475 : 'adsready' === e 476 ? this.onAdsReady(t) 477 : 'adserror' === e 478 ? this.onAdsError(t) 479 : 'adscanceled' === e 480 ? this.onAdsCanceled(t) 481 : 'adtimeout' === e 482 ? this.onAdTimeout(t) 483 : 'ads-ad-started' === e 484 ? this.onAdStarted(t) 485 : 'ads-ad-skipped' === e 486 ? this.onAdSkipped(t) 487 : 'contentchanged' === e 488 ? this.onContentChanged(t) 489 : 'contentresumed' === e 490 ? this.onContentResumed(t) 491 : 'readyforpostroll' === e 492 ? this.onReadyForPostroll(t) 493 : 'playing' === e 494 ? this.onPlaying(t) 495 : 'ended' === e 496 ? this.onEnded(t) 497 : 'nopreroll' === e 498 ? this.onNoPreroll(t) 499 : 'nopostroll' === e 500 ? this.onNoPostroll(t) 501 : 'adended' === e && this.onAdEnded(t); 502 }), 503 t 504 ); 505 })(); 506 N.registerState('State', O); 507 var x = (function (e) { 508 function t(t) { 509 var n; 510 return (((n = e.call(this, t) || this).contentResuming = !1), (n.waitingForAdBreak = !1), n); 511 } 512 p(t, e); 513 var n = t.prototype; 514 return ( 515 (n.isAdState = function () { 516 return !0; 517 }), 518 (n.onPlaying = function () { 519 var e = N.getState('ContentPlayback'); 520 this.contentResuming && this.transitionTo(e); 521 }), 522 (n.onContentResumed = function () { 523 var e = N.getState('ContentPlayback'); 524 this.contentResuming && this.transitionTo(e); 525 }), 526 (n.isWaitingForAdBreak = function () { 527 return this.waitingForAdBreak; 528 }), 529 (n.isContentResuming = function () { 530 return this.contentResuming; 531 }), 532 (n.inAdBreak = function () { 533 return !0 === this.player.ads._inLinearAdMode; 534 }), 535 t 536 ); 537 })(O); 538 N.registerState('AdState', x); 539 var D = (function (e) { 540 function t() { 541 return e.apply(this, arguments) || this; 542 } 543 p(t, e); 544 var n = t.prototype; 545 return ( 546 (n.isAdState = function () { 547 return !1; 548 }), 549 (n.onContentChanged = function (e) { 550 var t = N.getState('BeforePreroll'), 551 n = N.getState('Preroll'); 552 (e.ads.debug('Received contentchanged event (ContentState)'), 553 e.paused() 554 ? this.transitionTo(t) 555 : (this.transitionTo(n, !1), e.pause(), (e.ads._pausedOnContentupdate = !0))); 556 }), 557 t 558 ); 559 })(O); 560 N.registerState('ContentState', D); 561 var F, 562 U = (function (t) { 563 function n() { 564 return t.apply(this, arguments) || this; 565 } 566 (p(n, t), 567 (n._getName = function () { 568 return 'AdsDone'; 569 })); 570 var a = n.prototype; 571 return ( 572 (a.init = function (e) { 573 ((e.ads._contentHasEnded = !0), e.trigger('ended')); 574 }), 575 (a.startLinearAdMode = function () { 576 e.log.warn('Unexpected startLinearAdMode invocation (AdsDone)'); 577 }), 578 n 579 ); 580 })(N.getState('ContentState')); 581 N.registerState('AdsDone', U); 582 var V = { 583 start: function (t) { 584 (t.ads.debug('Starting ad break'), 585 (t.ads._inLinearAdMode = !0), 586 t.trigger('adstart'), 587 t.ads.shouldTakeSnapshots() && 588 (t.ads.snapshot = (function (t) { 589 var n; 590 n = 591 e.browser.IS_IOS && t.ads.isLive(t) && t.seekable().length > 0 592 ? t.currentTime() - t.seekable().end(0) 593 : t.currentTime(); 594 var a = t.$('.vjs-tech'), 595 r = t.textTracks ? t.textTracks() : [], 596 o = [], 597 i = { 598 ended: t.ended(), 599 currentSrc: t.currentSrc(), 600 sources: t.currentSources(), 601 src: t.tech_.src(), 602 currentTime: n, 603 type: t.currentType(), 604 }; 605 a && (i.style = a.getAttribute('style')); 606 for (var s = 0; s < r.length; s++) { 607 var d = r[s]; 608 (o.push({ track: d, mode: d.mode }), (d.mode = 'disabled')); 609 } 610 return ((i.suppressedTracks = o), i); 611 })(t)), 612 t.ads.shouldPlayContentBehindAd(t) && 613 !t.ads.settings.stitchedAds && 614 ((t.ads.preAdVolume_ = t.volume()), t.volume(0)), 615 t.addClass('vjs-ad-playing'), 616 t.hasClass('vjs-live') && t.removeClass('vjs-live'), 617 t.ads.removeNativePoster(), 618 (t.ads.preAdPlaybackRate_ = t.playbackRate()), 619 t.playbackRate(1), 620 t.controlBar && 621 t.controlBar.playbackRateMenuButton && 622 t.controlBar.playbackRateMenuButton.playbackRateSupported && 623 !t.controlBar.playbackRateMenuButton.hasClass('vjs-hidden') 624 ? (t.controlBar.playbackRateMenuButton.hide(), (t.ads.showPlaybackMenuOnAdEnd_ = !0)) 625 : (t.ads.showPlaybackMenuOnAdEnd_ = !1)); 626 }, 627 end: function (t, n) { 628 (t.ads.debug('Ending ad break'), 629 void 0 === n && (n = function () {}), 630 (t.ads.adType = null),
631 (t.ads._inLinearAdMode = !1), 632 t.trigger('adend'), 633 t.removeClass('vjs-ad-playing'), 634 t.ads.isLive(t) && t.addClass('vjs-live'), 635 t.ads.shouldTakeSnapshots() 636 ? (function (t, n) { 637 var a = t.ads.snapshot; 638 if ((void 0 === n && (n = function () {}), !0 === t.ads.disableNextSnapshotRestore)) 639 return ((t.ads.disableNextSnapshotRestore = !1), delete t.ads.snapshot, void n()); 640 var r, 641 o = t.$('.vjs-tech'), 642 i = 20, 643 s = a.suppressedTracks, 644 d = function () { 645 for (var e = 0; e < s.length; e++) (r = s[e]).track.mode = r.mode; 646 }, 647 l = function () { 648 var n; 649 if (e.browser.IS_IOS && t.ads.isLive(t)) { 650 if ( 651 (a.currentTime < 0 && 652 ((n = 653 t.seekable().length > 0 654 ? t.seekable().end(0) + a.currentTime 655 : t.currentTime()), 656 t.currentTime(n)), 657 t.paused()) 658 ) { 659 var r = t.play(); 660 r && 661 r.catch && 662 r.catch(function (t) { 663 e.log.warn('Play promise rejected in IOS snapshot resume', t); 664 }); 665 } 666 } else if (a.ended) t.currentTime(t.duration()); 667 else { 668 t.currentTime(a.currentTime); 669 var o = t.play(); 670 o && 671 o.catch && 672 o.catch(function (t) { 673 e.log.warn('Play promise rejected in snapshot resume', t); 674 }); 675 } 676 t.ads.shouldRemoveAutoplay_ && 677 (t.autoplay(!1), (t.ads.shouldRemoveAutoplay_ = !1)); 678 }, 679 u = function n() { 680 if ( 681 (t.off('contentcanplay', n), 682 F && t.clearTimeout(F), 683 (o = t.el().querySelector('.vjs-tech')).readyState > 1) 684 ) 685 return l(); 686 if (void 0 === o.seekable) return l(); 687 if (o.seekable.length > 0) return l(); 688 if (i--) t.setTimeout(n, 50); 689 else 690 try { 691 l(); 692 } catch (n) { 693 (t.ads.error({ errorType: e.Error.AdsResumeContentFailed, error: n }), 694 e.log.warn('Failed to resume the content after an advertisement', n)); 695 } 696 }; 697 if ( 698 ('style' in a && o.setAttribute('style', a.style || ''), 699 t.ads.videoElementRecycled()) 700 ) 701 (t.one('resumeended', function () { 702 (delete t.ads.snapshot, n()); 703 }), 704 t.one('contentloadedmetadata', d), 705 e.browser.IS_IOS && 706 !t.autoplay() && 707 'function' == typeof t.techCall_ && 708 (t.techCall_('setAutoplay', !0), (t.ads.shouldRemoveAutoplay_ = !0)), 709 t.src(a.sources), 710 t.one('contentcanplay', u), 711 (F = t.setTimeout(u, 2e3))); 712 else { 713 if ((d(), !t.ended())) { 714 var c = t.play(); 715 c && 716 c.catch && 717 c.catch(function (t) { 718 e.log.warn('Play promise rejected in snapshot restore', t); 719 }); 720 } 721 (delete t.ads.snapshot, n()); 722 } 723 })(t, n) 724 : (t.ads.preAdVolume_ && t.volume(t.ads.preAdVolume_), n()), 725 t.playbackRate(t.ads.preAdPlaybackRate_), 726 t.ads.showPlaybackMenuOnAdEnd_ && t.controlBar.playbackRateMenuButton.show()); 727 }, 728 }, 729 q = (function (t) { 730 function n() { 731 return t.apply(this, arguments) || this; 732 } 733 (p(n, t), 734 (n._getName = function () { 735 return 'Preroll'; 736 })); 737 var a = n.prototype; 738 return ( 739 (a.init = function (e, t, n) { 740 if (((this.waitingForAdBreak = !0), e.addClass('vjs-ad-loading'), n || e.ads.nopreroll_)) 741 return this.resumeAfterNoPreroll(e); 742 var a = e.ads.settings.timeout; 743 ('number' == typeof e.ads.settings.prerollTimeout && (a = e.ads.settings.prerollTimeout), 744 (this._timeout = e.setTimeout(function () { 745 e.trigger('adtimeout'); 746 }, a)), 747 t ? this.handleAdsReady() : (this.adsReady = !1)); 748 }), 749 (a.onAdsReady = function (t) { 750 t.ads.inAdBreak() 751 ? e.log.warn('Unexpected adsready event (Preroll)') 752 : (t.ads.debug('Received adsready event (Preroll)'), this.handleAdsReady()); 753 }), 754 (a.handleAdsReady = function () { 755 ((this.adsReady = !0), this.readyForPreroll()); 756 }), 757 (a.afterLoadStart = function (e) { 758 var t = this.player; 759 t.ads._hasThereBeenALoadStartDuringPlayerLife 760 ? e() 761 : (t.ads.debug('Waiting for loadstart...'), 762 t.one('loadstart', function () { 763 (t.ads.debug('Received loadstart event'), e()); 764 })); 765 }), 766 (a.noPreroll = function () { 767 var e = this; 768 this.afterLoadStart(function () { 769 (e.player.ads.debug('Skipping prerolls due to nopreroll event (Preroll)'), 770 e.resumeAfterNoPreroll(e.player)); 771 }); 772 }), 773 (a.readyForPreroll = function () { 774 var e = this.player; 775 this.afterLoadStart(function () { 776 (e.ads.debug('Triggered readyforpreroll event (Preroll)'), 777 e.trigger('readyforpreroll')); 778 }); 779 }), 780 (a.onAdsCanceled = function (e) { 781 var t = this; 782 (e.ads.debug('adscanceled (Preroll)'), 783 this.afterLoadStart(function () { 784 t.resumeAfterNoPreroll(e); 785 })); 786 }), 787 (a.onAdsError = function (t) { 788 var n = this; 789 (e.log('adserror (Preroll)'), 790 t.ads.error({ errorType: e.Error.AdsPrerollError }), 791 this.inAdBreak() 792 ? t.ads.endLinearAdMode() 793 : this.afterLoadStart(function () { 794 n.resumeAfterNoPreroll(t); 795 })); 796 }), 797 (a.startLinearAdMode = function () { 798 var t = this.player; 799 !this.adsReady || t.ads.inAdBreak() || this.isContentResuming() 800 ? e.log.warn('Unexpected startLinearAdMode invocation (Preroll)') 801 : (this.clearTimeout(t), 802 (t.ads.adType = 'preroll'), 803 (this.waitingForAdBreak = !1), 804 V.start(t), 805 (t.ads._shouldBlockPlay = !1)); 806 }), 807 (a.onAdStarted = function (e) { 808 e.removeClass('vjs-ad-loading'); 809 }), 810 (a.endLinearAdMode = function () { 811 var e = this.player; 812 this.inAdBreak() && 813 (e.removeClass('vjs-ad-loading'), 814 e.addClass('vjs-ad-content-resuming'), 815 (this.contentResuming = !0), 816 V.end(e)); 817 }), 818 (a.skipLinearAdMode = function () { 819 var t = this, 820 n = this.player; 821 n.ads.inAdBreak() || this.isContentResuming() 822 ? e.log.warn('Unexpected skipLinearAdMode invocation') 823 : this.afterLoadStart(function () { 824 (n.trigger('adskip'), 825 n.ads.debug('skipLinearAdMode (Preroll)'), 826 t.resumeAfterNoPreroll(n)); 827 }); 828 }), 829 (a.onAdTimeout = function (e) { 830 var t = this; 831 this.afterLoadStart(function () { 832 (e.ads.debug('adtimeout (Preroll)'), t.resumeAfterNoPreroll(e)); 833 }); 834 }), 835 (a.onNoPreroll = function (t) { 836 t.ads.inAdBreak() || this.isContentResuming() 837 ? e.log.warn('Unexpected nopreroll event (Preroll)') 838 : this.noPreroll(); 839 }), 840 (a.resumeAfterNoPreroll = function (e) { 841 if ( 842 ((this.contentResuming = !0), 843 (e.ads._shouldBlockPlay = !1), 844 this.cleanupPartial(e), 845 e.ads._playRequested || e.ads._pausedOnContentupdate) 846 ) 847 if (e.paused()) { 848 e.ads.debug('resumeAfterNoPreroll: attempting to resume playback (Preroll)'); 849 var t = e.play(); 850 t && t.then && t.then(null, function (e) {}); 851 } else 852 (e.ads.debug('resumeAfterNoPreroll: already playing (Preroll)'), 853 e.trigger('play'), 854 e.trigger('playing')); 855 }), 856 (a.cleanup = function (t) { 857 (t.ads._hasThereBeenALoadStartDuringPlayerLife || 858 e.log.warn('Leaving Preroll state before loadstart event can cause issues.'), 859 this.cleanupPartial(t)); 860 }), 861 (a.cleanupPartial = function (e) { 862 (e.removeClass('vjs-ad-loading'), 863 e.removeClass('vjs-ad-content-resuming'), 864 this.clearTimeout(e)); 865 }), 866 (a.clearTimeout = function (e) { 867 (e.clearTimeout(this._timeout), (this._timeout = null)); 868 }), 869 n 870 ); 871 })(N.getState('AdState')); 872 N.registerState('Preroll', q); 873 var H = (function (t) { 874 function n() { 875 return t.apply(this, arguments) || this; 876 } 877 (p(n, t), 878 (n._getName = function () { 879 return 'BeforePreroll'; 880 })); 881 var a = n.prototype; 882 return ( 883 (a.init = function (e) { 884 ((this.adsReady = !1), 885 (this.shouldResumeToContent = !1), 886 (e.ads._shouldBlockPlay = !e.ads.settings.allowVjsAutoplay || !e.autoplay())); 887 }), 888 (a.onAdsReady = function (e) { 889 (e.ads.debug('Received adsready event (BeforePreroll)'), (this.adsReady = !0)); 890 }), 891 (a.onPlay = function (e) { 892 var t = N.getState('Preroll'); 893 (e.ads.debug('Received play event (BeforePreroll)'), 894 this.transitionTo(t, this.adsReady, this.shouldResumeToContent)); 895 }), 896 (a.onAdsCanceled = function (e) { 897 (e.ads.debug('adscanceled (BeforePreroll)'), (this.shouldResumeToContent = !0)); 898 }), 899 (a.onAdsError = function () { 900 (this.player.ads.debug('adserror (BeforePreroll)'), 901 this.player.ads.error({ errorType: e.Error.BeforePrerollError }), 902 (this.shouldResumeToContent = !0)); 903 }), 904 (a.onNoPreroll = function () { 905 (this.player.ads.debug('Skipping prerolls due to nopreroll event (BeforePreroll)'), 906 (this.shouldResumeToContent = !0)); 907 }), 908 (a.skipLinearAdMode = function () { 909 var e = this.player; 910 (e.trigger('adskip'), 911 e.ads.debug('skipLinearAdMode (BeforePreroll)'), 912 (this.shouldResumeToContent = !0)); 913 }), 914 (a.onContentChanged = function () { 915 this.init(this.player); 916 }), 917 n 918 ); 919 })(N.getState('ContentState')); 920 N.registerState('BeforePreroll', H); 921 var W = (function (t) { 922 function n() { 923 return t.apply(this, arguments) || this; 924 } 925 (p(n, t), 926 (n._getName = function () { 927 return 'Midroll'; 928 })); 929 var a = n.prototype; 930 return ( 931 (a.init = function (e) { 932 ((e.ads.adType = 'midroll'), V.start(e), e.addClass('vjs-ad-loading')); 933 }), 934 (a.onAdStarted = function (e) { 935 e.removeClass('vjs-ad-loading'); 936 }), 937 (a.endLinearAdMode = function () { 938 var e = this.player; 939 this.inAdBreak() && 940 ((this.contentResuming = !0), 941 e.addClass('vjs-ad-content-resuming'), 942 e.removeClass('vjs-ad-loading'), 943 V.end(e)); 944 }), 945 (a.onAdsError = function (t) { 946 (t.ads.error({ errorType: e.Error.AdsMidrollError }), 947 this.inAdBreak() && t.ads.endLinearAdMode()); 948 }), 949 (a.cleanup = function (e) { 950 (e.removeClass('vjs-ad-loading'), e.removeClass('vjs-ad-content-resuming')); 951 }), 952 n 953 ); 954 })(N.getState('AdState')); 955 N.registerState('Midroll', W); 956 var z = (function (t) { 957 function n() { 958 return t.apply(this, arguments) || this; 959 } 960 (p(n, t), 961 (n._getName = function () { 962 return 'Postroll'; 963 })); 964 var a = n.prototype; 965 return ( 966 (a.init = function (e) { 967 if (((this.waitingForAdBreak = !0), (e.ads._contentEnding = !0), e.ads.nopostroll_)) { 968 this.resumeContent(e); 969 var t = N.getState('AdsDone'); 970 this.transitionTo(t); 971 } else { 972 e.addClass('vjs-ad-loading'); 973 var n = e.ads.settings.timeout; 974 ('number' == typeof e.ads.settings.postrollTimeout && 975 (n = e.ads.settings.postrollTimeout), 976 (this._postrollTimeout = e.setTimeout(function () { 977 e.trigger('adtimeout'); 978 }, n))); 979 } 980 }), 981 (a.startLinearAdMode = function () { 982 var t = this.player; 983 t.ads.inAdBreak() || this.isContentResuming() 984 ? e.log.warn('Unexpected startLinearAdMode invocation (Postroll)') 985 : ((t.ads.adType = 'postroll'), 986 t.clearTimeout(this._postrollTimeout), 987 (this.waitingForAdBreak = !1), 988 V.start(t)); 989 }), 990 (a.onAdStarted = function (e) { 991 e.removeClass('vjs-ad-loading'); 992 }), 993 (a.endLinearAdMode = function () { 994 var e = this, 995 t = this.player, 996 n = N.getState('AdsDone'); 997 this.inAdBreak() && 998 (t.removeClass('vjs-ad-loading'), 999 this.resumeContent(t), 1000 V.end(t, function () { 1001 e.transitionTo(n); 1002 })); 1003 }), 1004 (a.skipLinearAdMode = function () { 1005 var t = this.player; 1006 t.ads.inAdBreak() || this.isContentResuming() 1007 ? e.log.warn('Unexpected skipLinearAdMode invocation') 1008 : (t.ads.debug('Postroll abort (skipLinearAdMode)'), t.trigger('adskip'), this.abort(t)); 1009 }), 1010 (a.onAdTimeout = function (e) { 1011 (e.ads.debug('Postroll abort (adtimeout)'), this.abort(e)); 1012 }), 1013 (a.onAdsError = function (t) { 1014 (t.ads.debug('Postroll abort (adserror)'), 1015 t.ads.error({ errorType: e.Error.AdsPostrollError }), 1016 t.ads.inAdBreak() ? t.ads.endLinearAdMode() : this.abort(t)); 1017 }), 1018 (a.onContentChanged = function (e) { 1019 if (this.isContentResuming()) { 1020 var t = N.getState('BeforePreroll'); 1021 this.transitionTo(t); 1022 } else if (!this.inAdBreak()) { 1023 var n = N.getState('Preroll'); 1024 this.transitionTo(n); 1025 } 1026 }), 1027 (a.onNoPostroll = function (t) { 1028 this.isContentResuming() || this.inAdBreak() 1029 ? e.log.warn('Unexpected nopostroll event (Postroll)') 1030 : this.abort(t); 1031 }), 1032 (a.resumeContent = function (e) { 1033 ((this.contentResuming = !0), e.addClass('vjs-ad-content-resuming')); 1034 }), 1035 (a.abort = function (e) { 1036 var t = N.getState('AdsDone'); 1037 (this.resumeContent(e), e.removeClass('vjs-ad-loading'), this.transitionTo(t)); 1038 }), 1039 (a.cleanup = function (e) { 1040 (e.removeClass('vjs-ad-content-resuming'), 1041 e.clearTimeout(this._postrollTimeout), 1042 (e.ads._contentEnding = !1)); 1043 }), 1044 n 1045 ); 1046 })(N.getState('AdState')); 1047 N.registerState('Postroll', z); 1048 var $ = (function (e) { 1049 function t() { 1050 return e.apply(this, arguments) || this; 1051 } 1052 (p(t, e), 1053 (t._getName = function () { 1054 return 'ContentPlayback'; 1055 })); 1056 var n = t.prototype; 1057 return ( 1058 (n.init = function (e) { 1059 e.ads._shouldBlockPlay = !1; 1060 }), 1061 (n.onAdsReady = function (e) { 1062 (e.ads.debug('Received adsready event (ContentPlayback)'), 1063 e.ads.nopreroll_ || 1064 (e.
1064ads.debug('Triggered readyforpreroll event (ContentPlayback)'), 1065 e.trigger('readyforpreroll'))); 1066 }), 1067 (n.onReadyForPostroll = function (e) { 1068 var t = N.getState('Postroll'); 1069 (e.ads.debug('Received readyforpostroll event'), this.transitionTo(t)); 1070 }), 1071 (n.startLinearAdMode = function () { 1072 var e = N.getState('Midroll'); 1073 this.transitionTo(e); 1074 }), 1075 t 1076 ); 1077 })(N.getState('ContentState')); 1078 N.registerState('ContentPlayback', $); 1079 var J = (function (e) { 1080 function t() { 1081 return e.apply(this, arguments) || this; 1082 } 1083 (p(t, e), 1084 (t._getName = function () { 1085 return 'StitchedContentPlayback'; 1086 })); 1087 var n = t.prototype; 1088 return ( 1089 (n.init = function () { 1090 this.player.ads._shouldBlockPlay = !1; 1091 }), 1092 (n.onContentChanged = function () { 1093 this.player.ads.debug( 1094 'Received contentchanged event (' + this.constructor._getName() + ')' 1095 ); 1096 }), 1097 (n.startLinearAdMode = function () { 1098 var e = N.getState('StitchedAdRoll'); 1099 this.transitionTo(e); 1100 }), 1101 t 1102 ); 1103 })(N.getState('ContentState')); 1104 N.registerState('StitchedContentPlayback', J); 1105 var Y = (function (e) { 1106 function t() { 1107 return e.apply(this, arguments) || this; 1108 } 1109 (p(t, e), 1110 (t._getName = function () { 1111 return 'StitchedAdRoll'; 1112 })); 1113 var n = t.prototype; 1114 return ( 1115 (n.init = function () { 1116 ((this.waitingForAdBreak = !1), 1117 (this.contentResuming = !1), 1118 (this.player.ads.adType = 'stitched'), 1119 V.start(this.player)); 1120 }), 1121 (n.onPlaying = function () {}), 1122 (n.onContentResumed = function () {}), 1123 (n.onAdEnded = function () { 1124 (this.endLinearAdMode(), this.player.trigger('ended')); 1125 }), 1126 (n.endLinearAdMode = function () { 1127 var e = N.getState('StitchedContentPlayback'); 1128 (V.end(this.player), this.transitionTo(e)); 1129 }), 1130 t 1131 ); 1132 })(N.getState('AdState')); 1133 N.registerState('StitchedAdRoll', Y); 1134 var G = M.isMiddlewareMediatorSupported, 1135 K = e.getTech('Html5').Events, 1136 Q = { 1137 timeout: 5e3, 1138 prerollTimeout: void 0, 1139 postrollTimeout: void 0, 1140 debug: !1, 1141 stitchedAds: !1, 1142 contentIsLive: void 0, 1143 liveCuePoints: !0, 1144 allowVjsAutoplay: e.options.normalizeAutoplay || !1, 1145 }, 1146 X = function (t) { 1147 var n = this; 1148 try { 1149 var r = e.obj.merge(Q, t); 1150 } catch (n) { 1151 r = e.mergeOptions(Q, t); 1152 } 1153 var o = []; 1154 (K.concat(['firstplay', 'loadedalldata']).forEach(function (e) { 1155 -1 === o.indexOf(e) && o.push(e); 1156 }), 1157 n.on(o, u), 1158 G() || 1159 (function (t, n) { 1160 (n && e.log('Using cancelContentPlay to block content playback'), t.on('play', B)); 1161 })(n, r.debug), 1162 n.setTimeout(function () { 1163 n.ads._hasThereBeenALoadStartDuringPlayerLife || 1164 '' === n.src() || 1165 e.log.error( 1166 'videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html' 1167 ); 1168 }, 5e3), 1169 n.on('ended', function () { 1170 n.hasClass('vjs-has-started') || n.addClass('vjs-has-started'); 1171 }), 1172 n.on('contenttimeupdate', function () { 1173 n.removeClass('vjs-waiting'); 1174 }), 1175 n.on(['addurationchange', 'adcanplay'], function () { 1176 if ( 1177 !n.ads.settings.stitchedAds && 1178 !n.hasStarted() && 1179 (!n.ads.snapshot || n.currentSrc() !== n.ads.snapshot.currentSrc) && 1180 n.ads.inAdBreak() 1181 ) { 1182 var t = n.play(); 1183 t && 1184 t.catch && 1185 t.catch(function (t) { 1186 e.log.warn('Play promise rejected when playing ad', t); 1187 }); 1188 } 1189 }), 1190 n.on('nopreroll', function () { 1191 (n.ads.debug('Received nopreroll event'), (n.ads.nopreroll_ = !0)); 1192 }), 1193 n.on('nopostroll', function () { 1194 (n.ads.debug('Received nopostroll event'), (n.ads.nopostroll_ = !0)); 1195 }), 1196 n.on('playing', function () { 1197 ((n.ads._cancelledPlay = !1), (n.ads._pausedOnContentupdate = !1)); 1198 }), 1199 n.on('play', function () { 1200 n.ads._playRequested = !0; 1201 }), 1202 n.one('loadstart', function () { 1203 n.ads._hasThereBeenALoadStartDuringPlayerLife = !0; 1204 }), 1205 n.on('loadeddata', function () { 1206 n.ads._hasThereBeenALoadedData = !0; 1207 }), 1208 n.on('loadedmetadata', function () { 1209 n.ads._hasThereBeenALoadedMetaData = !0; 1210 }), 1211 (n.ads = (function (t) { 1212 return { 1213 disableNextSnapshotRestore: !1, 1214 _contentEnding: !1, 1215 _contentHasEnded: !1, 1216 _hasThereBeenALoadStartDuringPlayerLife: !1, 1217 _hasThereBeenALoadedData: !1, 1218 _hasThereBeenALoadedMetaData: !1, 1219 _inLinearAdMode: !1, 1220 _shouldBlockPlay: !1, 1221 _playBlocked: !1, 1222 _playRequested: !1, 1223 _error: null, 1224 adType: null, 1225 VERSION: a, 1226 reset: function () { 1227 ((t.ads.disableNextSnapshotRestore = !1), 1228 (t.ads._contentEnding = !1), 1229 (t.ads._contentHasEnded = !1), 1230 (t.ads.snapshot = null),
1231 (t.ads.adType = null), 1232 (t.ads._hasThereBeenALoadedData = !1), 1233 (t.ads._hasThereBeenALoadedMetaData = !1), 1234 (t.ads._cancelledPlay = !1), 1235 (t.ads._shouldBlockPlay = !1), 1236 (t.ads._playBlocked = !1), 1237 (t.ads.nopreroll_ = !1), 1238 (t.ads.nopostroll_ = !1), 1239 (t.ads._playRequested = !1), 1240 (t.ads._error = null)); 1241 }, 1242 startLinearAdMode: function () { 1243 t.ads._state.startLinearAdMode(); 1244 }, 1245 endLinearAdMode: function () { 1246 t.ads._state.endLinearAdMode(); 1247 }, 1248 skipLinearAdMode: function () { 1249 t.ads._state.skipLinearAdMode(); 1250 }, 1251 stitchedAds: function (t) { 1252 return ( 1253 void 0 !== t && 1254 (e.log.warn( 1255 'Using player.ads.stitchedAds() as a setter is deprecated, it should be set as an option upon initialization of contrib-ads.' 1256 ), 1257 (this.settings.stitchedAds = !!t)), 1258 this.settings.stitchedAds 1259 ); 1260 }, 1261 videoElementRecycled: function () { 1262 if (t.ads.shouldPlayContentBehindAd(t)) return !1; 1263 if (!this.snapshot) 1264 throw new Error('You cannot use videoElementRecycled while there is no snapshot.'); 1265 var e = t.tech_.src() !== this.snapshot.src, 1266 n = t.currentSrc() !== this.snapshot.currentSrc; 1267 return e || n; 1268 }, 1269 isLive: function (n) { 1270 return ( 1271 void 0 === n && (n = t), 1272 'boolean' == typeof n.ads.settings.contentIsLive 1273 ? n.ads.settings.contentIsLive 1274 : n.duration() === 1 / 0 || ('8' === e.browser.IOS_VERSION && 0 === n.duration()) 1275 ); 1276 }, 1277 shouldPlayContentBehindAd: function (n) { 1278 if ((void 0 === n && (n = t), n)) 1279 return ( 1280 !!n.ads.settings.liveCuePoints && 1281 !e.browser.IS_IOS && 1282 !e.browser.IS_ANDROID && 1283 n.duration() === 1 / 0 1284 ); 1285 throw new Error('shouldPlayContentBehindAd requires a player as a param'); 1286 }, 1287 shouldTakeSnapshots: function (e) { 1288 return ( 1289 void 0 === e && (e = t), 1290 !this.shouldPlayContentBehindAd(e) && !this.stitchedAds() 1291 ); 1292 }, 1293 isInAdMode: function () { 1294 return this._state.isAdState(); 1295 }, 1296 isWaitingForAdBreak: function () { 1297 return this._state.isWaitingForAdBreak(); 1298 }, 1299 isContentResuming: function () { 1300 return this._state.isContentResuming(); 1301 }, 1302 isAdPlaying: function () { 1303 return this._state.inAdBreak(); 1304 }, 1305 inAdBreak: function () { 1306 return this._state.inAdBreak(); 1307 }, 1308 removeNativePoster: function () { 1309 var e = t.$('.vjs-tech'); 1310 e && e.removeAttribute('poster'); 1311 }, 1312 debug: function () { 1313 if (this.settings.debug) { 1314 for (var t = arguments.length, n = new Array(t), a = 0; a < t; a++) 1315 n[a] = arguments[a]; 1316 1 === n.length && 'string' == typeof n[0] 1317 ? e.log('ADS: ' + n[0]) 1318 : e.log.apply(e, ['ADS:'].concat(n)); 1319 } 1320 }, 1321 error: function (n) { 1322 if (void 0 === n) return this._error || null; 1323 null !== n && n.errorType 1324 ? ((this._error = n), 1325 e.log.error('An error with Ads occured. Type: ' + n.errorType + '.'), 1326 t.trigger({ type: 'vjsadserror', error: this._error })) 1327 : (this._error = null); 1328 }, 1329 }; 1330 })(n)), 1331 (n.ads.settings = r), 1332 (r.stitchedAds = !!r.stitchedAds), 1333 r.stitchedAds 1334 ? (n.ads._state = new (N.getState('StitchedContentPlayback'))(n)) 1335 : (n.ads._state = new (N.getState('BeforePreroll'))(n)), 1336 n.ads._state.init(n), 1337 (n.ads.cueTextTracks = C), 1338 (n.ads.adMacroReplacement = function (e, t, n) { 1339 (void 0 === t && (t = !1), void 0 === n && (n = {})); 1340 var a = n.disableDefaultMacros || !1, 1341 r = n.macroNameOverrides || {}; 1342 (delete n.disableDefaultMacros, delete n.macroNameOverrides); 1343 var o = n; 1344 if (a) return T(e, o, t, r); 1345 var i = _(e), 1346 s = i.defaults, 1347 d = i.modifiedString; 1348 for (var l in ((e = d), 1349 c(o, S(this), A(this.mediainfo, s), b(h), P(), k(e, s, r)),
1350 (e = T(e, o, t, r, this)), 1351 s)) 1352 e = e.replace(l, s[l]); 1353 return e; 1354 }.bind(n)), 1355 (function (e) { 1356 ((e.ads.contentSrc = e.currentSrc()), 1357 (e.ads._seenInitialLoadstart = !1), 1358 e.on('loadstart', function () { 1359 if (!e.ads.inAdBreak()) { 1360 var t = e.currentSrc(); 1361 (t !== e.ads.contentSrc && 1362 (e.ads._seenInitialLoadstart && e.trigger({ type: 'contentchanged' }), 1363 e.trigger({ type: 'contentupdate', oldValue: e.ads.contentSrc, newValue: t }), 1364 (e.ads.contentSrc = t)), 1365 (e.ads._seenInitialLoadstart = !0)); 1366 } 1367 })); 1368 })(n), 1369 n.on('contentchanged', n.ads.reset)); 1370 var i = function () { 1371 var t = n.textTracks(); 1372 if ( 1373 !n.ads.shouldPlayContentBehindAd(n) && 1374 n.ads.inAdBreak() && 1375 n.tech_.featuresNativeTextTracks && 1376 e.browser.IS_IOS && 1377 !Array.isArray(n.textTracks()) 1378 ) 1379 for (var a = 0; a < t.length; a++) { 1380 var r = t[a]; 1381 'showing' === r.mode && (r.mode = 'disabled'); 1382 } 1383 }; 1384 (n.ready(function () { 1385 n.textTracks().addEventListener('change', i); 1386 }), 1387 n.on( 1388 [ 1389 'play', 1390 'playing', 1391 'ended', 1392 'adsready', 1393 'adscanceled', 1394 'adskip', 1395 'adserror', 1396 'adtimeout', 1397 'adended', 1398 'ads-ad-started', 1399 'ads-ad-skipped', 1400 'contentchanged', 1401 'dispose', 1402 'contentresumed', 1403 'readyforpostroll', 1404 'nopreroll', 1405 'nopostroll', 1406 ], 1407 function (e) { 1408 n.ads._state.handleEvent(e.type); 1409 } 1410 ), 1411 n.on('dispose', function () { 1412 (n.ads.reset(), n.textTracks().removeEventListener('change', i)); 1413 }), 1414 g(), 1415 v(function () {}), 1416 (n.ads.listenToTcf = g), 1417 (n.ads.updateUsPrivacyString = function (e) { 1418 return v(e); 1419 })); 1420 }; 1421 return ( 1422 (X.VERSION = a), 1423 (function (t) { 1424 !I(e) && 1425 ((e.registerPlugin || e.plugin)('ads', t), 1426 j() && 1427 !e.usingContribAdsMiddleware_ && 1428 (e.use('*', E), 1429 (e.usingContribAdsMiddleware_ = !0), 1430 e.log.debug('Play middleware has been registered with videojs'))); 1431 })(X), 1432 X 1433 ); 1434});
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.