shaka-player 4.8.0 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/CONTRIBUTORS +1 -0
- package/dist/deps.js +3 -3
- package/dist/locales.js +33 -33
- package/dist/shaka-player.compiled.d.ts +3 -2
- package/dist/shaka-player.compiled.debug.d.ts +3 -2
- package/dist/shaka-player.compiled.debug.externs.js +8 -2
- package/dist/shaka-player.compiled.debug.js +208 -199
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.externs.js +8 -2
- package/dist/shaka-player.compiled.js +1017 -1016
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.d.ts +3 -2
- package/dist/shaka-player.ui.debug.d.ts +3 -2
- package/dist/shaka-player.ui.debug.externs.js +8 -2
- package/dist/shaka-player.ui.debug.js +149 -140
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.externs.js +8 -2
- package/dist/shaka-player.ui.js +1282 -1281
- package/dist/shaka-player.ui.map +3 -3
- package/lib/dash/dash_parser.js +9 -3
- package/lib/dash/mpd_utils.js +0 -6
- package/lib/dash/segment_template.js +24 -1
- package/lib/media/playhead.js +3 -3
- package/lib/media/segment_index.js +54 -18
- package/lib/media/segment_prefetch.js +20 -4
- package/lib/media/segment_reference.js +12 -0
- package/lib/media/streaming_engine.js +41 -3
- package/lib/mss/mss_parser.js +7 -2
- package/lib/player.js +2 -1
- package/lib/text/ui_text_displayer.js +12 -1
- package/lib/util/cmcd_manager.js +3 -2
- package/lib/util/platform.js +21 -0
- package/lib/util/player_configuration.js +28 -20
- package/lib/util/stream_utils.js +6 -2
- package/lib/util/tXml.js +1 -1
- package/package.json +1 -1
- package/ui/resolution_selection.js +1 -0
|
@@ -197,16 +197,16 @@ shaka.util.Timer.prototype.tickEvery=function(a){var b=this;this.stop();goog.DEB
|
|
|
197
197
|
goog.exportProperty(shaka.util.Timer.prototype,"stop",shaka.util.Timer.prototype.stop);goog.exportProperty(shaka.util.Timer.prototype,"tickEvery",shaka.util.Timer.prototype.tickEvery);goog.exportProperty(shaka.util.Timer.prototype,"tickAfter",shaka.util.Timer.prototype.tickAfter);goog.exportProperty(shaka.util.Timer.prototype,"tickNow",shaka.util.Timer.prototype.tickNow);goog.DEBUG&&(shaka.util.Timer.activeTimers=new Map);shaka.util.Platform=function(){};shaka.util.Platform.supportsMediaSource=function(){var a=window.ManagedMediaSource||window.MediaSource;return a&&a.isTypeSupported?!0:!1};shaka.util.Platform.supportsMediaType=function(a){return""!=shaka.util.Platform.anyMediaElement().canPlayType(a)};shaka.util.Platform.isEdge=function(){return navigator.userAgent.match(/Edge?\//)?!0:!1};shaka.util.Platform.isLegacyEdge=function(){return navigator.userAgent.match(/Edge\//)?!0:!1};shaka.util.Platform.isIE=function(){return shaka.util.Platform.userAgentContains_("Trident/")};
|
|
198
198
|
shaka.util.Platform.isXboxOne=function(){return shaka.util.Platform.userAgentContains_("Xbox One")};shaka.util.Platform.isTizen=function(){return shaka.util.Platform.userAgentContains_("Tizen")};shaka.util.Platform.isTizen4=function(){return shaka.util.Platform.userAgentContains_("Tizen 4")};shaka.util.Platform.isTizen3=function(){return shaka.util.Platform.userAgentContains_("Tizen 3")};shaka.util.Platform.isTizen2=function(){return shaka.util.Platform.userAgentContains_("Tizen 2")};
|
|
199
199
|
shaka.util.Platform.isWebOS=function(){return shaka.util.Platform.userAgentContains_("Web0S")};shaka.util.Platform.isWebOS3=function(){return shaka.util.Platform.isWebOS()&&38===shaka.util.Platform.chromeVersion()};shaka.util.Platform.isWebOS4=function(){return shaka.util.Platform.isWebOS()&&53===shaka.util.Platform.chromeVersion()};shaka.util.Platform.isWebOS5=function(){return shaka.util.Platform.isWebOS()&&68===shaka.util.Platform.chromeVersion()};shaka.util.Platform.isChromecast=function(){return shaka.util.Platform.userAgentContains_("CrKey")};
|
|
200
|
-
shaka.util.Platform.chromeVersion=function(){if(!shaka.util.Platform.isChrome())return null;var a=navigator.userAgent.match(/Chrome\/(\d+)/);return a?parseInt(a[1],10):null};shaka.util.Platform.isChrome=function(){return shaka.util.Platform.userAgentContains_("Chrome")&&!shaka.util.Platform.isLegacyEdge()};shaka.util.Platform.isFirefox=function(){return shaka.util.Platform.userAgentContains_("Firefox")};
|
|
200
|
+
shaka.util.Platform.isAndroidCastDevice=function(){var a=shaka.util.Platform;return a.isChromecast()&&a.isAndroid()};shaka.util.Platform.chromeVersion=function(){if(!shaka.util.Platform.isChrome())return null;var a=navigator.userAgent.match(/Chrome\/(\d+)/);return a?parseInt(a[1],10):null};shaka.util.Platform.isChrome=function(){return shaka.util.Platform.userAgentContains_("Chrome")&&!shaka.util.Platform.isLegacyEdge()};shaka.util.Platform.isFirefox=function(){return shaka.util.Platform.userAgentContains_("Firefox")};
|
|
201
201
|
shaka.util.Platform.isApple=function(){return!!navigator.vendor&&navigator.vendor.includes("Apple")&&!shaka.util.Platform.isTizen()&&!shaka.util.Platform.isEOS()&&!shaka.util.Platform.isAPL()&&!shaka.util.Platform.isVirginMedia()&&!shaka.util.Platform.isOrange()&&!shaka.util.Platform.isPS4()&&!shaka.util.Platform.isAmazonFireTV()&&!shaka.util.Platform.isWPE()};shaka.util.Platform.isPS5=function(){return shaka.util.Platform.userAgentContains_("PlayStation 5")};shaka.util.Platform.isPS4=function(){return shaka.util.Platform.userAgentContains_("PlayStation 4")};
|
|
202
202
|
shaka.util.Platform.isHisense=function(){return shaka.util.Platform.userAgentContains_("Hisense")||shaka.util.Platform.userAgentContains_("VIDAA")};shaka.util.Platform.isVirginMedia=function(){return shaka.util.Platform.userAgentContains_("VirginMedia")};shaka.util.Platform.isOrange=function(){return shaka.util.Platform.userAgentContains_("SOPOpenBrowser")};shaka.util.Platform.isAmazonFireTV=function(){return shaka.util.Platform.userAgentContains_("AFT")};shaka.util.Platform.isWPE=function(){return shaka.util.Platform.userAgentContains_("WPE")};
|
|
203
203
|
shaka.util.Platform.safariVersion=function(){if(!shaka.util.Platform.isApple())return null;var a=navigator.userAgent.match(/Version\/(\d+)/);return a?parseInt(a[1],10):(a=navigator.userAgent.match(/OS (\d+)(?:_\d+)?/))?parseInt(a[1],10):null};shaka.util.Platform.isSafari=function(){return!!shaka.util.Platform.safariVersion()};shaka.util.Platform.isEOS=function(){return shaka.util.Platform.userAgentContains_("PC=EOS")};shaka.util.Platform.isAPL=function(){return shaka.util.Platform.userAgentContains_("PC=APL")};
|
|
204
|
-
shaka.util.Platform.isMobile=function(){return/(?:iPhone|iPad|iPod|Android)/.test(navigator.userAgent)?!0:shaka.util.Platform.isApple()&&1<navigator.maxTouchPoints};shaka.util.Platform.isMac=function(){return navigator.userAgentData&&navigator.userAgentData.platform?"macos"==navigator.userAgentData.platform.toLowerCase():navigator.platform.toLowerCase().includes("mac")};
|
|
205
|
-
shaka.util.Platform.isWindows=function(){return navigator.userAgentData&&navigator.userAgentData.platform?"windows"==navigator.userAgentData.platform.toLowerCase():navigator.platform.toLowerCase().includes("windows")};shaka.util.Platform.isAndroid=function(){return shaka.util.Platform.userAgentContains_("Android")};
|
|
204
|
+
shaka.util.Platform.isMobile=function(){return/(?:iPhone|iPad|iPod|Android)/.test(navigator.userAgent)?!0:shaka.util.Platform.isApple()&&1<navigator.maxTouchPoints};shaka.util.Platform.isMac=function(){return navigator.userAgentData&&navigator.userAgentData.platform?"macos"==navigator.userAgentData.platform.toLowerCase():navigator.platform?navigator.platform.toLowerCase().includes("mac"):!1};
|
|
205
|
+
shaka.util.Platform.isWindows=function(){return navigator.userAgentData&&navigator.userAgentData.platform?"windows"==navigator.userAgentData.platform.toLowerCase():navigator.platform?navigator.platform.toLowerCase().includes("windows"):!1};shaka.util.Platform.isAndroid=function(){return shaka.util.Platform.userAgentContains_("Android")};
|
|
206
206
|
shaka.util.Platform.isSmartTV=function(){var a=shaka.util.Platform;return a.isTizen()||a.isWebOS()||a.isXboxOne()||a.isPS4()||a.isPS5()||a.isAmazonFireTV()||a.isEOS()||a.isAPL()||a.isVirginMedia()||a.isOrange()||a.isWPE()||a.isChromecast()||a.isHisense()?!0:!1};shaka.util.Platform.userAgentContains_=function(a){return(navigator.userAgent||"").includes(a)};
|
|
207
207
|
shaka.util.Platform.anyMediaElement=function(){var a=shaka.util.Platform;if(a.cachedMediaElement_)return a.cachedMediaElement_;a.cacheExpirationTimer_||(a.cacheExpirationTimer_=new shaka.util.Timer(function(){a.cachedMediaElement_=null}));a.cachedMediaElement_=document.getElementsByTagName("video")[0]||document.getElementsByTagName("audio")[0];a.cachedMediaElement_||(a.cachedMediaElement_=document.createElement("video"));a.cacheExpirationTimer_.tickAfter(1);return a.cachedMediaElement_};
|
|
208
|
-
shaka.util.Platform.requiresEncryptionInfoInAllInitSegments=function(){var a=shaka.util.Platform;return a.isTizen()||a.isXboxOne()||a.isOrange()};shaka.util.Platform.supportsSequenceMode=function(){var a=shaka.util.Platform;return a.isTizen3()||a.isTizen2()||a.isWebOS3()||a.isPS4()?!1:!0};
|
|
209
|
-
shaka.util.Platform.isMediaKeysPolyfilled=function(){return window.shakaMediaKeysPolyfill?!0:!1};
|
|
208
|
+
shaka.util.Platform.requiresEncryptionInfoInAllInitSegments=function(){var a=shaka.util.Platform;return a.isTizen()||a.isXboxOne()||a.isOrange()};shaka.util.Platform.supportsSequenceMode=function(){var a=shaka.util.Platform;return a.isTizen3()||a.isTizen2()||a.isWebOS3()||a.isPS4()?!1:!0};
|
|
209
|
+
shaka.util.Platform.supportsSmoothCodecSwitching=function(){var a=shaka.util.Platform;return a.isTizen2()||a.isTizen3()||a.isTizen4()||a.isWebOS3()||a.isWebOS4()||a.isWebOS5()||a.isChromecast()&&!a.isAndroidCastDevice()||a.isWindows()&&a.isEdge()?!1:!0};shaka.util.Platform.isMediaKeysPolyfilled=function(){return window.shakaMediaKeysPolyfill?!0:!1};
|
|
210
210
|
shaka.util.Platform.detectMaxHardwareResolution=function(){var a,b,c,d,e,f,g,h,k,l,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(n){switch(n.nextAddress){case 1:a=shaka.util.Platform;b={width:Infinity,height:Infinity};if(a.isChromecast()){window.cast&&cast.__platform__&&cast.__platform__.canDisplayType&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?(b.width=3840,b.height=2160):(b.width=1920,b.height=1080);n.jumpTo(2);break}if(a.isTizen()){b.width=
|
|
211
211
|
1920;b.height=1080;try{webapis.systeminfo&&webapis.systeminfo.getMaxVideoResolution?(c=webapis.systeminfo.getMaxVideoResolution(),b.width=c.width,b.height=c.height):webapis.productinfo.is8KPanelSupported&&webapis.productinfo.is8KPanelSupported()?(b.width=7680,b.height=4320):webapis.productinfo.isUdPanelSupported&&webapis.productinfo.isUdPanelSupported()&&(b.width=3840,b.height=2160)}catch(p){shaka.log.alwaysWarn("Tizen: Error detecting screen size, default screen size 1920x1080.")}n.jumpTo(2);break}if(a.isXboxOne()){d=
|
|
212
212
|
new Windows.Media.Protection.ProtectionCapabilities;e=Windows.Media.Protection.ProtectionCapabilityResult;f=null;try{do f=d.isTypeSupported('video/mp4;codecs="hvc1,mp4a";features="decode-res-x=3840,decode-res-y=2160,decode-bitrate=20000,decode-fps=30,decode-bpc=10,display-res-x=3840,display-res-y=2160,display-bpc=8"',"com.microsoft.playready.recommendation");while(f===e.maybe)}catch(p){f=e.notSupported}f===e.probably?(b.width=3840,b.height=2160):(b.width=1920,b.height=1080);n.jumpTo(2);break}if(a.isWebOS()){try{g=
|
|
@@ -222,8 +222,8 @@ shaka.util.StringUtils.toUTF8=function(a){if(window.TextEncoder&&!shaka.util.Pla
|
|
|
222
222
|
shaka.util.StringUtils.fromCharCode=function(a){return shaka.util.StringUtils.fromCharCodeImpl_.value()(a)};shaka.util.StringUtils.resetFromCharCode=function(){shaka.util.StringUtils.fromCharCodeImpl_.reset()};
|
|
223
223
|
shaka.util.StringUtils.htmlUnescape=function(a){var b={"&":"&","<":"<",">":">",""":'"',"'":"'","'":"'"," ":"\u00a0","‎":"\u200e","‏":"\u200f"},c=/&(?:amp|lt|gt|quot|apos|#(0+)?39|nbsp|lrm|rlm);/g,d=RegExp(c.source);return a&&d.test(a)?a.replace(c,function(e){return b[e]||"'"}):a||""};goog.exportSymbol("shaka.util.StringUtils",shaka.util.StringUtils);goog.exportProperty(shaka.util.StringUtils,"resetFromCharCode",shaka.util.StringUtils.resetFromCharCode);
|
|
224
224
|
goog.exportProperty(shaka.util.StringUtils,"toUTF16",shaka.util.StringUtils.toUTF16);goog.exportProperty(shaka.util.StringUtils,"toUTF8",shaka.util.StringUtils.toUTF8);goog.exportProperty(shaka.util.StringUtils,"fromBytesAutoDetect",shaka.util.StringUtils.fromBytesAutoDetect);goog.exportProperty(shaka.util.StringUtils,"fromUTF16",shaka.util.StringUtils.fromUTF16);goog.exportProperty(shaka.util.StringUtils,"fromUTF8",shaka.util.StringUtils.fromUTF8);
|
|
225
|
-
shaka.util.StringUtils.fromCharCodeImpl_=new shaka.util.Lazy(function(){for(var a=function(c){try{var d=new Uint8Array(c),e=String.fromCharCode.apply(null,d);goog.asserts.assert(e,"Should get value");return 0<e.length}catch(f){return!1}},b={$jscomp$loop$prop$size$
|
|
226
|
-
c.$jscomp$loop$prop$size$
|
|
225
|
+
shaka.util.StringUtils.fromCharCodeImpl_=new shaka.util.Lazy(function(){for(var a=function(c){try{var d=new Uint8Array(c),e=String.fromCharCode.apply(null,d);goog.asserts.assert(e,"Should get value");return 0<e.length}catch(f){return!1}},b={$jscomp$loop$prop$size$903:65536};0<b.$jscomp$loop$prop$size$903;b={$jscomp$loop$prop$size$903:b.$jscomp$loop$prop$size$903},b.$jscomp$loop$prop$size$903/=2)if(a(b.$jscomp$loop$prop$size$903))return function(c){return function(d){for(var e="",f=0;f<d.length;f+=
|
|
226
|
+
c.$jscomp$loop$prop$size$903){var g=d.subarray(f,f+c.$jscomp$loop$prop$size$903);e+=String.fromCharCode.apply(null,g)}return e}}(b);goog.asserts.assert(!1,"Unable to create a fromCharCode method");return null});shaka.util.Uint8ArrayUtils=function(){};shaka.util.Uint8ArrayUtils.toStandardBase64=function(a){a=shaka.util.StringUtils.fromCharCode(shaka.util.BufferUtils.toUint8(a));return btoa(a)};shaka.util.Uint8ArrayUtils.toBase64=function(a,b){b=void 0==b?!0:b;a=shaka.util.Uint8ArrayUtils.toStandardBase64(a).replace(/\+/g,"-").replace(/\//g,"_");return b?a:a.replace(/[=]*$/,"")};
|
|
227
227
|
shaka.util.Uint8ArrayUtils.fromBase64=function(a){a=window.atob(a.replace(/-/g,"+").replace(/_/g,"/"));for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b};shaka.util.Uint8ArrayUtils.fromHex=function(a){for(var b=a.length/2,c=new Uint8Array(b),d=0;d<b;d++)c[d]=window.parseInt(a.substr(2*d,2),16);return c};
|
|
228
228
|
shaka.util.Uint8ArrayUtils.toHex=function(a){var b=shaka.util.BufferUtils.toUint8(a);a="";b=$jscomp.makeIterator(b);for(var c=b.next();!c.done;c=b.next())c=c.value,c=c.toString(16),1==c.length&&(c="0"+c),a+=c;return a};
|
|
229
229
|
shaka.util.Uint8ArrayUtils.concat=function(){for(var a=$jscomp.getRestArguments.apply(0,arguments),b=shaka.util.BufferUtils,c=0,d=0;d<a.length;++d)c+=a[d].byteLength;c=new Uint8Array(c);for(var e=d=0;e<a.length;++e){var f=a[e];f instanceof Uint8Array?c.set(f,d):c.set(b.toUint8(f),d);d+=f.byteLength}return c};goog.exportSymbol("shaka.util.Uint8ArrayUtils",shaka.util.Uint8ArrayUtils);goog.exportProperty(shaka.util.Uint8ArrayUtils,"concat",shaka.util.Uint8ArrayUtils.concat);
|
|
@@ -255,8 +255,8 @@ function(e){return b.localizations_.has(e)});a=(new Map).set("locales",a.length?
|
|
|
255
255
|
shaka.ui.Localization.prototype.insert=function(a,b,c){var d=shaka.ui.Localization,e=shaka.ui.Localization.ConflictResolution,f=shaka.util.FakeEvent;a=shaka.util.LanguageUtils.normalize(a);void 0===c&&(c=e.USE_NEW);var g=this.localizations_.get(a)||new Map;b.forEach(function(h,k){g.has(k)&&c!=e.USE_NEW||g.set(k,h)});this.localizations_.set(a,g);this.updateCurrentMap_();this.dispatchEvent(new f(d.LOCALE_UPDATED));return this};
|
|
256
256
|
shaka.ui.Localization.prototype.resolveDictionary=function(a){for(var b=$jscomp.makeIterator(a.keys()),c=b.next();!c.done;c=b.next())c=c.value,a.set(c,this.resolve(c))};shaka.ui.Localization.prototype.resolve=function(a){var b=shaka.ui.Localization,c=shaka.util.FakeEvent,d=this.currentMap_.get(a);if(d)return d;a=(new Map).set("locales",Array.from(this.currentLocales_)).set("missing",a);this.dispatchEvent(new c(b.UNKNOWN_LOCALIZATION,a));return""};
|
|
257
257
|
shaka.ui.Localization.prototype.getCurrentLocales=function(){return this.currentLocales_};
|
|
258
|
-
shaka.ui.Localization.prototype.updateCurrentMap_=function(){for(var a=this,b=shaka.util.LanguageUtils,c=this.localizations_,d=this.fallbackLocale_,e=this.currentLocales_,f=new Set,g={},h=$jscomp.makeIterator(e),k=h.next();!k.done;g={$jscomp$loop$prop$locale$
|
|
259
|
-
m.$jscomp$loop$prop$locale$
|
|
258
|
+
shaka.ui.Localization.prototype.updateCurrentMap_=function(){for(var a=this,b=shaka.util.LanguageUtils,c=this.localizations_,d=this.fallbackLocale_,e=this.currentLocales_,f=new Set,g={},h=$jscomp.makeIterator(e),k=h.next();!k.done;g={$jscomp$loop$prop$locale$906:g.$jscomp$loop$prop$locale$906},k=h.next()){g.$jscomp$loop$prop$locale$906=k.value;f.add(g.$jscomp$loop$prop$locale$906);f.add(b.getBase(g.$jscomp$loop$prop$locale$906));k=shaka.util.Iterables.filter(c.keys(),function(m){return function(n){return b.areSiblings(n,
|
|
259
|
+
m.$jscomp$loop$prop$locale$906)}}(g));k.sort();var l=$jscomp.makeIterator(k);for(k=l.next();!k.done;k=l.next())f.add(k.value);k=shaka.util.Iterables.filter(c.keys(),function(m){return function(n){return b.getBase(n)==m.$jscomp$loop$prop$locale$906}}(g));k.sort();l=$jscomp.makeIterator(k);for(k=l.next();!k.done;k=l.next())f.add(k.value)}f.add(d);d=[];f=$jscomp.makeIterator(f);for(k=f.next();!k.done;k=f.next())(k=c.get(k.value))&&d.push(k);d.reverse();this.currentMap_.clear();c=$jscomp.makeIterator(d);
|
|
260
260
|
for(k=c.next();!k.done;k=c.next())k.value.forEach(function(m,n){a.currentMap_.set(n,m)});c=this.currentMap_.keys();f=new Set;d=$jscomp.makeIterator(this.currentLocales_);for(k=d.next();!k.done;k=d.next())k=this.localizations_.get(k.value)||new Map,shaka.ui.Localization.findMissingKeys_(k,c,f);0<f.size&&(e=(new Map).set("locales",Array.from(e)).set("missing",Array.from(f)),this.dispatchEvent(new shaka.util.FakeEvent(shaka.ui.Localization.MISSING_LOCALIZATIONS,e)))};
|
|
261
261
|
shaka.ui.Localization.findMissingKeys_=function(a,b,c){b=$jscomp.makeIterator(b);for(var d=b.next();!d.done;d=b.next())d=d.value,a.get(d)||c.add(d)};goog.exportSymbol("shaka.ui.Localization",shaka.ui.Localization);goog.exportProperty(shaka.ui.Localization.prototype,"getCurrentLocales",shaka.ui.Localization.prototype.getCurrentLocales);goog.exportProperty(shaka.ui.Localization.prototype,"resolve",shaka.ui.Localization.prototype.resolve);
|
|
262
262
|
goog.exportProperty(shaka.ui.Localization.prototype,"resolveDictionary",shaka.ui.Localization.prototype.resolveDictionary);goog.exportProperty(shaka.ui.Localization.prototype,"insert",shaka.ui.Localization.prototype.insert);goog.exportProperty(shaka.ui.Localization.prototype,"changeLocale",shaka.ui.Localization.prototype.changeLocale);goog.exportProperty(shaka.ui.Localization.prototype,"release",shaka.ui.Localization.prototype.release);shaka.ui.Localization.ConflictResolution={USE_OLD:0,USE_NEW:1};
|
|
@@ -322,9 +322,9 @@ shaka.ui.Locales.addTo=function(a){a.insert("ar",new Map([["AD_DURATION","\u0645
|
|
|
322
322
|
"\u81ea\u52d5"],["BACK","\u8fd4\u56de"],["CAPTIONS","\u5b57\u5e55"],["CAST","\u6295\u653e..."],["ENTER_LOOP_MODE","\u5faa\u74b0\u64ad\u653e\u76ee\u524d\u7684\u5f71\u7247"],["ENTER_PICTURE_IN_PICTURE","\u9032\u5165\u5b50\u6bcd\u756b\u9762"],["EXIT_FULL_SCREEN","\u9000\u51fa\u5168\u87a2\u5e55\u6a21\u5f0f"],["EXIT_LOOP_MODE","\u505c\u6b62\u5faa\u74b0\u64ad\u653e\u76ee\u524d\u7684\u5f71\u7247"],["EXIT_PICTURE_IN_PICTURE","\u96e2\u958b\u5b50\u6bcd\u756b\u9762"],["FAST_FORWARD","\u5feb\u8f49"],["FULL_SCREEN",
|
|
323
323
|
"\u5168\u87a2\u5e55"],["LANGUAGE","\u8a9e\u8a00"],["LIVE","\u76f4\u64ad"],["LOOP","\u5faa\u74b0\u64ad\u653e"],["MORE_SETTINGS","\u986f\u793a\u66f4\u591a\u8a2d\u5b9a"],["MULTIPLE_LANGUAGES","\u591a\u7a2e\u8a9e\u8a00"],["MUTE","\u975c\u97f3"],["NOT_APPLICABLE","\u4e0d\u9069\u7528"],["OFF","\u95dc\u9589"],["ON","\u958b\u555f"],["PAUSE","\u66ab\u505c"],["PICTURE_IN_PICTURE","\u5b50\u6bcd\u756b\u9762"],["PLAY","\u64ad\u653e"],["PLAYBACK_RATE","\u64ad\u653e\u901f\u5ea6"],["RESOLUTION","\u89e3\u6790\u5ea6"],
|
|
324
324
|
["REWIND","\u5012\u8f49"],["SEEK","\u641c\u5c0b"],["SKIP_AD","\u7565\u904e\u5ee3\u544a"],["SKIP_TO_LIVE","\u8df3\u81f3\u5f53\u524d\u76f4\u64ad"],["UNDETERMINED_LANGUAGE","\u4e0d\u660e"],["UNMUTE","\u53d6\u6d88\u975c\u97f3"],["UNRECOGNIZED_LANGUAGE","\u7121\u6cd5\u8fa8\u8b58"],["VOLUME","\u97f3\u91cf"]]))};
|
|
325
|
-
shaka.ui.Locales.Ids={
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
shaka.ui.Locales.Ids={LOOP:"LOOP",MULTIPLE_LANGUAGES:"MULTIPLE_LANGUAGES",SEEK:"SEEK",NOT_APPLICABLE:"NOT_APPLICABLE",ON:"ON",QUALITY:"QUALITY",AIRPLAY:"AIRPLAY",PICTURE_IN_PICTURE:"PICTURE_IN_PICTURE",EXIT_PICTURE_IN_PICTURE:"EXIT_PICTURE_IN_PICTURE",ENTER_LOOP_MODE:"ENTER_LOOP_MODE",MUTE:"MUTE",EXIT_FULL_SCREEN:"EXIT_FULL_SCREEN",SURROUND:"SURROUND",UNRECOGNIZED_LANGUAGE:"UNRECOGNIZED_LANGUAGE",CAPTIONS:"CAPTIONS",PLAY:"PLAY",PLAYBACK_RATE:"PLAYBACK_RATE",REPLAY:"REPLAY",UNMUTE:"UNMUTE",SUBTITLE_FORCED:"SUBTITLE_FORCED",
|
|
326
|
+
AUTO_QUALITY:"AUTO_QUALITY",SKIP_AD:"SKIP_AD",LIVE:"LIVE",VOLUME:"VOLUME",EXIT_LOOP_MODE:"EXIT_LOOP_MODE",PAUSE:"PAUSE",AD_PROGRESS:"AD_PROGRESS",LANGUAGE:"LANGUAGE",STATISTICS:"STATISTICS",TOGGLE_STEREOSCOPIC:"TOGGLE_STEREOSCOPIC",FULL_SCREEN:"FULL_SCREEN",AD_DURATION:"AD_DURATION",ENTER_PICTURE_IN_PICTURE:"ENTER_PICTURE_IN_PICTURE",AD_TIME:"AD_TIME",SKIP_TO_LIVE:"SKIP_TO_LIVE",MORE_SETTINGS:"MORE_SETTINGS",RECENTER_VR:"RECENTER_VR",CAST:"CAST",FAST_FORWARD:"FAST_FORWARD",RESOLUTION:"RESOLUTION",
|
|
327
|
+
OFF:"OFF",BACK:"BACK",UNDETERMINED_LANGUAGE:"UNDETERMINED_LANGUAGE",REWIND:"REWIND"};shaka.abr={};shaka.abr.Ewma=function(a){goog.asserts.assert(0<a,"expected halfLife to be positive");this.alpha_=Math.exp(Math.log(.5)/a);this.totalWeight_=this.estimate_=0};shaka.abr.Ewma.prototype.updateAlpha=function(a){goog.asserts.assert(0<a,"expected halfLife to be positive");this.alpha_=Math.exp(Math.log(.5)/a)};shaka.abr.Ewma.prototype.sample=function(a,b){var c=Math.pow(this.alpha_,a);b=b*(1-c)+c*this.estimate_;isNaN(b)||(this.estimate_=b,this.totalWeight_+=a)};
|
|
328
328
|
shaka.abr.Ewma.prototype.getEstimate=function(){return this.estimate_/(1-Math.pow(this.alpha_,this.totalWeight_))};shaka.abr.EwmaBandwidthEstimator=function(){this.fast_=new shaka.abr.Ewma(2);this.slow_=new shaka.abr.Ewma(5);this.bytesSampled_=0;this.minTotalBytes_=128E3;this.minBytes_=16E3};shaka.abr.EwmaBandwidthEstimator.prototype.configure=function(a){this.minTotalBytes_=a.minTotalBytes;this.minBytes_=a.minBytes;this.fast_.updateAlpha(a.fastHalfLife);this.slow_.updateAlpha(a.slowHalfLife)};
|
|
329
329
|
shaka.abr.EwmaBandwidthEstimator.prototype.sample=function(a,b){if(!(b<this.minBytes_)){var c=8E3*b/a;a/=1E3;this.bytesSampled_+=b;this.fast_.sample(a,c);this.slow_.sample(a,c)}};shaka.abr.EwmaBandwidthEstimator.prototype.getBandwidthEstimate=function(a){return this.bytesSampled_<this.minTotalBytes_?a:Math.min(this.fast_.getEstimate(),this.slow_.getEstimate())};shaka.abr.EwmaBandwidthEstimator.prototype.hasGoodEstimate=function(){return this.bytesSampled_>=this.minTotalBytes_};shaka.util.EventManager=function(){this.bindingMap_=new shaka.util.MultiMap};shaka.util.EventManager.prototype.release=function(){this.removeAll();this.bindingMap_=null};shaka.util.EventManager.prototype.listen=function(a,b,c,d){this.bindingMap_&&(a=new shaka.util.EventManager.Binding_(a,b,c,d),this.bindingMap_.push(b,a))};shaka.util.EventManager.prototype.listenOnce=function(a,b,c,d){var e=this,f=function(g){e.unlisten(a,b,f);c(g)};this.listen(a,b,f,d)};
|
|
330
330
|
shaka.util.EventManager.prototype.unlisten=function(a,b,c){if(this.bindingMap_){var d=this.bindingMap_.get(b)||[];d=$jscomp.makeIterator(d);for(var e=d.next();!e.done;e=d.next())e=e.value,e.target!=a||c!=e.listener&&c||(e.unlisten(),this.bindingMap_.remove(b,e))}};shaka.util.EventManager.prototype.removeAll=function(){if(this.bindingMap_){var a=this.bindingMap_.getAll();a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b.value.unlisten();this.bindingMap_.clear()}};
|
|
@@ -343,7 +343,7 @@ shaka.media.ClosedCaptionParser.registerParser=function(a,b){shaka.media.ClosedC
|
|
|
343
343
|
shaka.media.ClosedCaptionParser.unregisterDecoder=function(){shaka.media.ClosedCaptionParser.decoderFactory_=null};shaka.media.ClosedCaptionParser.findDecoder=function(){return shaka.media.ClosedCaptionParser.decoderFactory_};goog.exportSymbol("shaka.media.ClosedCaptionParser",shaka.media.ClosedCaptionParser);goog.exportProperty(shaka.media.ClosedCaptionParser,"findDecoder",shaka.media.ClosedCaptionParser.findDecoder);goog.exportProperty(shaka.media.ClosedCaptionParser,"unregisterDecoder",shaka.media.ClosedCaptionParser.unregisterDecoder);
|
|
344
344
|
goog.exportProperty(shaka.media.ClosedCaptionParser,"registerDecoder",shaka.media.ClosedCaptionParser.registerDecoder);goog.exportProperty(shaka.media.ClosedCaptionParser,"findParser",shaka.media.ClosedCaptionParser.findParser);goog.exportProperty(shaka.media.ClosedCaptionParser,"unregisterParser",shaka.media.ClosedCaptionParser.unregisterParser);goog.exportProperty(shaka.media.ClosedCaptionParser,"registerParser",shaka.media.ClosedCaptionParser.registerParser);
|
|
345
345
|
shaka.media.ClosedCaptionParser.parserMap_={};shaka.media.ClosedCaptionParser.decoderFactory_=null;shaka.util.ArrayUtils=function(){};shaka.util.ArrayUtils.defaultEquals=function(a,b){return"number"===typeof a&&"number"===typeof b&&isNaN(a)&&isNaN(b)?!0:a===b};shaka.util.ArrayUtils.remove=function(a,b){b=a.indexOf(b);-1<b&&a.splice(b,1)};shaka.util.ArrayUtils.count=function(a,b){var c=0;a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())c+=b(d.value)?1:0;return c};
|
|
346
|
-
shaka.util.ArrayUtils.hasSameElements=function(a,b,c){c||(c=shaka.util.ArrayUtils.defaultEquals);if(a.length!=b.length)return!1;b=b.slice();var d={};a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;d={$jscomp$loop$prop$item$
|
|
346
|
+
shaka.util.ArrayUtils.hasSameElements=function(a,b,c){c||(c=shaka.util.ArrayUtils.defaultEquals);if(a.length!=b.length)return!1;b=b.slice();var d={};a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;d={$jscomp$loop$prop$item$908:d.$jscomp$loop$prop$item$908},e=a.next()){d.$jscomp$loop$prop$item$908=e.value;e=b.findIndex(function(f){return function(g){return c(f.$jscomp$loop$prop$item$908,g)}}(d));if(-1==e)return!1;b[e]=b[b.length-1];b.pop()}return 0==b.length};
|
|
347
347
|
shaka.util.ArrayUtils.equal=function(a,b,c){c||(c=shaka.util.ArrayUtils.defaultEquals);if(a.length!=b.length)return!1;for(var d=0;d<a.length;d++)if(!c(a[d],b[d]))return!1;return!0};shaka.text={};
|
|
348
348
|
shaka.text.Cue=function(a,b,c){var d=shaka.text.Cue;this.startTime=a;this.endTime=b;this.payload=c;this.region=new shaka.text.CueRegion;this.position=null;this.positionAlign=d.positionAlign.AUTO;this.size=0;this.textAlign=d.textAlign.CENTER;this.direction=d.direction.HORIZONTAL_LEFT_TO_RIGHT;this.writingMode=d.writingMode.HORIZONTAL_TOP_TO_BOTTOM;this.lineInterpretation=d.lineInterpretation.LINE_NUMBER;this.line=null;this.lineHeight="";this.lineAlign=d.lineAlign.START;this.displayAlign=d.displayAlign.AFTER;
|
|
349
349
|
this.fontSize=this.border=this.backgroundImage=this.backgroundColor=this.color="";this.fontWeight=d.fontWeight.NORMAL;this.fontStyle=d.fontStyle.NORMAL;this.linePadding=this.letterSpacing=this.fontFamily="";this.opacity=1;this.textCombineUpright="";this.textDecoration=[];this.textStrokeWidth=this.textStrokeColor=this.textShadow="";this.wrapLine=!0;this.id="";this.nestedCues=[];this.lineBreak=this.isContainer=!1;this.rubyTag=null;this.cellResolution={columns:32,rows:15}};
|
|
@@ -384,13 +384,13 @@ for(e=d.next();!e.done;e=d.next())for(e=e.value,this.closedCaptionsMap_.has(e)||
|
|
|
384
384
|
shaka.text.TextEngine.prototype.getNumberOfClosedCaptionChannels=function(){return this.closedCaptionsMap_.size};shaka.text.TextEngine.prototype.getNumberOfClosedCaptionsInChannel=function(a){return(a=this.closedCaptionsMap_.get(a))?a.size:0};goog.exportSymbol("shaka.text.TextEngine",shaka.text.TextEngine);goog.exportProperty(shaka.text.TextEngine.prototype,"destroy",shaka.text.TextEngine.prototype.destroy);goog.exportProperty(shaka.text.TextEngine,"findParser",shaka.text.TextEngine.findParser);
|
|
385
385
|
goog.exportProperty(shaka.text.TextEngine,"unregisterParser",shaka.text.TextEngine.unregisterParser);goog.exportProperty(shaka.text.TextEngine,"registerParser",shaka.text.TextEngine.registerParser);shaka.text.TextEngine.parserMap_={};shaka.util.Functional=function(){};shaka.util.Functional.createFallbackPromiseChain=function(a,b){return a.reduce(function(c,d){return c.catch(function(){return b(d)})},Promise.reject())};shaka.util.Functional.collapseArrays=function(a,b){return a.concat(b)};shaka.util.Functional.ignored=function(){};shaka.util.Functional.noop=function(){};shaka.util.Functional.isNotNull=function(a){return null!=a};shaka.util.ObjectUtils=function(){};shaka.util.ObjectUtils.cloneObject=function(a){var b=new WeakSet,c=function(d){switch(typeof d){case "undefined":case "boolean":case "number":case "string":case "symbol":case "function":return d;default:if(!d||d.buffer&&d.buffer.constructor==ArrayBuffer)return d;if(b.has(d))return null;var e=d.constructor==Array;if(d.constructor!=Object&&!e)return null;b.add(d);var f=e?[]:{},g;for(g in d)f[g]=c(d[g]);e&&(f.length=d.length);return f}};return c(a)};
|
|
386
386
|
shaka.util.ObjectUtils.shallowCloneObject=function(a){var b={},c;for(c in a)b[c]=a[c];return b};shaka.util.StreamUtils=function(){};
|
|
387
|
-
shaka.util.StreamUtils.chooseCodecsAndFilterManifest=function(a,b,c,d){var e=shaka.util.StreamUtils,f=shaka.util.MimeUtils,g=a.variants;if(b.length||c.length)g=e.choosePreferredCodecs(g,b,c);if(d.length){b=new shaka.util.MultiMap;c=$jscomp.makeIterator(g);for(g=c.next();!g.done;g=c.next())g=g.value,b.push(String(g.video.width||0),g);var h=[];b.forEach(function(v,x){v=0;var w=[],t={};x=$jscomp.makeIterator(x);for(var y=x.next();!y.done;t={$jscomp$loop$prop$variant$
|
|
388
|
-
x.next())t.$jscomp$loop$prop$variant$
|
|
387
|
+
shaka.util.StreamUtils.chooseCodecsAndFilterManifest=function(a,b,c,d){var e=shaka.util.StreamUtils,f=shaka.util.MimeUtils,g=a.variants;if(b.length||c.length)g=e.choosePreferredCodecs(g,b,c);if(d.length){b=new shaka.util.MultiMap;c=$jscomp.makeIterator(g);for(g=c.next();!g.done;g=c.next())g=g.value,b.push(String(g.video.width||0),g);var h=[];b.forEach(function(v,x){v=0;var w=[],t={};x=$jscomp.makeIterator(x);for(var y=x.next();!y.done;t={$jscomp$loop$prop$variant$585$910:t.$jscomp$loop$prop$variant$585$910},y=
|
|
388
|
+
x.next())t.$jscomp$loop$prop$variant$585$910=y.value,y=d.filter(function(u){return function(z){return u.$jscomp$loop$prop$variant$585$910.decodingInfos[0][z]}}(t)).length,y>v?(v=y,w=[t.$jscomp$loop$prop$variant$585$910]):y==v&&w.push(t.$jscomp$loop$prop$variant$585$910);h.push.apply(h,$jscomp.arrayFromIterable(w))});g=h}c=new Set;b=new Set;e=$jscomp.makeIterator(g);for(g=e.next();!g.done;g=e.next())g=g.value,g.audio&&c.add(g.audio),g.video&&b.add(g.video);c=Array.from(c).sort(function(v,x){return v.bandwidth-
|
|
389
389
|
x.bandwidth});var k=[];g=new Map;c=$jscomp.makeIterator(c);for(e=c.next();!e.done;e=c.next()){e=e.value;var l=e.language+(e.channelsCount||0)+(e.audioSamplingRate||0)+e.roles.join(",")+e.label+e.groupId+e.fastSwitching,m=g.get(l)||[];if(m.length){var n=m[m.length-1],p=f.getNormalizedCodec(n.codecs),q=f.getNormalizedCodec(e.codecs);p==q&&e.bandwidth>n.bandwidth&&(m.push(e),k.push(e.id))}else m.push(e),k.push(e.id);g.set(l,m)}c=Array.from(b).sort(function(v,x){return v.bandwidth&&x.bandwidth?v.bandwidth-
|
|
390
390
|
x.bandwidth:v.width-x.width});b=shaka.media.Capabilities.isChangeTypeSupported();var r=[];g=new Map;c=$jscomp.makeIterator(c);for(e=c.next();!e.done;e=c.next()){e=e.value;l=Math.round(e.frameRate||0)+(e.hdr||"")+e.fastSwitching;m=g.get(l)||[];if(m.length){n=m[m.length-1];if(!b&&(p=f.getNormalizedCodec(n.codecs),q=f.getNormalizedCodec(e.codecs),p!==q))continue;e.width>n.width||e.height>n.height?(m.push(e),r.push(e.id)):e.width==n.width&&e.height==n.height&&(p=f.getNormalizedCodec(n.codecs),q=f.getNormalizedCodec(e.codecs),
|
|
391
391
|
p==q&&e.bandwidth>n.bandwidth&&(m.push(e),r.push(e.id)))}else m.push(e),r.push(e.id);g.set(l,m)}a.variants=a.variants.filter(function(v){var x=v.audio,w=v.video;return x&&!k.includes(x.id)||w&&!r.includes(w.id)?(shaka.log.debug("Dropping Variant (better codec available)",v),!1):!0})};
|
|
392
|
-
shaka.util.StreamUtils.choosePreferredCodecs=function(a,b,c){var d={};b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;d={$jscomp$loop$prop$videoCodec$
|
|
393
|
-
b=c.next())if(d.$jscomp$loop$prop$audioCodec$
|
|
392
|
+
shaka.util.StreamUtils.choosePreferredCodecs=function(a,b,c){var d={};b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;d={$jscomp$loop$prop$videoCodec$912:d.$jscomp$loop$prop$videoCodec$912},e=b.next())if(d.$jscomp$loop$prop$videoCodec$912=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.$jscomp$loop$prop$videoCodec$912)}}(d)),e.length){a=e;break}d={};c=$jscomp.makeIterator(c);for(b=c.next();!b.done;d={$jscomp$loop$prop$audioCodec$914:d.$jscomp$loop$prop$audioCodec$914},
|
|
393
|
+
b=c.next())if(d.$jscomp$loop$prop$audioCodec$914=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.$jscomp$loop$prop$audioCodec$914)}}(d)),b.length){a=b;break}return a};shaka.util.StreamUtils.filterByRestrictions=function(a,b,c){a.variants=a.variants.filter(function(d){return shaka.util.StreamUtils.meetsRestrictions(d,b,c)})};
|
|
394
394
|
shaka.util.StreamUtils.meetsRestrictions=function(a,b,c){var d=function(h,k,l){return h>=k&&h<=l},e=a.video;if(e&&e.width&&e.height){var f=e.width,g=e.height;g>f&&(g=$jscomp.makeIterator([g,f]),f=g.next().value,g=g.next().value);if(!d(f,b.minWidth,Math.min(b.maxWidth,c.width))||!d(g,b.minHeight,Math.min(b.maxHeight,c.height))||!d(e.width*e.height,b.minPixels,b.maxPixels))return!1}return a&&a.video&&a.video.frameRate&&!d(a.video.frameRate,b.minFrameRate,b.maxFrameRate)||!d(a.bandwidth,b.minBandwidth,
|
|
395
395
|
b.maxBandwidth)?!1:!0};shaka.util.StreamUtils.applyRestrictions=function(a,b,c){var d=!1;a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=shaka.util.StreamUtils.meetsRestrictions(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
396
396
|
shaka.util.StreamUtils.filterManifest=function(a,b,c){c=void 0===c?[]:c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){if(1==d.nextAddress)return d.yield(shaka.util.StreamUtils.filterManifestByMediaCapabilities(a,b,0<b.offlineSessionIds.length,c),2);shaka.util.StreamUtils.filterTextStreams_(b);return d.yield(shaka.util.StreamUtils.filterImageStreams_(b),0)})};
|
|
@@ -400,14 +400,14 @@ shaka.util.StreamUtils.checkVariantSupported_=function(a,b){var c=shaka.util.Man
|
|
|
400
400
|
l.codecs.split(",");h=e.guessCodecs(c.VIDEO,m);h=g.getCorrectVideoCodecs(h);e=e.guessCodecs(c.AUDIO,m);e=g.getCorrectAudioCodecs(e);m=f.getFullOrConvertedType(l.mimeType,e,c.AUDIO);if(!d.isTypeSupported(m))return!1;h=[h,e].join()}e=f.getFullOrConvertedType(l.mimeType,h,c.VIDEO);if(!d.isTypeSupported(e))return!1;l.codecs=h}l=a.audio;if(k&&l&&l.encrypted&&l.codecs.toLowerCase().includes("opus"))return!1;if(l){g=g.getCorrectAudioCodecs(l.codecs);c=f.getFullOrConvertedType(l.mimeType,g,c.AUDIO);if(!d.isTypeSupported(c))return!1;
|
|
401
401
|
l.codecs=g}return a.decodingInfos.some(function(p){return!p.supported||b&&(p=p.keySystemAccess)&&p.keySystem!=b?!1:!0})};shaka.util.StreamUtils.alphabeticalKeyOrderStringify_=function(a){var b=[];for(c in a)b.push(c);b.sort();var c=[];b=$jscomp.makeIterator(b);for(var d=b.next();!d.done;d=b.next()){var e=d.value;d=JSON.stringify(e);e=a[e];e instanceof Object?(e=shaka.util.StreamUtils.alphabeticalKeyOrderStringify_(e),c.push(d+":"+e)):(e=JSON.stringify(e),c.push(d+":"+e))}return"{"+c.join(",")+"}"};
|
|
402
402
|
shaka.util.StreamUtils.getDecodingInfosForVariant_=function(a,b){var c,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress){c=function(n,p){if(n){var q=shaka.util.ObjectUtils.cloneObject(n);q.supported=n.supported&&p.supported;q.powerEfficient=n.powerEfficient&&p.powerEfficient;q.smooth=n.smooth&&p.smooth;p.keySystemAccess&&!q.keySystemAccess&&(q.keySystemAccess=p.keySystemAccess);return q}return p};d=shaka.util.StreamUtils;e=null;f=[];g={};h=$jscomp.makeIterator(b);
|
|
403
|
-
for(k=h.next();!k.done;g={$jscomp$loop$prop$cache$
|
|
404
|
-
f.push(d.checkEachDecodingConfigCombination_(l).then(function(n){return function(p){var q=null;p=$jscomp.makeIterator(p||[]);for(var r=p.next();!r.done;r=p.next())q=c(q,r.value);q&&(n.$jscomp$loop$prop$cache$
|
|
405
|
-
shaka.util.StreamUtils.checkEachDecodingConfigCombination_=function(a){var b=[""];a.video&&(b=shaka.util.MimeUtils.getCodecs(a.video.contentType).split(","));var c=[""];a.audio&&(c=shaka.util.MimeUtils.getCodecs(a.audio.contentType).split(","));var d=[];b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;e=b.next()){e=e.value;for(var f={},g=$jscomp.makeIterator(c),h=g.next();!h.done;f={$jscomp$loop$prop$copy$
|
|
406
|
-
if(a.video){var k=shaka.util.MimeUtils.getBasicType(f.$jscomp$loop$prop$copy$
|
|
403
|
+
for(k=h.next();!k.done;g={$jscomp$loop$prop$cache$916:g.$jscomp$loop$prop$cache$916,$jscomp$loop$prop$cacheKey$917:g.$jscomp$loop$prop$cacheKey$917},k=h.next())l=k.value,g.$jscomp$loop$prop$cacheKey$917=d.alphabeticalKeyOrderStringify_(l),g.$jscomp$loop$prop$cache$916=d.decodingConfigCache_,g.$jscomp$loop$prop$cache$916[g.$jscomp$loop$prop$cacheKey$917]?(shaka.log.v2("Using cached results of mediaCapabilities.decodingInfo","for key",g.$jscomp$loop$prop$cacheKey$917),e=c(e,g.$jscomp$loop$prop$cache$916[g.$jscomp$loop$prop$cacheKey$917])):
|
|
404
|
+
f.push(d.checkEachDecodingConfigCombination_(l).then(function(n){return function(p){var q=null;p=$jscomp.makeIterator(p||[]);for(var r=p.next();!r.done;r=p.next())q=c(q,r.value);q&&(n.$jscomp$loop$prop$cache$916[n.$jscomp$loop$prop$cacheKey$917]=q,e=c(e,q))}}(g)));return m.yield(Promise.all(f),2)}e&&a.decodingInfos.push(e);m.jumpToEnd()})};
|
|
405
|
+
shaka.util.StreamUtils.checkEachDecodingConfigCombination_=function(a){var b=[""];a.video&&(b=shaka.util.MimeUtils.getCodecs(a.video.contentType).split(","));var c=[""];a.audio&&(c=shaka.util.MimeUtils.getCodecs(a.audio.contentType).split(","));var d=[];b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;e=b.next()){e=e.value;for(var f={},g=$jscomp.makeIterator(c),h=g.next();!h.done;f={$jscomp$loop$prop$copy$919:f.$jscomp$loop$prop$copy$919},h=g.next()){h=h.value;f.$jscomp$loop$prop$copy$919=shaka.util.ObjectUtils.cloneObject(a);
|
|
406
|
+
if(a.video){var k=shaka.util.MimeUtils.getBasicType(f.$jscomp$loop$prop$copy$919.video.contentType);f.$jscomp$loop$prop$copy$919.video.contentType=shaka.util.MimeUtils.getFullType(k,e)}a.audio&&(k=shaka.util.MimeUtils.getBasicType(f.$jscomp$loop$prop$copy$919.audio.contentType),f.$jscomp$loop$prop$copy$919.audio.contentType=shaka.util.MimeUtils.getFullType(k,h));d.push(new Promise(function(l){return function(m,n){navigator.mediaCapabilities.decodingInfo(l.$jscomp$loop$prop$copy$919).then(function(p){m(p)}).catch(n)}}(f)))}}return Promise.all(d).catch(function(l){shaka.log.info("MediaCapabilities.decodingInfo() failed.",
|
|
407
407
|
JSON.stringify(a),l);return null})};
|
|
408
|
-
shaka.util.StreamUtils.getDecodingInfosForVariants=function(a,b,c,d){var e,f,g,h,k,l,m,n,p,q,r,v,x,w,t,y,u;return $jscomp.asyncExecutePromiseGeneratorProgram(function(z){switch(z.nextAddress){case 1:if(e=a.some(function(A){return A.decodingInfos.length}))return shaka.log.debug("Already got the variants' decodingInfo."),z.return();f={};g=$jscomp.makeIterator(d);h=g.next();case 2:if(h.done){z.jumpTo(4);break}f.$jscomp$loop$prop$preferredKeySystem$
|
|
409
|
-
case 5:if(m.done){z.jumpTo(7);break}n=m.value;p=shaka.util.StreamUtils.getDecodingConfigs_(n,b,c).filter(function(A){return function(B){B=B[0];return(B.keySystemConfiguration&&B.keySystemConfiguration.keySystem)===A.$jscomp$loop$prop$preferredKeySystem$
|
|
410
|
-
z.jumpTo(5);break;case 7:if(k)return z.return();f={$jscomp$loop$prop$preferredKeySystem$
|
|
408
|
+
shaka.util.StreamUtils.getDecodingInfosForVariants=function(a,b,c,d){var e,f,g,h,k,l,m,n,p,q,r,v,x,w,t,y,u;return $jscomp.asyncExecutePromiseGeneratorProgram(function(z){switch(z.nextAddress){case 1:if(e=a.some(function(A){return A.decodingInfos.length}))return shaka.log.debug("Already got the variants' decodingInfo."),z.return();f={};g=$jscomp.makeIterator(d);h=g.next();case 2:if(h.done){z.jumpTo(4);break}f.$jscomp$loop$prop$preferredKeySystem$921=h.value;k=!1;l=$jscomp.makeIterator(a);m=l.next();
|
|
409
|
+
case 5:if(m.done){z.jumpTo(7);break}n=m.value;p=shaka.util.StreamUtils.getDecodingConfigs_(n,b,c).filter(function(A){return function(B){B=B[0];return(B.keySystemConfiguration&&B.keySystemConfiguration.keySystem)===A.$jscomp$loop$prop$preferredKeySystem$921}}(f));q=$jscomp.makeIterator(p);r=q.next();case 8:if(r.done){z.jumpTo(10);break}v=r.value;return z.yield(shaka.util.StreamUtils.getDecodingInfosForVariant_(n,v),9);case 9:r=q.next();z.jumpTo(8);break;case 10:n.decodingInfos.length&&(k=!0);m=l.next();
|
|
410
|
+
z.jumpTo(5);break;case 7:if(k)return z.return();f={$jscomp$loop$prop$preferredKeySystem$921:f.$jscomp$loop$prop$preferredKeySystem$921};h=g.next();z.jumpTo(2);break;case 4:x=$jscomp.makeIterator(a),m=x.next();case 12:if(m.done){z.jumpTo(0);break}w=m.value;t=shaka.util.StreamUtils.getDecodingConfigs_(w,b,c).filter(function(A){A=A[0];A=A.keySystemConfiguration&&A.keySystemConfiguration.keySystem;return!A||!d.includes(A)});y=$jscomp.makeIterator(t);r=y.next();case 15:if(r.done){m=x.next();z.jumpTo(12);
|
|
411
411
|
break}u=r.value;return z.yield(shaka.util.StreamUtils.getDecodingInfosForVariant_(w,u),16);case 16:r=y.next(),z.jumpTo(15)}})};
|
|
412
412
|
shaka.util.StreamUtils.getDecodingConfigs_=function(a,b,c){var d=a.audio,e=a.video,f=shaka.util.ManifestParserUtils.ContentType,g=shaka.util.ManifestParserUtils,h=shaka.util.MimeUtils,k=shaka.util.StreamUtils,l=[],m=[];if(e)for(var n=$jscomp.makeIterator(e.fullMimeTypes),p=n.next();!p.done;p=n.next()){p=p.value;var q=h.getCodecs(p);if(q.includes(",")&&!d){var r=q.split(",");q=g.guessCodecs(f.VIDEO,r);r=g.guessCodecs(f.AUDIO,r);r=k.getCorrectAudioCodecs(r);r=h.getFullOrConvertedType(h.getBasicType(p),
|
|
413
413
|
r,f.AUDIO);m.push({contentType:r,channels:2,bitrate:a.bandwidth||1,samplerate:1,spatialRendering:!1})}q=k.getCorrectVideoCodecs(q);p={contentType:h.getFullOrConvertedType(h.getBasicType(p),q,f.VIDEO),width:e.width||64,height:e.height||64,bitrate:e.bandwidth||a.bandwidth||1,framerate:e.frameRate||1};if(e.hdr)switch(e.hdr){case "SDR":p.transferFunction="srgb";break;case "PQ":p.transferFunction="pq";break;case "HLG":p.transferFunction="hlg"}l.push(p)}if(d)for(g=$jscomp.makeIterator(d.fullMimeTypes),
|
|
@@ -415,7 +415,7 @@ p=g.next();!p.done;p=g.next())n=p.value,p=k.getCorrectAudioCodecs(h.getCodecs(n)
|
|
|
415
415
|
"media-source"},h&&(n.video=h),g&&(n.audio=g),f.push(n);m=(a.video?a.video.drmInfos:[]).concat(a.audio?a.audio.drmInfos:[]);if(!m.length)return[f];a=[];c=new Map;m=$jscomp.makeIterator(m);for(r=m.next();!r.done;r=m.next())l=r.value,c.get(l.keySystem)||c.set(l.keySystem,[]),c.get(l.keySystem).push(l);m=b?"required":"optional";b=b?["persistent-license"]:["temporary"];l=$jscomp.makeIterator(c.keys());for(h=l.next();!h.done;h=l.next()){h=h.value;k=[];g=$jscomp.makeIterator(f);for(n=g.next();!n.done;n=
|
|
416
416
|
g.next()){n=Object.assign({},n.value);q=c.get(h);p={keySystem:h,initDataType:"cenc",persistentState:m,distinctiveIdentifier:"optional",sessionTypes:b};q=$jscomp.makeIterator(q);for(r=q.next();!r.done;r=q.next()){r=r.value;if(r.initData&&r.initData.length){for(var v=new Set,x=$jscomp.makeIterator(r.initData),w=x.next();!w.done;w=x.next())v.add(w.value.initDataType);1<v.size&&shaka.log.v2("DrmInfo contains more than one initDataType,","and we use the initDataType of the first initData.",r);p.initDataType=
|
|
417
417
|
r.initData[0].initDataType}r.distinctiveIdentifierRequired&&(p.distinctiveIdentifier="required");r.persistentStateRequired&&(p.persistentState="required");r.sessionType&&(p.sessionTypes=[r.sessionType]);d&&(""!=r.audioRobustness?p.audio?p.audio.robustness=p.audio.robustness||r.audioRobustness:p.audio={robustness:r.audioRobustness}:p.audio||(p.audio={}));e&&(""!=r.videoRobustness?p.video?p.video.robustness=p.video.robustness||r.videoRobustness:p.video={robustness:r.videoRobustness}:p.video||(p.video=
|
|
418
|
-
{}))}n.keySystemConfiguration=p;k.push(n)}a.push(k)}return a};shaka.util.StreamUtils.getCorrectAudioCodecs=function(a){return"
|
|
418
|
+
{}))}n.keySystemConfiguration=p;k.push(n)}a.push(k)}return a};shaka.util.StreamUtils.getCorrectAudioCodecs=function(a){return"flac"==a.toLowerCase()?shaka.util.Platform.isSafari()?"fLaC":"flac":"Opus"===a?"opus":a};shaka.util.StreamUtils.getCorrectVideoCodecs=function(a){if(a.includes("avc1")){var b=a.split(".");if(3==b.length)return a=b.shift()+".",a+=parseInt(b.shift(),10).toString(16),a+=("000"+parseInt(b.shift(),10).toString(16)).slice(-4)}else if("vp9"==a)return"vp09.00.41.08";return a};
|
|
419
419
|
shaka.util.StreamUtils.filterManifestByCurrentVariant=function(a,b){var c=shaka.util.StreamUtils;b.variants=b.variants.filter(function(d){var e=d.audio;d=d.video;return e&&a&&a.audio&&!c.areStreamsCompatible_(e,a.audio)?(shaka.log.debug("Dropping variant - not compatible with active audio","active audio",c.getStreamSummaryString_(a.audio),"variant.audio",c.getStreamSummaryString_(e)),!1):d&&a&&a.video&&!c.areStreamsCompatible_(d,a.video)?(shaka.log.debug("Dropping variant - not compatible with active video",
|
|
420
420
|
"active video",c.getStreamSummaryString_(a.video),"variant.video",c.getStreamSummaryString_(d)),!1):!0})};shaka.util.StreamUtils.filterTextStreams_=function(a){a.textStreams=a.textStreams.filter(function(b){var c=shaka.util.MimeUtils.getFullType(b.mimeType,b.codecs);(c=shaka.text.TextEngine.isTypeSupported(c))||shaka.log.debug("Dropping text stream. Is not supported by the platform.",b);return c})};
|
|
421
421
|
shaka.util.StreamUtils.filterImageStreams_=function(a){var b,c,d,e,f,g,h,k;return $jscomp.asyncExecutePromiseGeneratorProgram(function(l){switch(l.nextAddress){case 1:b=[],c=$jscomp.makeIterator(a.imageStreams),d=c.next();case 2:if(d.done){l.jumpTo(4);break}e=d.value;f=e.mimeType;"application/mp4"==f&&"mjpg"==e.codecs&&(f="image/jpg");if(shaka.util.StreamUtils.supportedImageMimeTypes_.has(f)){l.jumpTo(5);break}g=shaka.util.StreamUtils.minImage_.get(f);if(!g){shaka.util.StreamUtils.supportedImageMimeTypes_.set(f,
|
|
@@ -502,7 +502,7 @@ l.plugin:null;if(!n)return shaka.util.AbortableOperation.failed(new shaka.util.E
|
|
|
502
502
|
b,a,function(B,C,F){q&&q.stop();r&&r.tickAfter(A/1E3);if(h.onProgressUpdated_&&a==t){y++;b.packetNumber=y;var D=h.allowSwitch_(c);h.onProgressUpdated_(B,C,D,b);m=!0;g.setBytes(F)}},function(B){if(h.onHeadersReceived_)h.onHeadersReceived_(B,b,a);x=!0;b.timeToFirstByte=Date.now()-b.requestStartTime});if(!p)return u;var z=b.retryParameters.connectionTimeout;z&&(q=new shaka.util.Timer(function(){v=!0;u.abort()}),q.tickAfter(z/1E3));var A=b.retryParameters.stallTimeout;A&&(r=new shaka.util.Timer(function(){v=
|
|
503
503
|
!0;u.abort()}));return u}).chain(function(t){q&&q.stop();r&&r.stop();void 0==t.timeMs&&(t.timeMs=Date.now()-w);var y={response:t,gotProgress:m};if(!x&&h.onHeadersReceived_)h.onHeadersReceived_(t.headers,b,a);return y},function(t){q&&q.stop();r&&r.stop();if(h.onDownloadFailed_){var y=null,u=0;t instanceof shaka.util.Error&&(y=t,t.code==shaka.util.Error.Code.BAD_HTTP_STATUS&&(u=t.data[1]));h.onDownloadFailed_(b,y,u,v)}if(h.destroyed_)return shaka.util.AbortableOperation.aborted();v&&(t=new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,
|
|
504
504
|
shaka.util.Error.Category.NETWORK,shaka.util.Error.Code.TIMEOUT,b.uris[e],a));if(t instanceof shaka.util.Error){if(t.code==shaka.util.Error.Code.OPERATION_ABORTED)throw t;if(t.code==shaka.util.Error.Code.ATTEMPTS_EXHAUSTED)throw goog.asserts.assert(f,"Should have last error"),f;if(t.severity==shaka.util.Error.Severity.RECOVERABLE)return y=(new Map).set("error",t),y=new shaka.util.FakeEvent("retry",y),h.dispatchEvent(y),e=(e+1)%b.uris.length,h.send_(a,b,c,d,e,t,g)}throw t;})};
|
|
505
|
-
shaka.net.NetworkingEngine.prototype.filterResponse_=function(a,b,c){for(var d=shaka.util.AbortableOperation.completed(void 0),e={},f=$jscomp.makeIterator(this.responseFilters_),g=f.next();!g.done;e={$jscomp$loop$prop$responseFilter$
|
|
505
|
+
shaka.net.NetworkingEngine.prototype.filterResponse_=function(a,b,c){for(var d=shaka.util.AbortableOperation.completed(void 0),e={},f=$jscomp.makeIterator(this.responseFilters_),g=f.next();!g.done;e={$jscomp$loop$prop$responseFilter$923:e.$jscomp$loop$prop$responseFilter$923},g=f.next())e.$jscomp$loop$prop$responseFilter$923=g.value,d=d.chain(function(h){return function(){var k=b.response;k.data&&(k.data=shaka.util.BufferUtils.toArrayBuffer(k.data));return h.$jscomp$loop$prop$responseFilter$923(a,
|
|
506
506
|
k,c)}}(e));return d.chain(function(){return b},function(h){var k=shaka.util.Error.Severity.CRITICAL;if(h instanceof shaka.util.Error){if(h.code==shaka.util.Error.Code.OPERATION_ABORTED)throw h;k=h.severity}throw new shaka.util.Error(k,shaka.util.Error.Category.NETWORK,shaka.util.Error.Code.RESPONSE_FILTER_ERROR,h);})};shaka.net.NetworkingEngine.prototype.allowSwitch_=function(a){if(a){var b=a.segment;a=a.stream;if(b&&a&&a.fastSwitching&&b.isPartial())return!1}return!0};
|
|
507
507
|
shaka.net.NetworkingEngine.getLocationProtocol_=function(){return location.protocol};goog.exportSymbol("shaka.net.NetworkingEngine",shaka.net.NetworkingEngine);goog.exportProperty(shaka.net.NetworkingEngine.prototype,"request",shaka.net.NetworkingEngine.prototype.request);goog.exportProperty(shaka.net.NetworkingEngine.prototype,"destroy",shaka.net.NetworkingEngine.prototype.destroy);goog.exportProperty(shaka.net.NetworkingEngine,"makeRequest",shaka.net.NetworkingEngine.makeRequest);
|
|
508
508
|
goog.exportProperty(shaka.net.NetworkingEngine,"defaultRetryParameters",shaka.net.NetworkingEngine.defaultRetryParameters);goog.exportProperty(shaka.net.NetworkingEngine.prototype,"clearAllResponseFilters",shaka.net.NetworkingEngine.prototype.clearAllResponseFilters);goog.exportProperty(shaka.net.NetworkingEngine.prototype,"unregisterResponseFilter",shaka.net.NetworkingEngine.prototype.unregisterResponseFilter);goog.exportProperty(shaka.net.NetworkingEngine.prototype,"registerResponseFilter",shaka.net.NetworkingEngine.prototype.registerResponseFilter);
|
|
@@ -537,7 +537,7 @@ shaka.util.Pssh.prototype.parsePsshBox_=function(a){goog.asserts.assert(null!=a.
|
|
|
537
537
|
if(0<a.version){b=a.reader.readUint32();for(var c=0;c<b;c++){var d=shaka.util.Uint8ArrayUtils.toHex(a.reader.readBytes(16));this.cencKeyIds.push(d)}}}};
|
|
538
538
|
shaka.util.Pssh.createPssh=function(a,b,c,d){goog.asserts.assert(16==b.byteLength,"Invalid system ID length");var e=a.length,f=12+b.length+4+e;0<d&&(f+=4+16*c.size);var g=new Uint8Array(f),h=shaka.util.BufferUtils.toDataView(g),k=0;h.setUint32(k,f);k+=4;h.setUint32(k,1886614376);k+=4;1>d?h.setUint32(k,0):h.setUint32(k,16777216);k+=4;g.set(b,k);k+=b.length;if(0<d)for(h.setUint32(k,c.size),k+=4,b=shaka.util.Uint8ArrayUtils,c=$jscomp.makeIterator(c),d=c.next();!d.done;d=c.next())d=b.fromHex(d.value),
|
|
539
539
|
g.set(d,k),k+=d.length;h.setUint32(k,e);k+=4;g.set(a,k);goog.asserts.assert(k+e===f,"PSSH invalid length.");return g};
|
|
540
|
-
shaka.util.Pssh.normaliseInitData=function(a){if(!a)return a;var b=new shaka.util.Pssh(a);if(1>=b.data.length)return a;a=[];var c={};b=$jscomp.makeIterator(b.data);for(var d=b.next();!d.done;c={$jscomp$loop$prop$initData$
|
|
540
|
+
shaka.util.Pssh.normaliseInitData=function(a){if(!a)return a;var b=new shaka.util.Pssh(a);if(1>=b.data.length)return a;a=[];var c={};b=$jscomp.makeIterator(b.data);for(var d=b.next();!d.done;c={$jscomp$loop$prop$initData$608$925:c.$jscomp$loop$prop$initData$608$925},d=b.next())c.$jscomp$loop$prop$initData$608$925=d.value,a.some(function(e){return function(f){return shaka.util.BufferUtils.equal(f,e.$jscomp$loop$prop$initData$608$925)}}(c))||a.push(c.$jscomp$loop$prop$initData$608$925);return shaka.util.Uint8ArrayUtils.concat.apply(shaka.util.Uint8ArrayUtils,
|
|
541
541
|
$jscomp.arrayFromIterable(a))};/*
|
|
542
542
|
@license
|
|
543
543
|
tXml
|
|
@@ -560,7 +560,8 @@ shaka.util.TXml.parseDuration=function(a){if(!a)return null;var b=RegExp("^P(?:(
|
|
|
560
560
|
shaka.util.TXml.parseRange=function(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=Number(b[1]);if(!isFinite(a))return null;b=Number(b[2]);return isFinite(b)?{start:a,end:b}:null};shaka.util.TXml.parseInt=function(a){a=Number(a);return 0===a%1?a:null};shaka.util.TXml.parsePositiveInt=function(a){a=Number(a);return 0===a%1&&0<a?a:null};shaka.util.TXml.parseNonNegativeInt=function(a){a=Number(a);return 0===a%1&&0<=a?a:null};
|
|
561
561
|
shaka.util.TXml.parseFloat=function(a){a=Number(a);return isNaN(a)?null:a};shaka.util.TXml.parseBoolean=function(a){return a?"true"===a.toLowerCase():!1};shaka.util.TXml.evalDivision=function(a){var b;var c=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(c)?null:c};
|
|
562
562
|
shaka.util.TXml.parseXpath=function(a){var b=[];a=a.split(/\/+(?=(?:[^'"]*['"][^'"]*['"])*[^'"]*$)/);a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){var d=c.value;c=d.match(/\b([A-Z])\w+/);d=d.match(/(@id='(.*?)')/);c&&b.push({name:c[0],id:d?d[0].match(/'(.*?)'/)[0].replace(/'/gm,""):null})}return b};
|
|
563
|
-
shaka.util.TXml.txmlNodeToDomElement=function(a,b,c){b=void 0===b?!0:b;c=void 0===c?!0:c;var d=shaka.util.TXml,e=document.createElement(a.tagName),f;for(f in a.attributes)e.setAttribute(f,a.attributes[f]);b&&a.parent&&d.txmlNodeToDomElement(a.parent,!0,!1).appendChild(e);if(c)for(a=$jscomp.makeIterator(a.children),b=a.next();!b.done;b=a.next())b=b.value,b="string"==typeof b?new Text(b):d.txmlNodeToDomElement(b,!1,!0),e.appendChild(b);return e};
|
|
563
|
+
shaka.util.TXml.txmlNodeToDomElement=function(a,b,c){b=void 0===b?!0:b;c=void 0===c?!0:c;var d=shaka.util.TXml,e=document.createElement(a.tagName),f;for(f in a.attributes)e.setAttribute(f,a.attributes[f]);b&&a.parent&&"?xml"!=a.parent.tagName&&d.txmlNodeToDomElement(a.parent,!0,!1).appendChild(e);if(c)for(a=$jscomp.makeIterator(a.children),b=a.next();!b.done;b=a.next())b=b.value,b="string"==typeof b?new Text(b):d.txmlNodeToDomElement(b,!1,!0),e.appendChild(b);return e};
|
|
564
|
+
shaka.util.TXml.knownNameSpaces_=new Map([]);shaka.media.DrmEngine=function(a){var b=this;this.playerInterface_=a;this.supportedTypes_=new Set;this.video_=this.mediaKeys_=null;this.initializedForStorage_=this.initialized_=!1;this.licenseTimeSeconds_=0;this.currentDrmInfo_=null;this.eventManager_=new shaka.util.EventManager;this.activeSessions_=new Map;this.storedPersistentSessions_=new Map;this.allSessionsLoaded_=new shaka.util.PublicPromise;this.config_=null;this.onError_=function(c){c.severity==shaka.util.Error.Severity.CRITICAL&&b.allSessionsLoaded_.reject(c);
|
|
564
565
|
a.onError(c)};this.keyStatusByKeyId_=new Map;this.announcedKeyStatusByKeyId_=new Map;this.keyStatusTimer_=new shaka.util.Timer(function(){return b.processKeyStatusChanges_()});this.usePersistentLicenses_=!1;this.mediaKeyMessageEvents_=[];this.initialRequestsSent_=!1;this.expirationTimer_=new shaka.util.Timer(function(){b.pollExpiration_()});this.allSessionsLoaded_.catch(function(){});this.destroyer_=new shaka.util.Destroyer(function(){return b.destroyNow_()});this.srcEquals_=!1;this.manifestInitData_=
|
|
565
566
|
this.mediaKeysAttached_=null};shaka.media.DrmEngine.prototype.destroy=function(){return this.destroyer_.destroy()};
|
|
566
567
|
shaka.media.DrmEngine.prototype.destroyNow_=function(){var a=this;return $jscomp.asyncExecutePromiseGeneratorProgram(function(b){switch(b.nextAddress){case 1:return a.eventManager_.release(),a.eventManager_=null,a.allSessionsLoaded_.reject(),a.expirationTimer_.stop(),a.expirationTimer_=null,a.keyStatusTimer_.stop(),a.keyStatusTimer_=null,b.yield(a.closeOpenSessions_(),2);case 2:if(!a.video_){b.jumpTo(3);break}goog.asserts.assert(!a.video_.src,"video src must be removed first!");b.setCatchFinallyBlocks(4);
|
|
@@ -599,7 +600,7 @@ shaka.log.info("Created MediaKeys object for key system",c.currentDrmInfo_.keySy
|
|
|
599
600
|
t.leaveTryBlock(7,4);break;case 8:x=t.enterCatchBlock(4);if(x instanceof shaka.util.Error)throw x;throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.ERROR_CHECKING_HDCP_VERSION,x.message);case 7:return c.initialized_=!0,t.yield(c.setServerCertificate(),11);case 11:c.destroyer_.ensureNotDestroyed();t.leaveTryBlock(0);break;case 4:w=t.enterCatchBlock();c.destroyer_.ensureNotDestroyed(w);c.currentDrmInfo_=null;c.supportedTypes_.clear();if(w instanceof
|
|
600
601
|
shaka.util.Error)throw w;throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.FAILED_TO_CREATE_CDM,w.message);}})};
|
|
601
602
|
shaka.media.DrmEngine.prototype.getKeySystemAccessFromVariants_=function(a,b){for(var c=$jscomp.makeIterator(a),d=c.next();!d.done;d=c.next()){var e=this.getVariantDrmInfos_(d.value);e=$jscomp.makeIterator(e);for(d=e.next();!d.done;d=e.next()){var f=d.value;b.has(f.keySystem)||b.set(f.keySystem,[]);b.get(f.keySystem).push(f)}}if(1==b.size&&b.has(""))throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.NO_RECOGNIZED_KEY_SYSTEMS);c={};e=$jscomp.makeIterator(this.config_.preferredKeySystems);
|
|
602
|
-
for(f=e.next();!f.done;c={$jscomp$loop$prop$preferredKeySystem$
|
|
603
|
+
for(f=e.next();!f.done;c={$jscomp$loop$prop$preferredKeySystem$927:c.$jscomp$loop$prop$preferredKeySystem$927},f=e.next())for(c.$jscomp$loop$prop$preferredKeySystem$927=f.value,f=$jscomp.makeIterator(a),d=f.next();!d.done;d=f.next())if(d=d.value.decodingInfos.find(function(l){return function(m){return m.supported&&null!=m.keySystemAccess&&m.keySystemAccess.keySystem==l.$jscomp$loop$prop$preferredKeySystem$927}}(c)))return d.keySystemAccess;c=$jscomp.makeIterator([!0,!1]);for(e=c.next();!e.done;e=
|
|
603
604
|
c.next())for(e=e.value,f=$jscomp.makeIterator(a),d=f.next();!d.done;d=f.next()){var g=$jscomp.makeIterator(d.value.decodingInfos);for(d=g.next();!d.done;d=g.next()){var h=d.value;if(h.supported&&h.keySystemAccess){d=b.get(h.keySystemAccess.keySystem);var k=$jscomp.makeIterator(d);for(d=k.next();!d.done;d=k.next())if(!!d.value.licenseServerUri==e)return h.keySystemAccess}}}return null};
|
|
604
605
|
shaka.media.DrmEngine.prototype.getKeySystemAccessByConfigs_=function(a){var b=this,c,d,e,f,g,h,k,l,m,n,p,q,r,v,x,w,t;return $jscomp.asyncExecutePromiseGeneratorProgram(function(y){switch(y.nextAddress){case 1:if(1==a.size&&a.has(""))throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.DRM,shaka.util.Error.Code.NO_RECOGNIZED_KEY_SYSTEMS);d=$jscomp.makeIterator(a.values());for(e=d.next();!e.done;e=d.next())f=e.value,0==f.audioCapabilities.length&&delete f.audioCapabilities,
|
|
605
606
|
0==f.videoCapabilities.length&&delete f.videoCapabilities;g=$jscomp.makeIterator(b.config_.preferredKeySystems);h=g.next();case 2:if(h.done){y.jumpTo(4);break}k=h.value;if(!a.has(k)){y.jumpTo(3);break}l=a.get(k);y.setCatchFinallyBlocks(6);return y.yield(navigator.requestMediaKeySystemAccess(k,[l]),8);case 8:return c=y.yieldResult,y.return(c);case 6:m=y.enterCatchBlock(),shaka.log.v2("Requesting",k,"failed with config",l,m);case 7:b.destroyer_.ensureNotDestroyed();case 3:h=g.next();y.jumpTo(2);break;
|
|
@@ -645,10 +646,10 @@ var k=this.usePersistentLicenses_?"persistent-license":"temporary";a={keySystem:
|
|
|
645
646
|
(a.distinctiveIdentifierRequired=c.distinctiveIdentifierRequired),c.persistentStateRequired&&(a.persistentStateRequired=c.persistentStateRequired);return a};
|
|
646
647
|
shaka.media.DrmEngine.createDrmInfoByConfigs_=function(a,b){var c=[],d=[],e=[],f=[],g=[],h=new Set;shaka.media.DrmEngine.processDrmInfos_(b.drmInfos,c,d,f,e,g,h);1<c.length&&shaka.log.warning("Multiple unique encryption schemes found! Only the first will be used.");1<f.length&&shaka.log.warning("Multiple unique server certificates found! Only the first will be used.");1<e.length&&shaka.log.warning("Multiple unique server certificate URIs found! Only the first will be used.");1<d.length&&shaka.log.warning("Multiple unique license server URIs found! Only the first will be used.");
|
|
647
648
|
return{keySystem:a,encryptionScheme:c[0],licenseServerUri:d[0],distinctiveIdentifierRequired:"required"==b.distinctiveIdentifier,persistentStateRequired:"required"==b.persistentState,sessionType:b.sessionTypes[0]||"temporary",audioRobustness:(b.audioCapabilities?b.audioCapabilities[0].robustness:"")||"",videoRobustness:(b.videoCapabilities?b.videoCapabilities[0].robustness:"")||"",serverCertificate:f[0],serverCertificateUri:e[0],initData:g,keyIds:h}};
|
|
648
|
-
shaka.media.DrmEngine.processDrmInfos_=function(a,b,c,d,e,f,g){var h=[],k={};a=$jscomp.makeIterator(a);for(var l=a.next();!l.done;k={$jscomp$loop$prop$drmInfo$
|
|
649
|
-
h.includes(k.$jscomp$loop$prop$drmInfo$
|
|
650
|
-
d.push(k.$jscomp$loop$prop$drmInfo$
|
|
651
|
-
r.initData);return q}}(l))||f.push(l.$jscomp$loop$prop$initDataOverride$
|
|
649
|
+
shaka.media.DrmEngine.processDrmInfos_=function(a,b,c,d,e,f,g){var h=[],k={};a=$jscomp.makeIterator(a);for(var l=a.next();!l.done;k={$jscomp$loop$prop$drmInfo$929:k.$jscomp$loop$prop$drmInfo$929},l=a.next()){k.$jscomp$loop$prop$drmInfo$929=l.value;b.includes(k.$jscomp$loop$prop$drmInfo$929.encryptionScheme)||b.push(k.$jscomp$loop$prop$drmInfo$929.encryptionScheme);"org.w3.clearkey"==k.$jscomp$loop$prop$drmInfo$929.keySystem&&k.$jscomp$loop$prop$drmInfo$929.licenseServerUri.startsWith("data:application/json;base64,")?
|
|
650
|
+
h.includes(k.$jscomp$loop$prop$drmInfo$929.licenseServerUri)||h.push(k.$jscomp$loop$prop$drmInfo$929.licenseServerUri):c.includes(k.$jscomp$loop$prop$drmInfo$929.licenseServerUri)||c.push(k.$jscomp$loop$prop$drmInfo$929.licenseServerUri);e.includes(k.$jscomp$loop$prop$drmInfo$929.serverCertificateUri)||e.push(k.$jscomp$loop$prop$drmInfo$929.serverCertificateUri);k.$jscomp$loop$prop$drmInfo$929.serverCertificate&&(d.some(function(p){return function(q){return shaka.util.BufferUtils.equal(q,p.$jscomp$loop$prop$drmInfo$929.serverCertificate)}}(k))||
|
|
651
|
+
d.push(k.$jscomp$loop$prop$drmInfo$929.serverCertificate));if(k.$jscomp$loop$prop$drmInfo$929.initData){l={};for(var m=$jscomp.makeIterator(k.$jscomp$loop$prop$drmInfo$929.initData),n=m.next();!n.done;l={$jscomp$loop$prop$initDataOverride$931:l.$jscomp$loop$prop$initDataOverride$931},n=m.next())l.$jscomp$loop$prop$initDataOverride$931=n.value,f.some(function(p){return function(q){var r=p.$jscomp$loop$prop$initDataOverride$931;q=q.keyId&&q.keyId==r.keyId?!0:q.initDataType==r.initDataType&&shaka.util.BufferUtils.equal(q.initData,
|
|
652
|
+
r.initData);return q}}(l))||f.push(l.$jscomp$loop$prop$initDataOverride$931)}if(k.$jscomp$loop$prop$drmInfo$929.keyIds)for(l=$jscomp.makeIterator(k.$jscomp$loop$prop$drmInfo$929.keyIds),m=l.next();!m.done;m=l.next())g.add(m.value)}if(1==h.length)c.push(h[0]);else if(0<h.length){b=[];h=$jscomp.makeIterator(h);for(d=h.next();!d.done;d=h.next())d=window.atob(d.value.split("data:application/json;base64,").pop()),d=JSON.parse(d),b.push.apply(b,$jscomp.arrayFromIterable(d.keys));h=JSON.stringify({keys:b});
|
|
652
653
|
c.push("data:application/json;base64,"+window.btoa(h))}};
|
|
653
654
|
shaka.media.DrmEngine.fillInDrmInfoDefaults_=function(a,b,c,d){var e=a.keySystem;if(e&&("org.w3.clearkey"!=e||!a.licenseServerUri)){b.size&&(b=b.get(e)||"",a.licenseServerUri=b);a.keyIds||(a.keyIds=new Set);if(c=c.get(e))a.distinctiveIdentifierRequired||(a.distinctiveIdentifierRequired=c.distinctiveIdentifierRequired),a.persistentStateRequired||(a.persistentStateRequired=c.persistentStateRequired),a.videoRobustness||(a.videoRobustness=c.videoRobustness),a.audioRobustness||(a.audioRobustness=c.audioRobustness),
|
|
654
655
|
a.serverCertificate||(a.serverCertificate=c.serverCertificate),c.sessionType&&(a.sessionType=c.sessionType),a.serverCertificateUri||(a.serverCertificateUri=c.serverCertificateUri);d[e]&&(a.keySystem=d[e]);window.cast&&window.cast.__platform__&&"com.microsoft.playready"==e&&(a.keySystem="com.chromecast.playready")}};
|
|
@@ -693,14 +694,14 @@ shaka.media.SegmentReference.prototype.getTileDuration=function(){return this.ti
|
|
|
693
694
|
shaka.media.SegmentReference.prototype.markAsNonIndependent=function(){this.independent=!1};shaka.media.SegmentReference.prototype.isIndependent=function(){return this.independent};shaka.media.SegmentReference.prototype.markAsPartial=function(){this.partial=!0};shaka.media.SegmentReference.prototype.isPartial=function(){return this.partial};shaka.media.SegmentReference.prototype.markAsLastPartial=function(){this.lastPartial=!0};shaka.media.SegmentReference.prototype.isLastPartial=function(){return this.lastPartial};
|
|
694
695
|
shaka.media.SegmentReference.prototype.markAsByterangeOptimization=function(){this.byterangeOptimization=!0};shaka.media.SegmentReference.prototype.hasByterangeOptimization=function(){return this.byterangeOptimization};shaka.media.SegmentReference.prototype.setThumbnailSprite=function(a){this.thumbnailSprite=a};shaka.media.SegmentReference.prototype.getThumbnailSprite=function(){return this.thumbnailSprite};
|
|
695
696
|
shaka.media.SegmentReference.prototype.offset=function(a){this.startTime+=a;this.endTime+=a;this.trueEndTime+=a;for(var b=$jscomp.makeIterator(this.partialReferences),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.trueEndTime+=a};shaka.media.SegmentReference.prototype.syncAgainst=function(a){null==this.syncTime?shaka.log.alwaysError("Sync attempted without sync time!"):(a=this.syncTime-a-this.startTime,.001<=Math.abs(a)&&this.offset(a))};
|
|
696
|
-
shaka.media.SegmentReference.prototype.setSegmentData=function(a){this.segmentData=a};shaka.media.SegmentReference.prototype.getSegmentData=function(){return this.segmentData};
|
|
697
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
698
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
699
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
700
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
701
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
702
|
-
goog.exportProperty(shaka.media.SegmentReference.prototype,"
|
|
703
|
-
shaka.media.SegmentReference.Status={AVAILABLE:0,UNAVAILABLE:1,MISSING:2};goog.exportProperty(shaka.media.SegmentReference,"Status",shaka.media.SegmentReference.Status);shaka.media.TimeRangesUtils=function(){};shaka.media.TimeRangesUtils.bufferStart=function(a){return!a||1==a.length&&1E-6>a.end(0)-a.start(0)?null:1==a.length&&0>a.start(0)?0:a.length?a.start(0):null};shaka.media.TimeRangesUtils.bufferEnd=function(a){return!a||1==a.length&&1E-6>a.end(0)-a.start(0)?null:a.length?a.end(a.length-1):null};shaka.media.TimeRangesUtils.isBuffered=function(a,b){return!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0)||b>a.end(a.length-1)?!1:b>=a.start(0)};
|
|
697
|
+
shaka.media.SegmentReference.prototype.setSegmentData=function(a){this.segmentData=a};shaka.media.SegmentReference.prototype.getSegmentData=function(){return this.segmentData};shaka.media.SegmentReference.prototype.updateInitSegmentReference=function(a){this.initSegmentReference=a;for(var b=$jscomp.makeIterator(this.partialReferences),c=b.next();!c.done;c=b.next())c.value.updateInitSegmentReference(a)};goog.exportSymbol("shaka.media.SegmentReference",shaka.media.SegmentReference);
|
|
698
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"getSegmentData",shaka.media.SegmentReference.prototype.getSegmentData);goog.exportProperty(shaka.media.SegmentReference.prototype,"setSegmentData",shaka.media.SegmentReference.prototype.setSegmentData);goog.exportProperty(shaka.media.SegmentReference.prototype,"syncAgainst",shaka.media.SegmentReference.prototype.syncAgainst);goog.exportProperty(shaka.media.SegmentReference.prototype,"offset",shaka.media.SegmentReference.prototype.offset);
|
|
699
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"getThumbnailSprite",shaka.media.SegmentReference.prototype.getThumbnailSprite);goog.exportProperty(shaka.media.SegmentReference.prototype,"setThumbnailSprite",shaka.media.SegmentReference.prototype.setThumbnailSprite);goog.exportProperty(shaka.media.SegmentReference.prototype,"hasByterangeOptimization",shaka.media.SegmentReference.prototype.hasByterangeOptimization);
|
|
700
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsByterangeOptimization",shaka.media.SegmentReference.prototype.markAsByterangeOptimization);goog.exportProperty(shaka.media.SegmentReference.prototype,"isLastPartial",shaka.media.SegmentReference.prototype.isLastPartial);goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsLastPartial",shaka.media.SegmentReference.prototype.markAsLastPartial);goog.exportProperty(shaka.media.SegmentReference.prototype,"isPartial",shaka.media.SegmentReference.prototype.isPartial);
|
|
701
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsPartial",shaka.media.SegmentReference.prototype.markAsPartial);goog.exportProperty(shaka.media.SegmentReference.prototype,"isIndependent",shaka.media.SegmentReference.prototype.isIndependent);goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsNonIndependent",shaka.media.SegmentReference.prototype.markAsNonIndependent);goog.exportProperty(shaka.media.SegmentReference.prototype,"isPreload",shaka.media.SegmentReference.prototype.isPreload);
|
|
702
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsPreload",shaka.media.SegmentReference.prototype.markAsPreload);goog.exportProperty(shaka.media.SegmentReference.prototype,"markAsUnavailable",shaka.media.SegmentReference.prototype.markAsUnavailable);goog.exportProperty(shaka.media.SegmentReference.prototype,"getStatus",shaka.media.SegmentReference.prototype.getStatus);goog.exportProperty(shaka.media.SegmentReference.prototype,"getTileDuration",shaka.media.SegmentReference.prototype.getTileDuration);
|
|
703
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"getTilesLayout",shaka.media.SegmentReference.prototype.getTilesLayout);goog.exportProperty(shaka.media.SegmentReference.prototype,"getEndByte",shaka.media.SegmentReference.prototype.getEndByte);goog.exportProperty(shaka.media.SegmentReference.prototype,"getStartByte",shaka.media.SegmentReference.prototype.getStartByte);goog.exportProperty(shaka.media.SegmentReference.prototype,"getEndTime",shaka.media.SegmentReference.prototype.getEndTime);
|
|
704
|
+
goog.exportProperty(shaka.media.SegmentReference.prototype,"getStartTime",shaka.media.SegmentReference.prototype.getStartTime);goog.exportProperty(shaka.media.SegmentReference.prototype,"getUris",shaka.media.SegmentReference.prototype.getUris);shaka.media.SegmentReference.Status={AVAILABLE:0,UNAVAILABLE:1,MISSING:2};goog.exportProperty(shaka.media.SegmentReference,"Status",shaka.media.SegmentReference.Status);shaka.media.TimeRangesUtils=function(){};shaka.media.TimeRangesUtils.bufferStart=function(a){return!a||1==a.length&&1E-6>a.end(0)-a.start(0)?null:1==a.length&&0>a.start(0)?0:a.length?a.start(0):null};shaka.media.TimeRangesUtils.bufferEnd=function(a){return!a||1==a.length&&1E-6>a.end(0)-a.start(0)?null:a.length?a.end(a.length-1):null};shaka.media.TimeRangesUtils.isBuffered=function(a,b){return!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0)||b>a.end(a.length-1)?!1:b>=a.start(0)};
|
|
704
705
|
shaka.media.TimeRangesUtils.bufferedAheadOf=function(a,b){if(!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0))return 0;var c=0;a=$jscomp.makeIterator(shaka.media.TimeRangesUtils.getBufferedInfo(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.start;e=e.end;e>b&&(c+=e-Math.max(d,b))}return c};
|
|
705
706
|
shaka.media.TimeRangesUtils.getGapIndex=function(a,b,c){var d=shaka.media.TimeRangesUtils;if(!a||!a.length||1==a.length&&1E-6>a.end(0)-a.start(0))return null;a=d.getBufferedInfo(a).findIndex(function(e,f,g){return e.start>b&&(0==f||g[f-1].end-b<=c)});return 0<=a?a:null};shaka.media.TimeRangesUtils.getBufferedInfo=function(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++)b.push({start:a.start(c),end:a.end(c)});return b};
|
|
706
707
|
shaka.media.TimeRangesUtils.computeAddedRange=function(a,b){var c=shaka.media.TimeRangesUtils;if(!a||!a.length)return null;if(!b||!b.length)return c.getBufferedInfo(b).pop();b=c.getBufferedInfo(b).reverse();a=c.getBufferedInfo(a).reverse();c=$jscomp.makeIterator(b);for(b=c.next();!b.done;b=c.next()){b=b.value;for(var d=!1,e=$jscomp.makeIterator(a),f=e.next();!f.done;f=e.next())if(f=f.value,f.end>=b.start&&f.end<=b.end&&(d=!0,b.end>f.end))return{start:f.end,end:b.end};if(!d)return b}return null};/*
|
|
@@ -837,8 +838,8 @@ shaka.media.MediaSourceEngine.prototype.setTimestampOffset_=function(a,b){0>b&&(
|
|
|
837
838
|
shaka.media.MediaSourceEngine.prototype.onError_=function(a){var b=this.queues_[a][0];goog.asserts.assert(b,"Spurious error event!");goog.asserts.assert(!this.sourceBuffers_[a].updating,"SourceBuffer should not be updating on error!");b.p.reject(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_FAILED,this.video_.error?this.video_.error.code:0))};
|
|
838
839
|
shaka.media.MediaSourceEngine.prototype.onUpdateEnd_=function(a){if(!this.reloadingMediaSource_){var b=this.queues_[a][0];goog.asserts.assert(b,"Spurious updateend event!");b&&(goog.asserts.assert(!this.sourceBuffers_[a].updating,"SourceBuffer should not be updating on updateend!"),b.p.resolve(),this.popFromQueue_(a))}};
|
|
839
840
|
shaka.media.MediaSourceEngine.prototype.enqueueOperation_=function(a,b){this.destroyer_.ensureNotDestroyed();b={start:b,p:new shaka.util.PublicPromise};this.queues_[a].push(b);1==this.queues_[a].length&&this.startOperation_(a);return b.p};
|
|
840
|
-
shaka.media.MediaSourceEngine.prototype.enqueueBlockingOperation_=function(a){var b=this,c,d,e,f,g,h,k,l,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(n){switch(n.nextAddress){case 1:b.destroyer_.ensureNotDestroyed();c=[];d={};for(e in b.sourceBuffers_)d.$jscomp$loop$prop$ready$
|
|
841
|
-
1==b.queues_[e].length&&f.start(),d={$jscomp$loop$prop$ready$
|
|
841
|
+
shaka.media.MediaSourceEngine.prototype.enqueueBlockingOperation_=function(a){var b=this,c,d,e,f,g,h,k,l,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(n){switch(n.nextAddress){case 1:b.destroyer_.ensureNotDestroyed();c=[];d={};for(e in b.sourceBuffers_)d.$jscomp$loop$prop$ready$933=new shaka.util.PublicPromise,f={start:function(p){return function(){return p.$jscomp$loop$prop$ready$933.resolve()}}(d),p:d.$jscomp$loop$prop$ready$933},b.queues_[e].push(f),c.push(d.$jscomp$loop$prop$ready$933),
|
|
842
|
+
1==b.queues_[e].length&&f.start(),d={$jscomp$loop$prop$ready$933:d.$jscomp$loop$prop$ready$933};n.setCatchFinallyBlocks(2);return n.yield(Promise.all(c),4);case 4:n.leaveTryBlock(3);break;case 2:g=n.enterCatchBlock();goog.asserts.assert(b.destroyer_.destroyed(),"Should be destroyed by now");if(goog.DEBUG)for(h in b.sourceBuffers_)b.queues_[h].length&&(goog.asserts.assert(1==b.queues_[h].length,"Should be at most one item in queue!"),goog.asserts.assert(c.includes(b.queues_[h][0].p),"The item in queue should be one of our waiters!"),
|
|
842
843
|
b.queues_[h].shift());throw g;case 3:if(goog.DEBUG)for(k in b.sourceBuffers_)goog.asserts.assert(0==b.sourceBuffers_[k].updating,"SourceBuffers should not be updating after a blocking op!");n.setCatchFinallyBlocks(5,6);return n.yield(a(),6);case 6:n.enterFinallyBlock();for(l in b.sourceBuffers_)b.popFromQueue_(l);n.leaveFinallyBlock(0);break;case 5:throw m=n.enterCatchBlock(),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,
|
|
843
844
|
m,b.video_.error||"No error in the media element");}})};shaka.media.MediaSourceEngine.prototype.popFromQueue_=function(a){this.queues_[a].shift();this.startOperation_(a)};
|
|
844
845
|
shaka.media.MediaSourceEngine.prototype.startOperation_=function(a){var b=this.queues_[a][0];if(b)try{b.start()}catch(c){"QuotaExceededError"==c.name?b.p.reject(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.QUOTA_EXCEEDED_ERROR,a)):b.p.reject(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.MEDIA_SOURCE_OPERATION_THREW,c,this.video_.error||"No error in the media element")),
|
|
@@ -910,7 +911,7 @@ function(){return g.getStartTime_(d)});this.checkWindowTimer_=new shaka.util.Tim
|
|
|
910
911
|
shaka.media.MediaSourcePlayhead.prototype.release=function(){this.videoWrapper_&&(this.videoWrapper_.release(),this.videoWrapper_=null);this.gapController_&&(this.gapController_.release(),this.gapController_=null);this.checkWindowTimer_&&(this.checkWindowTimer_.stop(),this.checkWindowTimer_=null);this.mediaElement_=this.videoWrapper_=this.timeline_=this.config_=null;this.onSeek_=function(){}};shaka.media.MediaSourcePlayhead.prototype.setStartTime=function(a){this.videoWrapper_.setTime(a)};
|
|
911
912
|
shaka.media.MediaSourcePlayhead.prototype.getTime=function(){var a=this.videoWrapper_.getTime();return 0<this.mediaElement_.readyState&&!this.mediaElement_.paused?this.clampTime_(a):a};shaka.media.MediaSourcePlayhead.prototype.getStallsDetected=function(){return this.stallDetector_?this.stallDetector_.getStallsDetected():0};shaka.media.MediaSourcePlayhead.prototype.getGapsJumped=function(){return this.gapController_.getGapsJumped()};
|
|
912
913
|
shaka.media.MediaSourcePlayhead.prototype.getStartTime_=function(a){null==a?a=Infinity>this.timeline_.getDuration()?this.timeline_.getSeekRangeStart():this.timeline_.getSeekRangeEnd():0>a&&(a=this.timeline_.getSeekRangeEnd()+a);return this.clampSeekToDuration_(this.clampTime_(a))};shaka.media.MediaSourcePlayhead.prototype.notifyOfBufferingChange=function(){this.gapController_.onSegmentAppended()};
|
|
913
|
-
shaka.media.MediaSourcePlayhead.prototype.onPollWindow_=function(){if(0!=this.mediaElement_.readyState&&!this.mediaElement_.paused){var a=this.videoWrapper_.getTime(),b=this.timeline_.getSeekRangeStart(),c=this.timeline_.getSeekRangeEnd();c-b<this.minSeekRange_&&(b=c-this.minSeekRange_);
|
|
914
|
+
shaka.media.MediaSourcePlayhead.prototype.onPollWindow_=function(){if(0!=this.mediaElement_.readyState&&!this.mediaElement_.paused){var a=this.videoWrapper_.getTime(),b=this.timeline_.getSeekRangeStart(),c=this.timeline_.getSeekRangeEnd();c-b<this.minSeekRange_&&(b=c-this.minSeekRange_);a<b&&(b=this.reposition_(a),shaka.log.info("Jumping forward "+(b-a)+" seconds to catch up with the seek range."),this.mediaElement_.currentTime=b)}};shaka.media.MediaSourcePlayhead.prototype.onStarted_=function(a){this.gapController_.onStarted(a)};
|
|
914
915
|
shaka.media.MediaSourcePlayhead.prototype.onSeeking_=function(){this.gapController_.onSeeking();var a=this.videoWrapper_.getTime(),b=this.reposition_(a);if(Math.abs(b-a)>shaka.media.GapJumpingController.BROWSER_GAP_TOLERANCE){var c=Date.now()/1E3;if(!this.lastCorrectiveSeek_||this.lastCorrectiveSeek_<c-1){this.lastCorrectiveSeek_=c;this.videoWrapper_.setTime(b);return}}shaka.log.v1("Seek to "+a);this.onSeek_()};
|
|
915
916
|
shaka.media.MediaSourcePlayhead.prototype.clampSeekToDuration_=function(a){var b=this.timeline_.getDuration();return a>=b?(goog.asserts.assert(0<=this.config_.durationBackoff,"Duration backoff must be non-negative!"),b-this.config_.durationBackoff):a};
|
|
916
917
|
shaka.media.MediaSourcePlayhead.prototype.reposition_=function(a){goog.asserts.assert(this.config_,"Cannot reposition playhead when it has beeen destroyed");var b=Math.max(this.minBufferTime_,this.config_.rebufferingGoal),c=this.config_.safeSeekOffset,d=this.timeline_.getSeekRangeStart(),e=this.timeline_.getSeekRangeEnd(),f=this.timeline_.getDuration();e-d<this.minSeekRange_&&(d=e-this.minSeekRange_);var g=this.timeline_.getSafeSeekRangeStart(b),h=this.timeline_.getSafeSeekRangeStart(c);b=this.timeline_.getSafeSeekRangeStart(b+
|
|
@@ -927,15 +928,17 @@ shaka.media.SegmentIndex.prototype.fit=function(a,b,c){c=void 0===c?!1:c;goog.as
|
|
|
927
928
|
0!=this.references.length&&(a=this.references[this.references.length-1],b=new shaka.media.SegmentReference(a.startTime,b,a.getUrisInner,a.startByte,a.endByte,a.initSegmentReference,a.timestampOffset,a.appendWindowStart,a.appendWindowEnd,a.partialReferences,a.tilesLayout,a.tileDuration,a.syncTime,a.status,a.aesKey),b.mimeType=a.mimeType,b.codecs=a.codecs,b.discontinuitySequence=a.discontinuitySequence,this.references[this.references.length-1]=b)}};
|
|
928
929
|
shaka.media.SegmentIndex.prototype.updateEvery=function(a,b){var c=this;goog.asserts.assert(!this.timer_,"SegmentIndex timer already started!");this.immutable_||(this.timer_&&this.timer_.stop(),this.timer_=new shaka.util.Timer(function(){var d=b();d?c.references.push.apply(c.references,$jscomp.arrayFromIterable(d)):(c.timer_.stop(),c.timer_=null)}),this.timer_.tickEvery(a))};
|
|
929
930
|
shaka.media.SegmentIndex.prototype[Symbol.iterator]=function(){var a=this.getIteratorForTime(0);goog.asserts.assert(null!=a,"Iterator for 0 should never be null!");return a};
|
|
930
|
-
shaka.media.SegmentIndex.prototype.getIteratorForTime=function(a,b){b=void 0===b?!1:b;var
|
|
931
|
-
c
|
|
931
|
+
shaka.media.SegmentIndex.prototype.getIteratorForTime=function(a,b,c){b=void 0===b?!1:b;c=void 0===c?!1:c;var d=this.find(a);if(null==d)return null;d--;var e=this.get(d+1),f=-1;if(e&&e.hasPartialSegments())for(var g=e.partialReferences.length-1;0<=g;--g){var h=e.partialReferences[g];if(a>=h.startTime&&a<h.endTime){if(!b){for(;g&&!h.isIndependent();)g--,h=e.partialReferences[g];if(!h.isIndependent())return shaka.log.alwaysError("No independent partial segment found!"),null}d++;f=g-1;break}}return new shaka.media.SegmentIterator(this,
|
|
932
|
+
d,f,c)};shaka.media.SegmentIndex.prototype.isEmpty=function(){return 0==this.getNumReferences()};shaka.media.SegmentIndex.forSingleSegment=function(a,b,c){a=new shaka.media.SegmentReference(a,a+b,function(){return c},0,null,null,a,a,a+b);return new shaka.media.SegmentIndex([a])};goog.exportSymbol("shaka.media.SegmentIndex",shaka.media.SegmentIndex);goog.exportProperty(shaka.media.SegmentIndex,"forSingleSegment",shaka.media.SegmentIndex.forSingleSegment);
|
|
932
933
|
goog.exportProperty(shaka.media.SegmentIndex.prototype,"getIteratorForTime",shaka.media.SegmentIndex.prototype.getIteratorForTime);goog.exportProperty(shaka.media.SegmentIndex.prototype,"updateEvery",shaka.media.SegmentIndex.prototype.updateEvery);goog.exportProperty(shaka.media.SegmentIndex.prototype,"fit",shaka.media.SegmentIndex.prototype.fit);goog.exportProperty(shaka.media.SegmentIndex.prototype,"evict",shaka.media.SegmentIndex.prototype.evict);
|
|
933
934
|
goog.exportProperty(shaka.media.SegmentIndex.prototype,"mergeAndEvict",shaka.media.SegmentIndex.prototype.mergeAndEvict);goog.exportProperty(shaka.media.SegmentIndex.prototype,"offset",shaka.media.SegmentIndex.prototype.offset);goog.exportProperty(shaka.media.SegmentIndex.prototype,"get",shaka.media.SegmentIndex.prototype.get);goog.exportProperty(shaka.media.SegmentIndex.prototype,"find",shaka.media.SegmentIndex.prototype.find);
|
|
934
935
|
goog.exportProperty(shaka.media.SegmentIndex.prototype,"markImmutable",shaka.media.SegmentIndex.prototype.markImmutable);goog.exportProperty(shaka.media.SegmentIndex.prototype,"release",shaka.media.SegmentIndex.prototype.release);goog.exportProperty(shaka.media.SegmentIndex.prototype,"getNumEvicted",shaka.media.SegmentIndex.prototype.getNumEvicted);goog.exportProperty(shaka.media.SegmentIndex.prototype,"getNumReferences",shaka.media.SegmentIndex.prototype.getNumReferences);
|
|
935
|
-
goog.DEBUG&&(shaka.media.SegmentIndex.assertCorrectReferences_=function(a){goog.asserts.assert(a.every(function(b,c){if(0==c)return!0;c=a[c-1];return c.startTime<b.startTime?!0:c.startTime>b.startTime?!1:c.endTime<=b.endTime?!0:!1}),"SegmentReferences are incorrect")});shaka.media.SegmentIterator=function(a,b,c){this.segmentIndex_=a;this.currentPosition_=b;this.currentPartialPosition_=c};shaka.media.SegmentIterator.prototype.
|
|
936
|
+
goog.DEBUG&&(shaka.media.SegmentIndex.assertCorrectReferences_=function(a){goog.asserts.assert(a.every(function(b,c){if(0==c)return!0;c=a[c-1];return c.startTime<b.startTime?!0:c.startTime>b.startTime?!1:c.endTime<=b.endTime?!0:!1}),"SegmentReferences are incorrect")});shaka.media.SegmentIterator=function(a,b,c,d){this.segmentIndex_=a;this.currentPosition_=b;this.currentPartialPosition_=c;this.reverse=d};shaka.media.SegmentIterator.prototype.setReverse=function(a){this.reverse=a};
|
|
937
|
+
shaka.media.SegmentIterator.prototype.currentPosition=function(){return this.currentPosition_};
|
|
936
938
|
shaka.media.SegmentIterator.prototype.current=function(){var a=this.segmentIndex_.get(this.currentPosition_);a&&a.hasPartialSegments()&&a.hasAllPartialSegments()&&this.currentPartialPosition_>=a.partialReferences.length&&(this.currentPosition_++,this.currentPartialPosition_=0,a=this.segmentIndex_.get(this.currentPosition_));return a&&a.hasPartialSegments()?a.partialReferences[this.currentPartialPosition_]:a};
|
|
937
|
-
shaka.media.SegmentIterator.prototype.next=function(){var a=this.segmentIndex_.get(this.currentPosition_);a&&a.hasPartialSegments()?(this.currentPartialPosition_
|
|
938
|
-
|
|
939
|
+
shaka.media.SegmentIterator.prototype.next=function(){var a=this.segmentIndex_.get(this.currentPosition_);this.reverse?a&&a.hasPartialSegments()?(this.currentPartialPosition_--,0>this.currentPartialPosition_&&(this.currentPosition_--,(a=this.segmentIndex_.get(this.currentPosition_))&&a.hasPartialSegments()?this.currentPartialPosition_=a.partialReferences.length-1:this.currentPartialPosition_=0)):(this.currentPosition_--,this.currentPartialPosition_=0):a&&a.hasPartialSegments()?(this.currentPartialPosition_++,
|
|
940
|
+
a.hasAllPartialSegments()&&this.currentPartialPosition_==a.partialReferences.length&&(this.currentPosition_++,this.currentPartialPosition_=0)):(this.currentPosition_++,this.currentPartialPosition_=0);a=this.current();return{value:a,done:!a}};goog.exportSymbol("shaka.media.SegmentIterator",shaka.media.SegmentIterator);goog.exportProperty(shaka.media.SegmentIterator.prototype,"next",shaka.media.SegmentIterator.prototype.next);goog.exportProperty(shaka.media.SegmentIterator.prototype,"current",shaka.media.SegmentIterator.prototype.current);
|
|
941
|
+
goog.exportProperty(shaka.media.SegmentIterator.prototype,"currentPosition",shaka.media.SegmentIterator.prototype.currentPosition);goog.exportProperty(shaka.media.SegmentIterator.prototype,"setReverse",shaka.media.SegmentIterator.prototype.setReverse);shaka.media.MetaSegmentIndex=function(){shaka.media.SegmentIndex.call(this,[]);this.indexes_=[]};$jscomp.inherits(shaka.media.MetaSegmentIndex,shaka.media.SegmentIndex);
|
|
939
942
|
shaka.media.MetaSegmentIndex.prototype.appendSegmentIndex=function(a){goog.asserts.assert(0==this.indexes_.length||0==a.getNumEvicted(),"Should not append a new segment index with already-evicted segments");this.indexes_.push(a)};shaka.media.MetaSegmentIndex.prototype.clone=function(){var a=new shaka.media.MetaSegmentIndex;a.indexes_=this.indexes_.slice();return a};
|
|
940
943
|
shaka.media.MetaSegmentIndex.prototype.release=function(){for(var a=$jscomp.makeIterator(this.indexes_),b=a.next();!b.done;b=a.next())b.value.release();this.indexes_=[]};shaka.media.MetaSegmentIndex.prototype.forEachTopLevelReference=function(a){for(var b=$jscomp.makeIterator(this.indexes_),c=b.next();!c.done;c=b.next())c.value.forEachTopLevelReference(a)};
|
|
941
944
|
shaka.media.MetaSegmentIndex.prototype.find=function(a){for(var b=0,c=$jscomp.makeIterator(this.indexes_),d=c.next();!d.done;d=c.next()){d=d.value;var e=d.find(a);if(null!=e)return e+b;b+=d.getNumEvicted()+d.getNumReferences()}return null};
|
|
@@ -961,12 +964,15 @@ playTime:this.stateHistory_.getTimeSpentIn("playing"),pauseTime:this.stateHistor
|
|
|
961
964
|
shaka.util.Stats.getEmptyBlob=function(){return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,stallsDetected:NaN,gapsJumped:NaN,estimatedBandwidth:NaN,completionPercent:NaN,loadLatency:NaN,manifestTimeSeconds:NaN,drmTimeSeconds:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,liveLatency:NaN,maxSegmentDuration:NaN,bytesDownloaded:NaN,switchHistory:[],stateHistory:[]}};shaka.media.SegmentPrefetch=function(a,b,c){this.prefetchLimit_=a;this.stream_=b;this.prefetchPosTime_=0;this.fetchDispatcher_=c;this.segmentPrefetchMap_=new Map;this.initSegmentPrefetchMap_=new Map};shaka.media.SegmentPrefetch.prototype.replaceFetchDispatcher=function(a){this.fetchDispatcher_=a;for(var b=$jscomp.makeIterator(this.segmentPrefetchMap_.values()),c=b.next();!c.done;c=b.next())c.value.replaceFetchDispatcher(a)};shaka.media.SegmentPrefetch.prototype.getLastKnownPosition=function(){return this.prefetchPosTime_};
|
|
962
965
|
shaka.media.SegmentPrefetch.prototype.prefetchSegmentsByTime=function(a,b){b=void 0===b?!1:b;goog.asserts.assert(0<this.prefetchLimit_,"SegmentPrefetch can not be used when prefetchLimit <= 0.");var c=shaka.media.SegmentPrefetch.logPrefix_(this.stream_);if(this.stream_.segmentIndex){if(a=this.stream_.segmentIndex.getIteratorForTime(Math.max(a,this.prefetchPosTime_),!0))if(c=a.next().value,b&&(c=a.next().value),c){for(;this.segmentPrefetchMap_.size<this.prefetchLimit_&&null!=c;){b=!0;c.isPreload()&&
|
|
963
966
|
null!=c.endByte&&(b=!1);c.getStatus()==shaka.media.SegmentReference.Status.MISSING&&(b=!1);b&&c.initSegmentReference&&this.prefetchInitSegment(c.initSegmentReference);b&&!this.segmentPrefetchMap_.has(c)&&(b=new shaka.media.SegmentPrefetchOperation(this.fetchDispatcher_),b.dispatchFetch(c,this.stream_),this.segmentPrefetchMap_.set(c,b));this.prefetchPosTime_=c.startTime;if(this.stream_.fastSwitching&&c.isPartial()&&c.isLastPartial())break;c=a.next().value}this.clearInitSegments_()}}else shaka.log.debug(c,
|
|
964
|
-
"missing segmentIndex")};
|
|
967
|
+
"missing segmentIndex")};
|
|
968
|
+
shaka.media.SegmentPrefetch.prototype.prefetchInitSegment=function(a){goog.asserts.assert(0<this.prefetchLimit_,"SegmentPrefetch can not be used when prefetchLimit <= 0.");var b=shaka.media.SegmentPrefetch.logPrefix_(this.stream_);this.stream_.segmentIndex?Array.from(this.initSegmentPrefetchMap_.keys()).some(function(c){return shaka.media.InitSegmentReference.equal(c,a)})||(b=new shaka.media.SegmentPrefetchOperation(this.fetchDispatcher_),b.dispatchFetch(a,this.stream_),this.initSegmentPrefetchMap_.set(a,b)):
|
|
969
|
+
shaka.log.debug(b,"missing segmentIndex")};
|
|
965
970
|
shaka.media.SegmentPrefetch.prototype.getPrefetchedSegment=function(a,b){goog.asserts.assert(0<this.prefetchLimit_,"SegmentPrefetch can not be used when prefetchLimit <= 0.");var c=shaka.media.SegmentPrefetch.logPrefix_(this.stream_),d=this.segmentPrefetchMap_;a instanceof shaka.media.InitSegmentReference&&(d=this.initSegmentPrefetchMap_);if(d.has(a)){var e=d.get(a);b&&e.setStreamDataCallback(b);a instanceof shaka.media.SegmentReference?shaka.log.debug(c,"reused prefetched segment at time:",a.startTime,
|
|
966
971
|
"mapSize",d.size):shaka.log.debug(c,"reused prefetched init segment at time, mapSize",d.size);return e.getOperation()}a instanceof shaka.media.SegmentReference?shaka.log.debug(c,"missed segment at time:",a.startTime,"mapSize",d.size):shaka.log.debug(c,"missed init segment at time, mapSize",d.size);return null};shaka.media.SegmentPrefetch.prototype.clearMap_=function(a){a=$jscomp.makeIterator(a.keys());for(var b=a.next();!b.done;b=a.next())(b=b.value)&&this.abortPrefetchedSegment_(b)};
|
|
967
|
-
shaka.media.SegmentPrefetch.prototype.clearAll=function(){this.clearMap_(this.segmentPrefetchMap_);this.clearMap_(this.initSegmentPrefetchMap_);var a=shaka.media.SegmentPrefetch.logPrefix_(this.stream_);shaka.log.debug(a,"cleared all");this.prefetchPosTime_=0};shaka.media.SegmentPrefetch.prototype.
|
|
968
|
-
shaka.media.SegmentPrefetch.prototype.
|
|
969
|
-
shaka.media.SegmentPrefetch.prototype.
|
|
972
|
+
shaka.media.SegmentPrefetch.prototype.clearAll=function(){this.clearMap_(this.segmentPrefetchMap_);this.clearMap_(this.initSegmentPrefetchMap_);var a=shaka.media.SegmentPrefetch.logPrefix_(this.stream_);shaka.log.debug(a,"cleared all");this.prefetchPosTime_=0};shaka.media.SegmentPrefetch.prototype.removeReference=function(a){this.abortPrefetchedSegment_(a)};
|
|
973
|
+
shaka.media.SegmentPrefetch.prototype.evict=function(a,b){b=void 0===b?!1:b;for(var c=$jscomp.makeIterator(this.segmentPrefetchMap_.keys()),d=c.next();!d.done;d=c.next())d=d.value,a>d.endTime&&this.abortPrefetchedSegment_(d);b&&this.clearInitSegments_()};
|
|
974
|
+
shaka.media.SegmentPrefetch.prototype.clearInitSegments_=function(){for(var a=Array.from(this.segmentPrefetchMap_.keys()),b={},c=$jscomp.makeIterator(this.initSegmentPrefetchMap_.keys()),d=c.next();!d.done;b={$jscomp$loop$prop$initSegmentReference$935:b.$jscomp$loop$prop$initSegmentReference$935},d=c.next())b.$jscomp$loop$prop$initSegmentReference$935=d.value,a.some(function(e){return function(f){return shaka.media.InitSegmentReference.equal(f.initSegmentReference,e.$jscomp$loop$prop$initSegmentReference$935)}}(b))||
|
|
975
|
+
this.abortPrefetchedSegment_(b.$jscomp$loop$prop$initSegmentReference$935)};shaka.media.SegmentPrefetch.prototype.resetLimit=function(a){goog.asserts.assert(0<=a,"The new prefetch limit must be >= 0.");var b=shaka.media.SegmentPrefetch.logPrefix_(this.stream_);shaka.log.debug(b,"resetting prefetch limit to",a);this.prefetchLimit_=a;for(b=Array.from(this.segmentPrefetchMap_.keys());b.length>a;){var c=b.pop();c&&this.abortPrefetchedSegment_(c)}this.clearInitSegments_()};
|
|
970
976
|
shaka.media.SegmentPrefetch.prototype.switchStream=function(a){a&&a!==this.stream_&&(this.clearAll(),this.stream_=a)};shaka.media.SegmentPrefetch.prototype.getStream=function(){return this.stream_};
|
|
971
977
|
shaka.media.SegmentPrefetch.prototype.abortPrefetchedSegment_=function(a){var b=shaka.media.SegmentPrefetch.logPrefix_(this.stream_),c=this.segmentPrefetchMap_;a instanceof shaka.media.InitSegmentReference&&(c=this.initSegmentPrefetchMap_);var d=c.get(a);c.delete(a);d&&(d.abort(),a instanceof shaka.media.SegmentReference?shaka.log.debug(b,"pop and abort prefetched segment at time:",a.startTime):shaka.log.debug(b,"pop and abort prefetched init segment"))};
|
|
972
978
|
shaka.media.SegmentPrefetch.logPrefix_=function(a){return"SegmentPrefetch("+a.type+":"+a.id+")"};shaka.media.SegmentPrefetchOperation=function(a){this.fetchDispatcher_=a;this.operation_=this.streamDataCallback_=null};shaka.media.SegmentPrefetchOperation.prototype.replaceFetchDispatcher=function(a){this.fetchDispatcher_=a};
|
|
@@ -991,8 +997,8 @@ shaka.media.StreamingEngine.prototype.getCurrentTextStream=function(){return thi
|
|
|
991
997
|
shaka.media.StreamingEngine.prototype.loadNewTextStream_=function(a){var b=this,c,d,e,f,g,h,k;return $jscomp.asyncExecutePromiseGeneratorProgram(function(l){switch(l.nextAddress){case 1:return c=shaka.util.ManifestParserUtils.ContentType,goog.asserts.assert(!b.mediaStates_.has(c.TEXT),"Should not call loadNewTextStream_ while streaming text!"),b.textStreamSequenceId_++,d=b.textStreamSequenceId_,l.setCatchFinallyBlocks(2),l.yield(b.playerInterface_.mediaSourceEngine.clear(c.TEXT),4);case 4:l.leaveTryBlock(3);
|
|
992
998
|
break;case 2:if(e=l.enterCatchBlock(),b.playerInterface_)b.playerInterface_.onError(e);case 3:f=shaka.util.MimeUtils.getFullType(a.mimeType,a.codecs),b.playerInterface_.mediaSourceEngine.reinitText(f,b.manifest_.sequenceMode,a.external),g=b.playerInterface_.mediaSourceEngine.getTextDisplayer(),(h=g.isTextVisible()||b.config_.alwaysStreamText)&&b.textStreamSequenceId_==d&&(k=b.createMediaState_(a),b.mediaStates_.set(c.TEXT,k),b.scheduleUpdate_(k,0)),l.jumpToEnd()}})};
|
|
993
999
|
shaka.media.StreamingEngine.prototype.unloadTextStream=function(){var a=shaka.util.ManifestParserUtils.ContentType,b=this.mediaStates_.get(a.TEXT);b&&(this.cancelUpdate_(b),this.abortOperations_(b).catch(function(){}),this.mediaStates_.delete(a.TEXT));this.currentTextStream_=null};
|
|
994
|
-
shaka.media.StreamingEngine.prototype.setTrickPlay=function(a){var b=
|
|
995
|
-
this.switchInternal_(
|
|
1000
|
+
shaka.media.StreamingEngine.prototype.setTrickPlay=function(a){var b=shaka.util.ManifestParserUtils.ContentType;this.updateSegmentIteratorReverse_();if(b=this.mediaStates_.get(b.VIDEO)){var c=b.stream;if(c)if(shaka.log.debug("setTrickPlay",a),a)(a=c.trickModeVideo)&&!b.restoreStreamAfterTrickPlay&&(shaka.log.debug("Engaging trick mode stream",a),this.switchInternal_(a,!1,0,!1),b.restoreStreamAfterTrickPlay=c);else if(a=b.restoreStreamAfterTrickPlay)shaka.log.debug("Restoring non-trick-mode stream",
|
|
1001
|
+
a),b.restoreStreamAfterTrickPlay=null,this.switchInternal_(a,!0,0,!1)}};shaka.media.StreamingEngine.prototype.switchVariant=function(a,b,c,d,e){b=void 0===b?!1:b;c=void 0===c?0:c;d=void 0===d?!1:d;e=void 0===e?!1:e;this.currentVariant_=a;this.startupComplete_&&(a.video&&this.switchInternal_(a.video,b,c,d,e),a.audio&&this.switchInternal_(a.audio,b,c,d,e))};
|
|
996
1002
|
shaka.media.StreamingEngine.prototype.switchTextStream=function(a){var b=this,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){if(1==d.nextAddress){b.currentTextStream_=a;if(!b.startupComplete_)return d.return();c=shaka.util.ManifestParserUtils.ContentType;goog.asserts.assert(a&&a.type==c.TEXT,"Wrong stream type passed to switchTextStream!");return a.segmentIndex?d.jumpTo(2):d.yield(a.createSegmentIndex(),2)}b.switchInternal_(a,!0,0,!1);d.jumpToEnd()})};
|
|
997
1003
|
shaka.media.StreamingEngine.prototype.reloadTextStream=function(){var a=this.mediaStates_.get(shaka.util.ManifestParserUtils.ContentType.TEXT);a&&this.switchInternal_(a.stream,!0,0,!0)};
|
|
998
1004
|
shaka.media.StreamingEngine.prototype.switchInternal_=function(a,b,c,d,e){var f=this,g=shaka.util.ManifestParserUtils.ContentType,h=this.mediaStates_.get(a.type);h||a.type!=g.TEXT?(goog.asserts.assert(h,"switch: expected mediaState to exist"),h&&(h.restoreStreamAfterTrickPlay&&(shaka.log.debug("switch during trick play mode",a),a.trickModeVideo?(h.restoreStreamAfterTrickPlay=a,a=a.trickModeVideo,shaka.log.debug("switch found trick play stream",a)):(h.restoreStreamAfterTrickPlay=null,shaka.log.debug("switch found no special trick play stream"))),
|
|
@@ -1014,9 +1020,9 @@ shaka.media.StreamingEngine.prototype.createMediaState_=function(a){return{strea
|
|
|
1014
1020
|
operation:null}};
|
|
1015
1021
|
shaka.media.StreamingEngine.prototype.createSegmentPrefetch_=function(a){var b=this,c=shaka.util.ManifestParserUtils.ContentType;if(a.type===c.VIDEO&&this.config_.disableVideoPrefetch||a.type===c.AUDIO&&this.config_.disableAudioPrefetch)return null;var d=shaka.util.MimeUtils,e=d.CEA608_CLOSED_CAPTION_MIMETYPE;d=d.CEA708_CLOSED_CAPTION_MIMETYPE;return a.type===c.TEXT&&(a.mimeType==e||a.mimeType==d)||a.type===c.TEXT&&this.config_.disableTextPrefetch?null:this.audioPrefetchMap_.has(a)?this.audioPrefetchMap_.get(a):
|
|
1016
1022
|
(c=(c=this.mediaStates_.get(a.type))&&c.segmentPrefetch)&&a===c.getStream()?c:0<this.config_.segmentPrefetchLimit?new shaka.media.SegmentPrefetch(this.config_.segmentPrefetchLimit,a,function(f,g,h){return b.dispatchFetch_(f,g,h)}):null};
|
|
1017
|
-
shaka.media.StreamingEngine.prototype.updatePrefetchMapForAudio_=function(){for(var a=this.config_.segmentPrefetchLimit,b=this.config_.prefetchAudioLanguages,c=shaka.util.LanguageUtils,d={},e=$jscomp.makeIterator(this.manifest_.variants),f=e.next();!f.done;d={$jscomp$loop$prop$variant$
|
|
1018
|
-
f.resetLimit(a),!(0<a&&b.some(function(h){return function(k){return c.areLanguageCompatible(h.$jscomp$loop$prop$variant$
|
|
1019
|
-
(d.$jscomp$loop$prop$variant$
|
|
1023
|
+
shaka.media.StreamingEngine.prototype.updatePrefetchMapForAudio_=function(){for(var a=this.config_.segmentPrefetchLimit,b=this.config_.prefetchAudioLanguages,c=shaka.util.LanguageUtils,d={},e=$jscomp.makeIterator(this.manifest_.variants),f=e.next();!f.done;d={$jscomp$loop$prop$variant$938:d.$jscomp$loop$prop$variant$938},f=e.next())if(d.$jscomp$loop$prop$variant$938=f.value,d.$jscomp$loop$prop$variant$938.audio)if(this.audioPrefetchMap_.has(d.$jscomp$loop$prop$variant$938.audio)){if(f=this.audioPrefetchMap_.get(d.$jscomp$loop$prop$variant$938.audio),
|
|
1024
|
+
f.resetLimit(a),!(0<a&&b.some(function(h){return function(k){return c.areLanguageCompatible(h.$jscomp$loop$prop$variant$938.audio.language,k)}}(d)))){var g=this.mediaStates_.get(d.$jscomp$loop$prop$variant$938.audio.type);f!==(g&&g.segmentPrefetch)&&f.clearAll();this.audioPrefetchMap_.delete(d.$jscomp$loop$prop$variant$938.audio)}}else 0>=a||!b.some(function(h){return function(k){return c.areLanguageCompatible(h.$jscomp$loop$prop$variant$938.audio.language,k)}}(d))||!(f=this.createSegmentPrefetch_(d.$jscomp$loop$prop$variant$938.audio))||
|
|
1025
|
+
(d.$jscomp$loop$prop$variant$938.audio.segmentIndex||d.$jscomp$loop$prop$variant$938.audio.createSegmentIndex(),this.audioPrefetchMap_.set(d.$jscomp$loop$prop$variant$938.audio,f))};shaka.media.StreamingEngine.prototype.updateDuration=function(){var a=this.manifest_.presentationTimeline.getDuration();Infinity>a?this.playerInterface_.mediaSourceEngine.setDuration(a):this.playerInterface_.mediaSourceEngine.setDuration(this.config_.infiniteLiveStreamDuration?Infinity:Math.pow(2,32))};
|
|
1020
1026
|
shaka.media.StreamingEngine.prototype.onUpdate_=function(a){var b=this,c,d,e,f,g,h;return $jscomp.asyncExecutePromiseGeneratorProgram(function(k){switch(k.nextAddress){case 1:b.destroyer_.ensureNotDestroyed();c=shaka.media.StreamingEngine.logPrefix_(a);goog.asserts.assert(!a.performingUpdate&&null!=a.updateTimer,c+" unexpected call to onUpdate_()");if(a.performingUpdate||null==a.updateTimer)return k.return();goog.asserts.assert(!a.clearingBuffer,c+" onUpdate_() should not be called when clearing the buffer");
|
|
1021
1027
|
if(a.clearingBuffer)return k.return();a.updateTimer=null;if(!a.waitingToClearBuffer){k.jumpTo(2);break}shaka.log.debug(c,"skipping update and clearing the buffer");return k.yield(b.clearBuffer_(a,a.waitingToFlushBuffer,a.clearBufferSafeMargin),3);case 3:return k.return();case 2:if(a.stream.segmentIndex){k.jumpTo(4);break}d=a.stream;return k.yield(a.stream.createSegmentIndex(),5);case 5:if(d!=a.stream)return d.closeSegmentIndex&&(goog.asserts.assert(!a.stream.segmentIndex,"mediastate.stream should not have segmentIndex yet."),
|
|
1022
1028
|
d.closeSegmentIndex()),a.performingUpdate||a.updateTimer||b.scheduleUpdate_(a,0),k.return();case 4:k.setCatchFinallyBlocks(6);e=b.update_(a);null!=e&&(b.scheduleUpdate_(a,e),a.hasError=!1);k.leaveTryBlock(7);break;case 6:return f=k.enterCatchBlock(),k.yield(b.handleStreamingError_(a,f),8);case 8:return k.return();case 7:g=Array.from(b.mediaStates_.values());if(!b.startupComplete_||!g.every(function(l){return l.endOfStream})){k.jumpTo(0);break}shaka.log.v1(c,"calling endOfStream()...");return k.yield(b.playerInterface_.mediaSourceEngine.endOfStream(),
|
|
@@ -1027,9 +1033,9 @@ d,"bufferedAhead="+f);var g=Math.max(1,Math.max(this.manifest_.minBufferTime||0,
|
|
|
1027
1033
|
!1;if(f>=g)return shaka.log.v2(c,"buffering goal met"),this.config_.updateIntervalSeconds/2;b=this.getSegmentReferenceNeeded_(a,d,k);if(!b)return this.config_.updateIntervalSeconds;f=Infinity;g=Array.from(this.mediaStates_.values());g=$jscomp.makeIterator(g);for(h=g.next();!h.done;h=g.next())h=h.value,shaka.media.StreamingEngine.isEmbeddedText_(h)||h.segmentIterator&&!h.segmentIterator.current()||(h=this.getTimeNeeded_(h,d),f=Math.min(f,h));g=this.manifest_.presentationTimeline.getMaxSegmentDuration()*
|
|
1028
1034
|
shaka.media.StreamingEngine.MAX_RUN_AHEAD_SEGMENTS_;if(e>=f+g)return shaka.log.v2(c,"waiting for other streams to buffer"),this.config_.updateIntervalSeconds;a.segmentPrefetch&&a.segmentIterator&&!this.audioPrefetchMap_.has(a.stream)&&(a.segmentPrefetch.evict(d),a.segmentPrefetch.prefetchSegmentsByTime(b.startTime));this.fetchAndAppend_(a,d,b).catch(function(){});return null};
|
|
1029
1035
|
shaka.media.StreamingEngine.prototype.getTimeNeeded_=function(a,b){return a.lastSegmentReference?a.lastSegmentReference.endTime:b};
|
|
1030
|
-
shaka.media.StreamingEngine.prototype.getSegmentReferenceNeeded_=function(a,b,c){var d=shaka.media.StreamingEngine.logPrefix_(a);goog.asserts.assert(a.stream.segmentIndex,"segment index should have been generated already");if(a.segmentIterator)return a.segmentIterator.current();if(a.lastSegmentReference||c)return b=a.lastSegmentReference?a.lastSegmentReference.endTime:c,goog.asserts.assert(null!=b,"Should have a time to search"),shaka.log.v1(d,"looking up segment from new stream endTime:",b),
|
|
1031
|
-
a.stream.segmentIndex.getIteratorForTime(b),a=a.segmentIterator&&a.segmentIterator.next().value,null==a&&shaka.log.warning(d,"cannot find segment","endTime:",b),a;c=this.config_.inaccurateManifestTolerance;var e=Math.max(b-c,0);shaka.log.v1(d,"looking up segment","lookupTime:",e,"presentationTime:",b);var f=null;c&&(a.segmentIterator=a.stream.segmentIndex.getIteratorForTime(e),
|
|
1032
|
-
a.segmentIterator&&a.segmentIterator.next().value);null==
|
|
1036
|
+
shaka.media.StreamingEngine.prototype.getSegmentReferenceNeeded_=function(a,b,c){var d=shaka.media.StreamingEngine.logPrefix_(a);goog.asserts.assert(a.stream.segmentIndex,"segment index should have been generated already");if(a.segmentIterator)return a.segmentIterator.current();if(a.lastSegmentReference||c)return b=a.lastSegmentReference?a.lastSegmentReference.endTime:c,goog.asserts.assert(null!=b,"Should have a time to search"),shaka.log.v1(d,"looking up segment from new stream endTime:",b),c=0>
|
|
1037
|
+
this.playerInterface_.getPlaybackRate(),a.segmentIterator=a.stream.segmentIndex.getIteratorForTime(b,!1,c),a=a.segmentIterator&&a.segmentIterator.next().value,null==a&&shaka.log.warning(d,"cannot find segment","endTime:",b),a;c=this.config_.inaccurateManifestTolerance;var e=Math.max(b-c,0);shaka.log.v1(d,"looking up segment","lookupTime:",e,"presentationTime:",b);var f=0>this.playerInterface_.getPlaybackRate(),g=null;c&&(a.segmentIterator=a.stream.segmentIndex.getIteratorForTime(e,!1,f),g=a.segmentIterator&&
|
|
1038
|
+
a.segmentIterator.next().value);g||(a.segmentIterator=a.stream.segmentIndex.getIteratorForTime(b,!1,f),g=a.segmentIterator&&a.segmentIterator.next().value);null==g&&shaka.log.warning(d,"cannot find segment","lookupTime:",e,"presentationTime:",b);return g};
|
|
1033
1039
|
shaka.media.StreamingEngine.prototype.fetchAndAppend_=function(a,b,c){var d=this,e,f,g,h,k,l,m,n,p,q,r,v,x,w,t,y,u,z,A;return $jscomp.asyncExecutePromiseGeneratorProgram(function(B){switch(B.nextAddress){case 1:e=shaka.util.ManifestParserUtils.ContentType;f=shaka.media.StreamingEngine;g=f.logPrefix_(a);shaka.log.v1(g,"fetchAndAppend_:","presentationTime="+b,"reference.startTime="+c.startTime,"reference.endTime="+c.endTime);h=a.stream;k=a.segmentIterator;a.performingUpdate=!0;B.setCatchFinallyBlocks(2);
|
|
1034
1040
|
if(c.getStatus()==shaka.media.SegmentReference.Status.MISSING)throw new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,shaka.util.Error.Category.NETWORK,shaka.util.Error.Code.SEGMENT_MISSING);return B.yield(d.initSourceBuffer_(a,c),4);case 4:d.destroyer_.ensureNotDestroyed();if(d.fatalError_)return B.return();shaka.log.v2(g,"fetching segment");l="video/mp4"==h.mimeType||"audio/mp4"==h.mimeType;m=window.ReadableStream;if(d.config_.lowLatencyMode&&m&&l&&(d.manifest_.type!=shaka.media.ManifestParser.HLS||
|
|
1035
1041
|
c.hasByterangeOptimization()))return q=new Uint8Array(0),v=r=!1,w=function(C){var F,D,G,H;return $jscomp.asyncExecutePromiseGeneratorProgram(function(E){switch(E.nextAddress){case 1:if(r)return E.return();v=!0;d.destroyer_.ensureNotDestroyed();if(d.fatalError_)return E.return();E.setCatchFinallyBlocks(2);q=d.concatArray_(q,C);F=!1;D=0;(new shaka.util.Mp4Parser).box("mdat",function(I){D=I.size+I.start;F=!0}).parse(q,!1,!0);if(!F){E.jumpTo(4);break}G=q.subarray(0,D);q=q.subarray(D);return E.yield(d.append_(a,
|
|
@@ -1037,7 +1043,7 @@ b,h,c,G,!0),5);case 5:a.segmentPrefetch&&a.segmentIterator&&a.segmentPrefetch.pr
|
|
|
1037
1043
|
return a.waitingToClearBuffer?(shaka.log.info(g,"waitingToClearBuffer, skip append"),a.performingUpdate=!1,d.scheduleUpdate_(a,0),B.return()):B.yield(d.append_(a,b,h,c,p),6);case 9:t=B.yieldResult;if(x)throw x;if(v){B.jumpTo(10);break}r=!0;d.destroyer_.ensureNotDestroyed();return d.fatalError_?B.return():a.waitingToClearBuffer?(shaka.log.info(g,"waitingToClearBuffer, skip append"),a.performingUpdate=!1,d.scheduleUpdate_(a,0),B.return()):B.yield(d.append_(a,b,h,c,t),10);case 10:a.segmentPrefetch&&
|
|
1038
1044
|
a.segmentIterator&&a.segmentPrefetch.prefetchSegmentsByTime(c.startTime,!0);case 6:d.destroyer_.ensureNotDestroyed();if(d.fatalError_)return B.return();a.lastSegmentReference=c;y=k.next().value;shaka.log.v2(g,"advancing to next segment",y);a.performingUpdate=!1;a.recovering=!1;u=d.playerInterface_.mediaSourceEngine.getBufferedInfo();z=u[a.type];shaka.log.v1(g,"finished fetch and append",JSON.stringify(z));if(!a.waitingToClearBuffer)d.playerInterface_.onSegmentAppended(c,a.stream);d.scheduleUpdate_(a,
|
|
1039
1045
|
0);B.leaveTryBlock(0);break;case 2:A=B.enterCatchBlock();d.destroyer_.ensureNotDestroyed(A);if(d.fatalError_)return B.return();goog.asserts.assert(A instanceof shaka.util.Error,"Should only receive a Shaka error");a.performingUpdate=!1;if(A.code==shaka.util.Error.Code.OPERATION_ABORTED)a.performingUpdate=!1,d.cancelUpdate_(a),d.scheduleUpdate_(a,0),B.jumpTo(0);else if(a.type==e.TEXT&&d.config_.ignoreTextStreamFailures)A.code==shaka.util.Error.Code.BAD_HTTP_STATUS?shaka.log.warning(g,"Text stream failed to download. Proceeding without it."):
|
|
1040
|
-
shaka.log.warning(g,"Text stream failed to parse. Proceeding without it."),d.mediaStates_.delete(e.TEXT),B.jumpTo(0);else if(A.code==shaka.util.Error.Code.QUOTA_EXCEEDED_ERROR)d.handleQuotaExceeded_(a,A),B.jumpTo(0);else return shaka.log.error(g,"failed fetch and append: code="+A.code),a.hasError=!0,A.severity=shaka.util.Error.Severity.CRITICAL,B.yield(d.handleStreamingError_(a,A),0)}})};
|
|
1046
|
+
shaka.log.warning(g,"Text stream failed to parse. Proceeding without it."),d.mediaStates_.delete(e.TEXT),B.jumpTo(0);else if(A.code==shaka.util.Error.Code.QUOTA_EXCEEDED_ERROR)d.handleQuotaExceeded_(a,A),B.jumpTo(0);else return shaka.log.error(g,"failed fetch and append: code="+A.code),a.hasError=!0,A.category==shaka.util.Error.Category.NETWORK&&a.segmentPrefetch&&a.segmentPrefetch.removeReference(c),A.severity=shaka.util.Error.Severity.CRITICAL,B.yield(d.handleStreamingError_(a,A),0)}})};
|
|
1041
1047
|
shaka.media.StreamingEngine.prototype.aesDecrypt_=function(a,b,c){var d,e,f,g,h;return $jscomp.asyncExecutePromiseGeneratorProgram(function(k){if(1==k.nextAddress){d=b;if(d.cryptoKey)return k.jumpTo(2);goog.asserts.assert(d.fetchKey,"If AES cryptoKey was not preloaded, fetchKey function should be provided");return k.yield(d.fetchKey(),3)}2!=k.nextAddress&&goog.asserts.assert(d.cryptoKey,"AES cryptoKey should now be set");e=d.iv;if(!e)for(e=shaka.util.BufferUtils.toUint8(new ArrayBuffer(16)),f=d.firstMediaSequenceNumber+
|
|
1042
1048
|
c,g=e.byteLength-1;0<=g;g--)e[g]=f&255,f>>=8;h="CBC"==b.blockCipherMode?{name:"AES-CBC",iv:e}:{name:"AES-CTR",counter:e,length:64};return k.return(window.crypto.subtle.decrypt(h,d.cryptoKey,a))})};
|
|
1043
1049
|
shaka.media.StreamingEngine.prototype.retry=function(a){if(this.destroyer_.destroyed())return shaka.log.error("Unable to retry after StreamingEngine is destroyed!"),!1;if(this.fatalError_)return shaka.log.error("Unable to retry after StreamingEngine encountered a fatal error!"),!1;for(var b=$jscomp.makeIterator(this.mediaStates_.values()),c=b.next();!c.done;c=b.next()){c=c.value;var d=shaka.media.StreamingEngine.logPrefix_(c);!c.hasError||c.performingUpdate||c.updateTimer||(shaka.log.info(d,"Retrying after failure..."),
|
|
@@ -1077,6 +1083,7 @@ e.jumpToEnd()})};shaka.media.StreamingEngine.prototype.getDisabledTime_=function
|
|
|
1077
1083
|
shaka.media.StreamingEngine.prototype.resetMediaSource=function(){var a=this,b,c,d,e,f,g;return $jscomp.asyncExecutePromiseGeneratorProgram(function(h){if(1==h.nextAddress){b=Date.now()/1E3;c=a.config_.minTimeBetweenRecoveries;if(!a.config_.allowMediaSourceRecoveries||b-a.lastMediaSourceReset_<c)return h.return(!1);a.lastMediaSourceReset_=b;d=shaka.util.ManifestParserUtils.ContentType;if(e=a.mediaStates_.get(d.AUDIO))e.lastInitSegmentReference=null,a.forceClearBuffer_(e),a.abortOperations_(e).catch(function(){});
|
|
1078
1084
|
if(f=a.mediaStates_.get(d.VIDEO))f.lastInitSegmentReference=null,a.forceClearBuffer_(f),a.abortOperations_(f).catch(function(){});g=new Map;a.currentVariant_.audio&&g.set(d.AUDIO,a.currentVariant_.audio);a.currentVariant_.video&&g.set(d.VIDEO,a.currentVariant_.video);return h.yield(a.playerInterface_.mediaSourceEngine.reset(g),2)}return h.return(!0)})};
|
|
1079
1085
|
shaka.media.StreamingEngine.prototype.updateSpatialVideoInfo_=function(a){if(this.spatialVideoInfo_.projection!=a.projection||this.spatialVideoInfo_.hfov!=a.hfov){var b=shaka.util.FakeEvent.EventName;if(null!=a.projection||null!=a.hfov){b=b.SpatialVideoInfoEvent;var c=(new Map).set("detail",a);b=new shaka.util.FakeEvent(b,c)}else b=new shaka.util.FakeEvent(b.NoSpatialVideoInfoEvent);b.cancelable=!0;this.playerInterface_.onEvent(b);this.spatialVideoInfo_=a}};
|
|
1086
|
+
shaka.media.StreamingEngine.prototype.updateSegmentIteratorReverse_=function(){var a=shaka.util.ManifestParserUtils.ContentType,b=0>this.playerInterface_.getPlaybackRate(),c=this.mediaStates_.get(a.VIDEO);c&&c.segmentIterator&&c.segmentIterator.setReverse(b);(c=this.mediaStates_.get(a.AUDIO))&&c.segmentIterator&&c.segmentIterator.setReverse(b);(a=this.mediaStates_.get(a.TEXT))&&a.segmentIterator&&a.segmentIterator.setReverse(b)};
|
|
1080
1087
|
shaka.media.StreamingEngine.logPrefix_=function(a){return"("+a.type+":"+a.stream.id+")"};shaka.media.StreamingEngine.APPEND_WINDOW_START_FUDGE_=.1;shaka.media.StreamingEngine.APPEND_WINDOW_END_FUDGE_=.01;shaka.media.StreamingEngine.MAX_RUN_AHEAD_SEGMENTS_=1;shaka.util.ConfigUtils=function(){};
|
|
1081
1088
|
shaka.util.ConfigUtils.mergeConfigObjects=function(a,b,c,d,e){goog.asserts.assert(a,"Destination config must not be null!");var f=e in d,g=!0,h;for(h in b){var k=e+"."+h,l=f?d[e]:c[h];f||h in c?void 0===b[h]?void 0===l||f?delete a[h]:a[h]=shaka.util.ObjectUtils.cloneObject(l):l.constructor==Object&&b[h]&&b[h].constructor==Object?(a[h]||(a[h]=shaka.util.ObjectUtils.cloneObject(l)),k=shaka.util.ConfigUtils.mergeConfigObjects(a[h],b[h],l,d,k),g=g&&k):typeof b[h]!=typeof l||null==b[h]||"function"!=typeof b[h]&&
|
|
1082
1089
|
b[h].constructor!=l.constructor?(shaka.log.alwaysError("Invalid config, wrong type for "+k),g=!1):("function"==typeof c[h]&&c[h].length!=b[h].length&&shaka.log.alwaysWarn("Unexpected number of arguments for "+k),a[h]=b[h]):(shaka.log.alwaysError("Invalid config, unrecognized key "+k),g=!1)}return g};
|
|
@@ -1097,9 +1104,9 @@ goog.exportProperty(shaka.util.FairPlayUtils,"verimatrixInitDataTransform",shaka
|
|
|
1097
1104
|
shaka.util.PlayerConfiguration.createDefault=function(){var a=Infinity;navigator.connection&&navigator.connection.saveData&&(a=360);var b={retryParameters:shaka.net.NetworkingEngine.defaultRetryParameters(),servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,persistentSessionOnlinePlayback:!1,persistentSessionsMetadata:[],initDataTransform:function(k,l,m){shaka.util.Platform.isMediaKeysPolyfilled()&&"skd"==l&&(l=m.serverCertificate,m=shaka.util.FairPlayUtils.defaultGetContentId(k),k=
|
|
1098
1105
|
shaka.util.FairPlayUtils.initDataTransform(k,m,l));return k},logLicenseExchange:!1,updateExpirationTime:1,preferredKeySystems:[],keySystemsMapping:{},parseInbandPsshEnabled:shaka.util.Platform.isXboxOne(),minHdcpVersion:"",ignoreDuplicateInitData:!shaka.util.Platform.isTizen2()};(shaka.util.Platform.isXboxOne()||shaka.util.Platform.isPS4())&&b.preferredKeySystems.push("com.microsoft.playready");var c=shaka.config.CodecSwitchingStrategy.RELOAD,d=!1;shaka.util.Platform.supportsSmoothCodecSwitching()&&
|
|
1099
1106
|
(c=shaka.config.CodecSwitchingStrategy.SMOOTH,d=!0);d={retryParameters:shaka.net.NetworkingEngine.defaultRetryParameters(),availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,disableThumbnails:!1,defaultPresentationDelay:0,segmentRelativeVttTiming:!1,raiseFatalErrorOnManifestUpdateRequestFailure:!1,dash:{clockSyncUri:"",ignoreDrmInfo:!1,disableXlinkProcessing:!1,xlinkFailGracefully:!1,ignoreMinBufferTime:!1,autoCorrectDrift:!0,initialSegmentLimit:1E3,ignoreSuggestedPresentationDelay:!1,
|
|
1100
|
-
ignoreEmptyAdaptationSet:!1,ignoreMaxSegmentDuration:!1,keySystemsByURI:{"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready"},manifestPreprocessor:
|
|
1101
|
-
|
|
1102
|
-
liveSegmentsDelay:3,sequenceMode:shaka.util.Platform.supportsSequenceMode(),ignoreManifestTimestampsInSegmentsMode:!1,disableCodecGuessing:!1,allowLowLatencyByteRangeOptimization:!0},mss:{manifestPreprocessor:
|
|
1107
|
+
ignoreEmptyAdaptationSet:!1,ignoreMaxSegmentDuration:!1,keySystemsByURI:{"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready"},manifestPreprocessor:shaka.util.PlayerConfiguration.defaultManifestPreprocessor,
|
|
1108
|
+
manifestPreprocessorTXml:shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml,sequenceMode:!1,enableAudioGroups:!1,multiTypeVariantsAllowed:d,useStreamOnceInPeriodFlattening:!1,updatePeriod:-1},hls:{ignoreTextStreamFailures:!1,ignoreImageStreamFailures:!1,defaultAudioCodec:"mp4a.40.2",defaultVideoCodec:"avc1.42E01E",ignoreManifestProgramDateTime:!1,ignoreManifestProgramDateTimeForTypes:[],mediaPlaylistFullMimeType:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"',useSafariBehaviorForLive:!0,
|
|
1109
|
+
liveSegmentsDelay:3,sequenceMode:shaka.util.Platform.supportsSequenceMode(),ignoreManifestTimestampsInSegmentsMode:!1,disableCodecGuessing:!1,allowLowLatencyByteRangeOptimization:!0},mss:{manifestPreprocessor:shaka.util.PlayerConfiguration.defaultManifestPreprocessor,manifestPreprocessorTXml:shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml,sequenceMode:!1,keySystemsBySystemId:{"9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready"}}};
|
|
1103
1110
|
var e={retryParameters:shaka.net.NetworkingEngine.defaultRetryParameters(),failureCallback:function(k){shaka.log.error("Unhandled streaming error",k);return shaka.util.ConfigUtils.referenceParametersAndReturn([k],void 0)},rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,evictionGoal:1,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,gapDetectionThreshold:.5,gapJumpTimerTime:.25,durationBackoff:1,safeSeekOffset:5,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsOnSafari:!0,
|
|
1104
1111
|
useNativeHlsForFairPlay:!0,inaccurateManifestTolerance:2,lowLatencyMode:!1,autoLowLatencyMode:!1,forceHTTPS:!1,preferNativeHls:!1,updateIntervalSeconds:1,dispatchAllEmsgBoxes:!1,observeQualityChanges:!1,maxDisabledTime:30,parsePrftBox:!1,segmentPrefetchLimit:0,prefetchAudioLanguages:[],disableAudioPrefetch:!1,disableTextPrefetch:!1,disableVideoPrefetch:!1,liveSync:!1,liveSyncMaxLatency:1,liveSyncPlaybackRate:1.1,liveSyncMinLatency:0,liveSyncMinPlaybackRate:1,liveSyncPanicMode:!1,liveSyncPanicThreshold:60,
|
|
1105
1112
|
allowMediaSourceRecoveries:!0,minTimeBetweenRecoveries:5,vodDynamicPlaybackRate:!1,vodDynamicPlaybackRateLowBufferRate:.95,vodDynamicPlaybackRateBufferRatio:.5,infiniteLiveStreamDuration:!1};if(shaka.util.Platform.isWebOS()||shaka.util.Platform.isTizen()||shaka.util.Platform.isChromecast()||shaka.util.Platform.isHisense())e.stallSkip=0;var f={trackSelectionCallback:function(k){return $jscomp.asyncExecutePromiseGeneratorProgram(function(l){return l.return(k)})},downloadSizeCallback:function(k){var l;
|
|
@@ -1112,7 +1119,8 @@ f.trackSelectionCallback=function(k){return $jscomp.asyncExecutePromiseGenerator
|
|
|
1112
1119
|
shaka.util.PlayerConfiguration.mergeConfigObjects=function(a,b,c){var d={".drm.keySystemsMapping":"",".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",sessionType:"",serverCertificate:new Uint8Array(0),serverCertificateUri:"",individualizationServer:""}};return shaka.util.ConfigUtils.mergeConfigObjects(a,b,c||shaka.util.PlayerConfiguration.createDefault(),d,"")};
|
|
1113
1120
|
shaka.util.PlayerConfiguration.defaultTrackSelect=function(a,b,c){var d=shaka.util.ManifestParserUtils.ContentType,e=shaka.util.LanguageUtils,f=c;"AUTO"==f&&(f=window.matchMedia("(color-gamut: p3)").matches?"PQ":"SDR");var g=a.filter(function(l){return"variant"!=l.type||l.hdr&&l.hdr!=f?!1:!0});c=[];var h=e.findClosestLocale(b,g.map(function(l){return l.language}));h&&(c=g.filter(function(l){return e.normalize(l.language)==h}));0==c.length&&(c=g.filter(function(l){return l.primary}));0==c.length&&
|
|
1114
1121
|
(1<(new Set(g.map(function(l){return l.language}))).size&&shaka.log.warning("Could not choose a good audio track based on language preferences or primary tracks. An arbitrary language will be stored!"),c=g);var k=c.filter(function(l){return l.height&&480>=l.height});k.length&&(k.sort(function(l,m){goog.asserts.assert(null!=l.height,"Null height");goog.asserts.assert(null!=m.height,"Null height");return m.height-l.height}),c=k.filter(function(l){return l.height==k[0].height}));b=[];c.length&&(g=Math.floor(c.length/
|
|
1115
|
-
2),c.sort(function(l,m){return l.bandwidth-m.bandwidth}),b.push(c[g]));a=$jscomp.makeIterator(a);for(c=a.next();!c.done;c=a.next())c=c.value,c.type!=d.TEXT&&c.type!=d.IMAGE||b.push(c);return b};
|
|
1122
|
+
2),c.sort(function(l,m){return l.bandwidth-m.bandwidth}),b.push(c[g]));a=$jscomp.makeIterator(a);for(c=a.next();!c.done;c=a.next())c=c.value,c.type!=d.TEXT&&c.type!=d.IMAGE||b.push(c);return b};shaka.util.PlayerConfiguration.defaultManifestPreprocessor=function(a){return shaka.util.ConfigUtils.referenceParametersAndReturn([a],a)};shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml=function(a){return shaka.util.ConfigUtils.referenceParametersAndReturn([a],a)};
|
|
1123
|
+
goog.exportSymbol("shaka.util.PlayerConfiguration",shaka.util.PlayerConfiguration);goog.exportProperty(shaka.util.PlayerConfiguration,"mergeConfigObjects",shaka.util.PlayerConfiguration.mergeConfigObjects);goog.exportProperty(shaka.util.PlayerConfiguration,"createDefault",shaka.util.PlayerConfiguration.createDefault);shaka.media.PreloadManager=function(a,b,c,d,e){shaka.util.FakeEventTarget.call(this);this.assetUri_=a;this.mimeType_=b;this.networkingEngine_=e.networkingEngine;this.startTime_=d;this.currentAdaptationSetCriteria_=null;this.startTimeOfLoad_=c;this.startTimeOfDrm_=0;this.createDrmEngine_=e.createDrmEngine;this.manifestFilterer_=e.manifestFilterer;this.manifestPlayerInterface_=e.manifestPlayerInterface;this.config_=e.config;this.parser_=this.parserFactory_=this.manifest_=null;this.parserEntrusted_=
|
|
1116
1124
|
!1;this.regionTimeline_=e.regionTimeline;this.regionTimelineEntrusted_=!1;this.drmEngine_=null;this.drmEngineEntrusted_=!1;this.abrManager_=this.abrManagerFactory_=null;this.abrManagerEntrusted_=!1;this.segmentPrefetchById_=new Map;this.segmentPrefetchEntrusted_=!1;this.qualityObserver_=e.qualityObserver;this.stats_=new shaka.util.Stats;this.manifestPromise_=new shaka.util.PublicPromise;this.drmPromise_=new shaka.util.PublicPromise;this.chooseInitialVariantPromise_=new shaka.util.PublicPromise;this.destroyPromise_=
|
|
1117
1125
|
new shaka.util.PublicPromise;this.destroyPromise_.catch(function(f){});this.eventHandoffTarget_=null;this.destroyed_=!1;this.allowPrefetch_=e.allowPrefetch;this.prefetchedVariant_=null;this.allowMakeAbrManager_=e.allowMakeAbrManager;this.hasBeenAttached_=!1;this.queuedOperations_=[];this.latePhaseQueuedOperations_=[]};$jscomp.inherits(shaka.media.PreloadManager,shaka.util.FakeEventTarget);
|
|
1118
1126
|
shaka.media.PreloadManager.prototype.addQueuedOperation=function(a,b){(a=a?this.latePhaseQueuedOperations_:this.queuedOperations_)?a.push(b):b()};shaka.media.PreloadManager.prototype.stopQueuingLatePhaseQueuedOperations=function(){if(this.latePhaseQueuedOperations_)for(var a=$jscomp.makeIterator(this.latePhaseQueuedOperations_),b=a.next();!b.done;b=a.next())b=b.value,b();this.latePhaseQueuedOperations_=null};
|
|
@@ -1155,8 +1163,8 @@ shaka.text.Utils.getColorName_=function(a){a=a.toLowerCase();var b=a.replace(/\s
|
|
|
1155
1163
|
case "yellow":case "#ff0":case "#ffff00":return"yellow";case "magenta":case "#f0f":case "#ff00ff":return"magenta";case "blue":case "#00f":case "#0000ff":return"blue";case "black":case "#000":case "#000000":return"black"}return null};
|
|
1156
1164
|
shaka.text.Utils.getCuesToFlatten=function(a,b){var c=[];a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())if(d=d.value,d.isContainer)c.push.apply(c,$jscomp.arrayFromIterable(shaka.text.Utils.getCuesToFlatten(d.nestedCues,d)));else{var e=d.clone();e.nestedCues=[];e.payload=shaka.text.Utils.flattenPayload_(d,b);c.push(e)}return c};shaka.text.SimpleTextDisplayer=function(a,b){this.textTrack_=null;for(var c=$jscomp.makeIterator(Array.from(a.textTracks)),d=c.next();!d.done;d=c.next())d=d.value,d.mode="disabled",d.label==b&&(this.textTrack_=d);this.textTrack_||(this.textTrack_=a.addTextTrack("subtitles",b));this.textTrack_.mode="hidden"};shaka.text.SimpleTextDisplayer.prototype.configure=function(a){};
|
|
1157
1165
|
shaka.text.SimpleTextDisplayer.prototype.remove=function(a,b){if(!this.textTrack_)return!1;shaka.text.SimpleTextDisplayer.removeWhere_(this.textTrack_,function(c){return c.startTime<b&&c.endTime>a});return!0};
|
|
1158
|
-
shaka.text.SimpleTextDisplayer.prototype.append=function(a){var b=shaka.text.Utils.getCuesToFlatten(a),c=[];a=this.textTrack_.cues?Array.from(this.textTrack_.cues):[];var d={};b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;d={$jscomp$loop$prop$inCue$
|
|
1159
|
-
!0:!1}}(d))||(e=shaka.text.SimpleTextDisplayer.convertToTextTrackCue_(d.$jscomp$loop$prop$inCue$
|
|
1166
|
+
shaka.text.SimpleTextDisplayer.prototype.append=function(a){var b=shaka.text.Utils.getCuesToFlatten(a),c=[];a=this.textTrack_.cues?Array.from(this.textTrack_.cues):[];var d={};b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;d={$jscomp$loop$prop$inCue$940:d.$jscomp$loop$prop$inCue$940},e=b.next())d.$jscomp$loop$prop$inCue$940=e.value,a.some(function(f){return function(g){return g.startTime==f.$jscomp$loop$prop$inCue$940.startTime&&g.endTime==f.$jscomp$loop$prop$inCue$940.endTime&&g.text==f.$jscomp$loop$prop$inCue$940.payload?
|
|
1167
|
+
!0:!1}}(d))||(e=shaka.text.SimpleTextDisplayer.convertToTextTrackCue_(d.$jscomp$loop$prop$inCue$940))&&c.push(e);a=c.slice().sort(function(f,g){return f.startTime!=g.startTime?f.startTime-g.startTime:f.endTime!=g.endTime?f.endTime-g.startTime:"line"in VTTCue.prototype?c.indexOf(g)-c.indexOf(f):c.indexOf(f)-c.indexOf(g)});a=$jscomp.makeIterator(a);for(d=a.next();!d.done;d=a.next())this.textTrack_.addCue(d.value)};
|
|
1160
1168
|
shaka.text.SimpleTextDisplayer.prototype.destroy=function(){this.textTrack_&&(shaka.text.SimpleTextDisplayer.removeWhere_(this.textTrack_,function(a){return!0}),this.textTrack_.mode="disabled");this.textTrack_=null;return Promise.resolve()};shaka.text.SimpleTextDisplayer.prototype.isTextVisible=function(){return"showing"==this.textTrack_.mode};shaka.text.SimpleTextDisplayer.prototype.setTextVisibility=function(a){this.textTrack_.mode=a?"showing":"hidden"};
|
|
1161
1169
|
shaka.text.SimpleTextDisplayer.convertToTextTrackCue_=function(a){if(a.startTime>=a.endTime)return shaka.log.warning("Invalid cue times: "+a.startTime+" - "+a.endTime),null;var b=shaka.text.Cue,c=new VTTCue(a.startTime,a.endTime,a.payload);c.lineAlign=a.lineAlign;c.positionAlign=a.positionAlign;a.size&&(c.size=a.size);try{c.align=a.textAlign}catch(d){}"center"==a.textAlign&&"center"!=c.align&&(c.align="middle");a.writingMode==b.writingMode.VERTICAL_LEFT_TO_RIGHT?c.vertical="lr":a.writingMode==b.writingMode.VERTICAL_RIGHT_TO_LEFT&&
|
|
1162
1170
|
(c.vertical="rl");a.lineInterpretation==b.lineInterpretation.PERCENTAGE&&(c.snapToLines=!1);null!=a.line&&(c.line=a.line);null!=a.position&&(c.position=a.position);return c};shaka.text.SimpleTextDisplayer.removeWhere_=function(a,b){var c=a.mode,d="showing"==c?"showing":"hidden";a.mode=d;goog.asserts.assert(a.cues,'Cues should be accessible when mode is set to "'+d+'".');d=$jscomp.makeIterator(Array.from(a.cues));for(var e=d.next();!e.done;e=d.next())(e=e.value)&&b(e)&&a.removeCue(e);a.mode=c};
|
|
@@ -1165,9 +1173,10 @@ goog.exportProperty(shaka.text.SimpleTextDisplayer.prototype,"append",shaka.text
|
|
|
1165
1173
|
goog.exportProperty(shaka.text.StubTextDisplayer.prototype,"setTextVisibility",shaka.text.StubTextDisplayer.prototype.setTextVisibility);goog.exportProperty(shaka.text.StubTextDisplayer.prototype,"isTextVisible",shaka.text.StubTextDisplayer.prototype.isTextVisible);goog.exportProperty(shaka.text.StubTextDisplayer.prototype,"destroy",shaka.text.StubTextDisplayer.prototype.destroy);goog.exportProperty(shaka.text.StubTextDisplayer.prototype,"append",shaka.text.StubTextDisplayer.prototype.append);
|
|
1166
1174
|
goog.exportProperty(shaka.text.StubTextDisplayer.prototype,"remove",shaka.text.StubTextDisplayer.prototype.remove);goog.exportProperty(shaka.text.StubTextDisplayer.prototype,"configure",shaka.text.StubTextDisplayer.prototype.configure);shaka.util.Dom=function(){};shaka.util.Dom.createHTMLElement=function(a){return document.createElement(a)};shaka.util.Dom.createButton=function(){var a=document.createElement("button");a.setAttribute("type","button");return a};shaka.util.Dom.asHTMLElement=function(a){return a};shaka.util.Dom.asHTMLCanvasElement=function(a){return a};shaka.util.Dom.asHTMLMediaElement=function(a){return a};
|
|
1167
1175
|
shaka.util.Dom.getElementByClassName=function(a,b){b=b.getElementsByClassName(a);goog.asserts.assert(1==b.length,"Should only be one element with class name "+a);return shaka.util.Dom.asHTMLElement(b[0])};shaka.util.Dom.removeAllChildren=function(a){for(;a.firstChild;)a.removeChild(a.firstChild)};goog.exportSymbol("shaka.util.Dom",shaka.util.Dom);goog.exportProperty(shaka.util.Dom,"removeAllChildren",shaka.util.Dom.removeAllChildren);shaka.text.UITextDisplayer=function(a,b,c){var d=this;goog.asserts.assert(b,"videoContainer should be valid.");this.isTextVisible_=!1;this.cues_=[];this.video_=a;this.videoContainer_=b;this.aspectRatio_=null;this.textContainer_=shaka.util.Dom.createHTMLElement("div");this.textContainer_.classList.add("shaka-text-container");this.textContainer_.style.textAlign="center";this.textContainer_.style.display="flex";this.textContainer_.style.flexDirection="column";this.textContainer_.style.alignItems="center";
|
|
1168
|
-
this.textContainer_.style.justifyContent="flex-end";this.videoContainer_.appendChild(this.textContainer_);this.captionsTimer_=(new shaka.util.Timer(function(){d.video_.paused||d.updateCaptions_()})).tickEvery(
|
|
1169
|
-
"resize",function(){var e=d.video_,f=e.videoWidth;e=e.videoHeight;d.aspectRatio_=f&&e?f/e:null});this.resizeObserver_=null;"ResizeObserver"in window&&(this.resizeObserver_=new ResizeObserver(function(){d.updateCaptions_(!0)}),this.resizeObserver_.observe(this.textContainer_));this.regionElements_=new Map};
|
|
1170
|
-
shaka.text.UITextDisplayer.prototype.
|
|
1176
|
+
this.textContainer_.style.justifyContent="flex-end";this.videoContainer_.appendChild(this.textContainer_);c&&c.captionsUpdatePeriod||shaka.Deprecate.deprecateFeature(5,"UITextDisplayer w/ config","Please migrate to initializing UITextDisplayer with a config.");a=c&&c.captionsUpdatePeriod?c.captionsUpdatePeriod:.25;this.captionsTimer_=(new shaka.util.Timer(function(){d.video_.paused||d.updateCaptions_()})).tickEvery(a);this.currentCuesMap_=new Map;this.eventManager_=new shaka.util.EventManager;this.eventManager_.listen(document,
|
|
1177
|
+
"fullscreenchange",function(){d.updateCaptions_(!0)});this.eventManager_.listen(this.video_,"seeking",function(){d.updateCaptions_(!0)});this.eventManager_.listen(this.video_,"resize",function(){var e=d.video_,f=e.videoWidth;e=e.videoHeight;d.aspectRatio_=f&&e?f/e:null});this.resizeObserver_=null;"ResizeObserver"in window&&(this.resizeObserver_=new ResizeObserver(function(){d.updateCaptions_(!0)}),this.resizeObserver_.observe(this.textContainer_));this.regionElements_=new Map};
|
|
1178
|
+
shaka.text.UITextDisplayer.prototype.configure=function(a){this.captionsTimer_&&this.captionsTimer_.tickEvery(a.captionsUpdatePeriod)};
|
|
1179
|
+
shaka.text.UITextDisplayer.prototype.append=function(a){var b=[].concat($jscomp.arrayFromIterable(this.cues_)),c={};a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;c={$jscomp$loop$prop$cue$942:c.$jscomp$loop$prop$cue$942},d=a.next())c.$jscomp$loop$prop$cue$942=d.value,b.some(function(e){return function(f){return shaka.text.Cue.equal(f,e.$jscomp$loop$prop$cue$942)}}(c))||this.cues_.push(c.$jscomp$loop$prop$cue$942);this.updateCaptions_()};
|
|
1171
1180
|
shaka.text.UITextDisplayer.prototype.destroy=function(){if(!this.textContainer_)return Promise.resolve();this.videoContainer_.removeChild(this.textContainer_);this.textContainer_=null;this.isTextVisible_=!1;this.cues_=[];this.captionsTimer_&&this.captionsTimer_.stop();this.currentCuesMap_.clear();this.eventManager_&&(this.eventManager_.release(),this.eventManager_=null);this.resizeObserver_&&(this.resizeObserver_.disconnect(),this.resizeObserver_=null);return Promise.resolve()};
|
|
1172
1181
|
shaka.text.UITextDisplayer.prototype.remove=function(a,b){if(!this.textContainer_)return!1;var c=this.cues_.length;this.cues_=this.cues_.filter(function(d){return d.startTime<a||d.endTime>=b});this.updateCaptions_(c>this.cues_.length);return!0};shaka.text.UITextDisplayer.prototype.isTextVisible=function(){return this.isTextVisible_};shaka.text.UITextDisplayer.prototype.setTextVisibility=function(a){this.isTextVisible_=a};
|
|
1173
1182
|
shaka.text.UITextDisplayer.prototype.isElementUnderTextContainer_=function(a){for(;null!=a;){if(a==this.textContainer_)return!0;a=a.parentElement}return!1};
|
|
@@ -1199,8 +1208,8 @@ shaka.text.WebVttGenerator.convert=function(a,b){var c=function(f){for(var g=f,h
|
|
|
1199
1208
|
g.join(" "):""}(e)+"\n",a+=e.payload+"\n\n";return a};goog.exportSymbol("shaka.text.WebVttGenerator",shaka.text.WebVttGenerator);shaka.util.CmcdManager=function(a,b){this.playerInterface_=a;this.config_=b;this.sf_=void 0;this.playbackStarted_=!1;this.buffering_=!0;this.starved_=!1};shaka.util.CmcdManager.prototype.configure=function(a){this.config_=a};shaka.util.CmcdManager.prototype.setBuffering=function(a){a||this.playbackStarted_||(this.playbackStarted_=!0);this.playbackStarted_&&a&&(this.starved_=!0);this.buffering_=a};
|
|
1200
1209
|
shaka.util.CmcdManager.prototype.applyData=function(a,b,c){c=void 0===c?{}:c;if(this.config_.enabled)if("HEAD"===b.method)this.apply_(b);else{var d=shaka.net.NetworkingEngine.RequestType,e=shaka.util.CmcdManager.ObjectType;switch(a){case d.MANIFEST:this.applyManifestData(b,c);break;case d.SEGMENT:this.applySegmentData(b,c);break;case d.LICENSE:case d.SERVER_CERTIFICATE:case d.KEY:this.apply_(b,{ot:e.KEY});break;case d.TIMING:this.apply_(b,{ot:e.OTHER})}}};
|
|
1201
1210
|
shaka.util.CmcdManager.prototype.applyManifestData=function(a,b){try{this.config_.enabled&&(b.type&&(this.sf_=this.getStreamFormat_(b.type)),this.apply_(a,{ot:shaka.util.CmcdManager.ObjectType.MANIFEST,su:!this.playbackStarted_}))}catch(c){shaka.log.warnOnce("CMCD_MANIFEST_ERROR","Could not generate manifest CMCD data.",c)}};
|
|
1202
|
-
shaka.util.CmcdManager.prototype.applySegmentData=function(a,b){try{if(this.config_.enabled){var c=b.segment,d=0;c&&(d=c.endTime-c.startTime);var e={d:1E3*d,st:this.getStreamType_()};e.ot=this.getObjectType_(b);var f=shaka.util.CmcdManager.ObjectType,g=e.ot===f.VIDEO||e.ot===f.AUDIO||e.ot===f.MUXED||e.ot===f.TIMED_TEXT,h=b.stream;if(h){if(g&&(e.bl=this.getBufferLength_(h.type),e.ot!==f.TIMED_TEXT)){var
|
|
1203
|
-
k}h.bandwidth&&(e.br=h.bandwidth/1E3);if(h.segmentIndex&&c){var m=h.segmentIndex.getIteratorForTime(c.endTime,!0);if(m){var n=m.next().value;if(n&&n!=c&&(shaka.util.ArrayUtils.equal(c.getUris(),n.getUris())||(e.nor=this.urlToRelativePath_(n.getUris()[0],a.uris[0])),(n.startByte||n.endByte)&&(c.startByte!=n.startByte||c.endByte!=n.endByte))){var p=n.startByte+"-";n.endByte&&(p+=n.endByte);e.nrr=p}}var q=this.calculateRtp_(h,c);isNaN(q)||(e.rtp=q)}}g&&e.ot!==f.TIMED_TEXT&&(e.tb=this.getTopBandwidth_(e.ot)/
|
|
1211
|
+
shaka.util.CmcdManager.prototype.applySegmentData=function(a,b){try{if(this.config_.enabled){var c=b.segment,d=0;c&&(d=c.endTime-c.startTime);var e={d:1E3*d,st:this.getStreamType_()};e.ot=this.getObjectType_(b);var f=shaka.util.CmcdManager.ObjectType,g=e.ot===f.VIDEO||e.ot===f.AUDIO||e.ot===f.MUXED||e.ot===f.TIMED_TEXT,h=b.stream;if(h){var k=this.playerInterface_.getPlaybackRate();if(g&&(e.bl=this.getBufferLength_(h.type),e.ot!==f.TIMED_TEXT)){var l=this.getRemainingBufferLength_(h.type);e.dl=k?l/
|
|
1212
|
+
Math.abs(k):l}h.bandwidth&&(e.br=h.bandwidth/1E3);if(h.segmentIndex&&c){var m=h.segmentIndex.getIteratorForTime(c.endTime,!0,0>k);if(m){var n=m.next().value;if(n&&n!=c&&(shaka.util.ArrayUtils.equal(c.getUris(),n.getUris())||(e.nor=this.urlToRelativePath_(n.getUris()[0],a.uris[0])),(n.startByte||n.endByte)&&(c.startByte!=n.startByte||c.endByte!=n.endByte))){var p=n.startByte+"-";n.endByte&&(p+=n.endByte);e.nrr=p}}var q=this.calculateRtp_(h,c);isNaN(q)||(e.rtp=q)}}g&&e.ot!==f.TIMED_TEXT&&(e.tb=this.getTopBandwidth_(e.ot)/
|
|
1204
1213
|
1E3);this.apply_(a,e)}}catch(r){shaka.log.warnOnce("CMCD_SEGMENT_ERROR","Could not generate segment CMCD data.",r)}};shaka.util.CmcdManager.prototype.applyTextData=function(a){try{this.config_.enabled&&this.apply_(a,{ot:shaka.util.CmcdManager.ObjectType.CAPTION,su:!0})}catch(b){shaka.log.warnOnce("CMCD_TEXT_ERROR","Could not generate text CMCD data.",b)}};
|
|
1205
1214
|
shaka.util.CmcdManager.prototype.appendSrcData=function(a,b){try{if(!this.config_.enabled)return a;var c=this.createData_();c.ot=this.getObjectTypeFromMimeType_(b);c.su=!0;var d=shaka.util.CmcdManager.toQuery(c);return shaka.util.CmcdManager.appendQueryToUri(a,d)}catch(e){return shaka.log.warnOnce("CMCD_SRC_ERROR","Could not generate src CMCD data.",e),a}};
|
|
1206
1215
|
shaka.util.CmcdManager.prototype.appendTextTrackData=function(a){try{if(!this.config_.enabled)return a;var b=this.createData_();b.ot=shaka.util.CmcdManager.ObjectType.CAPTION;b.su=!0;var c=shaka.util.CmcdManager.toQuery(b);return shaka.util.CmcdManager.appendQueryToUri(a,c)}catch(d){return shaka.log.warnOnce("CMCD_TEXT_TRACK_ERROR","Could not generate text track CMCD data.",d),a}};
|
|
@@ -1320,9 +1329,9 @@ shaka.Player.prototype.pollBufferState_=function(){goog.asserts.assert(this.vide
|
|
|
1320
1329
|
this.bufferObserver_.update(b,a)&&this.updateBufferState_()};shaka.Player.prototype.createMediaSourceEngine=function(a,b,c,d){return new shaka.media.MediaSourceEngine(a,b,c,d)};
|
|
1321
1330
|
shaka.Player.prototype.createCmcd_=function(){var a=this;return new shaka.util.CmcdManager({getBandwidthEstimate:function(){return a.abrManager_?a.abrManager_.getBandwidthEstimate():NaN},getBufferedInfo:function(){return a.getBufferedInfo()},getCurrentTime:function(){return a.video_?a.video_.currentTime:0},getPlaybackRate:function(){return a.getPlaybackRate()},getNetworkingEngine:function(){return a.getNetworkingEngine()},getVariantTracks:function(){return a.getVariantTracks()},isLive:function(){return a.isLive()}},
|
|
1322
1331
|
this.config_.cmcd)};shaka.Player.prototype.createCmsd_=function(){return new shaka.util.CmsdManager(this.config_.cmsd)};
|
|
1323
|
-
shaka.Player.prototype.createStreamingEngine=function(){var a=this;goog.asserts.assert(this.abrManager_&&this.mediaSourceEngine_&&this.manifest_,"Must not be destroyed");return new shaka.media.StreamingEngine(this.manifest_,{getPresentationTime:function(){return a.playhead_?a.playhead_.getTime():0},getBandwidthEstimate:function(){return a.abrManager_.getBandwidthEstimate()},
|
|
1324
|
-
onManifestUpdate:function(){return a.onManifestUpdate_()},onSegmentAppended:function(b,c){a.onSegmentAppended_(b.startTime,b.endTime,c.type);a.abrManager_&&c.fastSwitching&&b.isPartial()&&b.isLastPartial()&&a.abrManager_.trySuggestStreams()},onInitSegmentAppended:function(b,c){(c=c.getMediaQuality())&&a.qualityObserver_&&a.qualityObserver_.addMediaQualityChange(c,b)},beforeAppendSegment:function(b,c){return a.drmEngine_.parseInbandPssh(b,
|
|
1325
|
-
c,d)},disableStream:function(b,c){return a.disableStream(b,c)}})};
|
|
1332
|
+
shaka.Player.prototype.createStreamingEngine=function(){var a=this;goog.asserts.assert(this.abrManager_&&this.mediaSourceEngine_&&this.manifest_,"Must not be destroyed");return new shaka.media.StreamingEngine(this.manifest_,{getPresentationTime:function(){return a.playhead_?a.playhead_.getTime():0},getBandwidthEstimate:function(){return a.abrManager_.getBandwidthEstimate()},getPlaybackRate:function(){return a.getPlaybackRate()},mediaSourceEngine:this.mediaSourceEngine_,netEngine:this.networkingEngine_,
|
|
1333
|
+
onError:function(b){return a.onError_(b)},onEvent:function(b){return a.dispatchEvent(b)},onManifestUpdate:function(){return a.onManifestUpdate_()},onSegmentAppended:function(b,c){a.onSegmentAppended_(b.startTime,b.endTime,c.type);a.abrManager_&&c.fastSwitching&&b.isPartial()&&b.isLastPartial()&&a.abrManager_.trySuggestStreams()},onInitSegmentAppended:function(b,c){(c=c.getMediaQuality())&&a.qualityObserver_&&a.qualityObserver_.addMediaQualityChange(c,b)},beforeAppendSegment:function(b,c){return a.drmEngine_.parseInbandPssh(b,
|
|
1334
|
+
c)},onMetadata:function(b,c,d){a.processTimedMetadataMediaSrc_(b,c,d)},disableStream:function(b,c){return a.disableStream(b,c)}})};
|
|
1326
1335
|
shaka.Player.prototype.configure=function(a,b){goog.asserts.assert(this.config_,"Config must not be null!");goog.asserts.assert("object"==typeof a||2==arguments.length,"String configs should have values!");2==arguments.length&&"string"==typeof a&&(a=shaka.util.ConfigUtils.convertToConfigObject(a,b));goog.asserts.assert("object"==typeof a,"Should be an object!");a.streaming&&"forceTransmuxTS"in a.streaming&&(shaka.Deprecate.deprecateFeature(5,"streaming.forceTransmuxTS configuration","Please Use mediaSource.forceTransmux instead."),
|
|
1327
1336
|
a.mediaSource.mediaSource=a.streaming.forceTransmuxTS,delete a.streaming.forceTransmuxTS);a.streaming&&"forceTransmux"in a.streaming&&(shaka.Deprecate.deprecateFeature(5,"streaming.forceTransmux configuration","Please Use mediaSource.forceTransmux instead."),a.mediaSource.mediaSource=a.streaming.forceTransmux,delete a.streaming.forceTransmux);a.streaming&&"useNativeHlsOnSafari"in a.streaming&&shaka.Deprecate.deprecateFeature(5,"streaming.useNativeHlsOnSafari configuration","Please Use streaming.useNativeHlsForFairPlay or streaming.preferNativeHls instead.");
|
|
1328
1337
|
if(a.mediaSource&&"sourceBufferExtraFeatures"in a.mediaSource){shaka.Deprecate.deprecateFeature(5,"mediaSource.sourceBufferExtraFeatures configuration","Please Use mediaSource.addExtraFeaturesToSourceBuffer() instead.");var c=a.mediaSource.sourceBufferExtraFeatures;a.mediaSource.addExtraFeaturesToSourceBuffer=function(){return c};delete a.mediaSource.sourceBufferExtraFeatures}a.streaming&&a.streaming.lowLatencyMode&&(void 0==a.streaming.inaccurateManifestTolerance&&(a.streaming.inaccurateManifestTolerance=
|
|
@@ -1391,8 +1400,8 @@ createSegmentIndex:function(){return Promise.resolve()},segmentIndex:shaka.media
|
|
|
1391
1400
|
shaka.Player.prototype.addThumbnailsTrack=function(a,b){var c=this,d,e,f,g,h,k,l,m,n,p,q,r,v,x,w,t;return $jscomp.asyncExecutePromiseGeneratorProgram(function(y){switch(y.nextAddress){case 1:if(c.loadMode_!=shaka.Player.LoadMode.MEDIA_SOURCE&&c.loadMode_!=shaka.Player.LoadMode.SRC_EQUALS)throw shaka.log.error("Must call load() and wait for it to resolve before adding image tracks."),new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,shaka.util.Error.Category.PLAYER,shaka.util.Error.Code.CONTENT_NOT_LOADED);
|
|
1392
1401
|
if(b){y.jumpTo(2);break}return y.yield(c.getTextMimetype_(a),3);case 3:b=y.yieldResult;case 2:if("text/vtt"!=b)throw new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,shaka.util.Error.Category.TEXT,shaka.util.Error.Code.UNSUPPORTED_EXTERNAL_THUMBNAILS_URI,a);d=shaka.util.ManifestParserUtils.ContentType;e=c.video_.duration;c.manifest_&&(e=c.manifest_.presentationTimeline.getDuration());if(Infinity==e)throw new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,shaka.util.Error.Category.MANIFEST,
|
|
1393
1402
|
shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM);goog.asserts.assert(c.networkingEngine_,"Need networking engine.");return y.yield(c.getTextData_(a,c.networkingEngine_,c.config_.streaming.retryParameters),4);case 4:f=y.yieldResult;g=shaka.text.TextEngine.findParser(b);if(!g)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.TEXT,shaka.util.Error.Code.MISSING_TEXT_PLUGIN,b);h=g();k={periodStart:0,segmentStart:0,segmentEnd:e,vttOffset:0};l=shaka.util.BufferUtils.toUint8(f);
|
|
1394
|
-
m=h.parseMedia(l,k,a);n=[];p={};q=$jscomp.makeIterator(m);for(r=q.next();!r.done;p={$jscomp$loop$prop$uris$
|
|
1395
|
-
x=new shaka.media.SegmentReference(p.$jscomp$loop$prop$cue$
|
|
1403
|
+
m=h.parseMedia(l,k,a);n=[];p={};q=$jscomp.makeIterator(m);for(r=q.next();!r.done;p={$jscomp$loop$prop$uris$944:p.$jscomp$loop$prop$uris$944,$jscomp$loop$prop$cue$945:p.$jscomp$loop$prop$cue$945},r=q.next())p.$jscomp$loop$prop$cue$945=r.value,p.$jscomp$loop$prop$uris$944=null,v=function(u){return function(){null==u.$jscomp$loop$prop$uris$944&&(u.$jscomp$loop$prop$uris$944=shaka.util.ManifestParserUtils.resolveUris([a],[u.$jscomp$loop$prop$cue$945.payload]));return u.$jscomp$loop$prop$uris$944||[]}}(p),
|
|
1404
|
+
x=new shaka.media.SegmentReference(p.$jscomp$loop$prop$cue$945.startTime,p.$jscomp$loop$prop$cue$945.endTime,v,0,null,null,0,0,Infinity),p.$jscomp$loop$prop$cue$945.payload.includes("#xywh")&&(w=p.$jscomp$loop$prop$cue$945.payload.split("#xywh=")[1].split(","),4===w.length&&x.setThumbnailSprite({height:parseInt(w[3],10),positionX:parseInt(w[0],10),positionY:parseInt(w[1],10),width:parseInt(w[2],10)})),n.push(x);t={id:c.nextExternalStreamId_++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},
|
|
1396
1405
|
segmentIndex:new shaka.media.SegmentIndex(n),mimeType:b||"",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:d.IMAGE,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,tilesLayout:"1x1",accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([shaka.util.MimeUtils.getFullType(b||"","")])};c.loadMode_==shaka.Player.LoadMode.SRC_EQUALS?
|
|
1397
1406
|
c.externalSrcEqualsThumbnailsStreams_.push(t):c.manifest_.imageStreams.push(t);c.onTracksChanged_();return y.return(shaka.util.StreamUtils.imageStreamToTrack(t))}})};
|
|
1398
1407
|
shaka.Player.prototype.addChaptersTrack=function(a,b,c){var d=this,e,f,g,h;return $jscomp.asyncExecutePromiseGeneratorProgram(function(k){switch(k.nextAddress){case 1:if(d.loadMode_!=shaka.Player.LoadMode.MEDIA_SOURCE&&d.loadMode_!=shaka.Player.LoadMode.SRC_EQUALS)throw shaka.log.error("Must call load() and wait for it to resolve before adding chapters tracks."),new shaka.util.Error(shaka.util.Error.Severity.RECOVERABLE,shaka.util.Error.Category.PLAYER,shaka.util.Error.Code.CONTENT_NOT_LOADED);if(c){k.jumpTo(2);
|
|
@@ -1472,7 +1481,7 @@ goog.exportProperty(shaka.Player.prototype,"getAssetUri",shaka.Player.prototype.
|
|
|
1472
1481
|
goog.exportProperty(shaka.Player.prototype,"resetConfiguration",shaka.Player.prototype.resetConfiguration);goog.exportProperty(shaka.Player.prototype,"getBufferFullness",shaka.Player.prototype.getBufferFullness);goog.exportProperty(shaka.Player.prototype,"getConfiguration",shaka.Player.prototype.getConfiguration);goog.exportProperty(shaka.Player.prototype,"configure",shaka.Player.prototype.configure);goog.exportProperty(shaka.Player.prototype,"releaseAllMutexes",shaka.Player.prototype.releaseAllMutexes);
|
|
1473
1482
|
goog.exportProperty(shaka.Player.prototype,"preload",shaka.Player.prototype.preload);goog.exportProperty(shaka.Player.prototype,"unloadAndSavePreload",shaka.Player.prototype.unloadAndSavePreload);goog.exportProperty(shaka.Player.prototype,"load",shaka.Player.prototype.load);goog.exportProperty(shaka.Player.prototype,"updateStartTime",shaka.Player.prototype.updateStartTime);goog.exportProperty(shaka.Player.prototype,"unload",shaka.Player.prototype.unload);
|
|
1474
1483
|
goog.exportProperty(shaka.Player.prototype,"detach",shaka.Player.prototype.detach);goog.exportProperty(shaka.Player.prototype,"attachCanvas",shaka.Player.prototype.attachCanvas);goog.exportProperty(shaka.Player.prototype,"attach",shaka.Player.prototype.attach);goog.exportProperty(shaka.Player,"probeSupport",shaka.Player.probeSupport);goog.exportProperty(shaka.Player,"isBrowserSupported",shaka.Player.isBrowserSupported);goog.exportProperty(shaka.Player,"setAdManagerFactory",shaka.Player.setAdManagerFactory);
|
|
1475
|
-
goog.exportProperty(shaka.Player,"registerSupportPlugin",shaka.Player.registerSupportPlugin);goog.exportProperty(shaka.Player.prototype,"destroy",shaka.Player.prototype.destroy);shaka.Player.LoadMode={DESTROYED:0,NOT_LOADED:1,MEDIA_SOURCE:2,SRC_EQUALS:3};goog.exportProperty(shaka.Player,"LoadMode",shaka.Player.LoadMode);shaka.Player.TYPICAL_BUFFERING_THRESHOLD_=.5;shaka.Player.version="v4.8.
|
|
1484
|
+
goog.exportProperty(shaka.Player,"registerSupportPlugin",shaka.Player.registerSupportPlugin);goog.exportProperty(shaka.Player.prototype,"destroy",shaka.Player.prototype.destroy);shaka.Player.LoadMode={DESTROYED:0,NOT_LOADED:1,MEDIA_SOURCE:2,SRC_EQUALS:3};goog.exportProperty(shaka.Player,"LoadMode",shaka.Player.LoadMode);shaka.Player.TYPICAL_BUFFERING_THRESHOLD_=.5;shaka.Player.version="v4.8.2-debug";goog.exportProperty(shaka.Player,"version",shaka.Player.version);shaka.Deprecate.init(shaka.Player.version);
|
|
1476
1485
|
shaka.Player.supportPlugins_={};shaka.Player.adManagerFactory_=null;shaka.Player.TextTrackLabel="Shaka Player TextTrack";shaka.ads={};shaka.ads.AdsStats=function(){this.loadTimes_=[];this.skipped_=this.playedCompletely_=this.started_=0};shaka.ads.AdsStats.prototype.addLoadTime=function(a){this.loadTimes_.push(a)};shaka.ads.AdsStats.prototype.incrementStarted=function(){this.started_++};shaka.ads.AdsStats.prototype.incrementPlayedCompletely=function(){this.playedCompletely_++};shaka.ads.AdsStats.prototype.incrementSkipped=function(){this.skipped_++};
|
|
1477
1486
|
shaka.ads.AdsStats.prototype.getBlob=function(){return{loadTimes:this.loadTimes_,started:this.started_,playedCompletely:this.playedCompletely_,skipped:this.skipped_}};shaka.ads.ClientSideAd=function(a,b,c){var d=this;this.ad_=a;this.manager_=b;this.video_=c;this.isPaused_=!1;this.volume_=this.manager_.getVolume();this.eventManager_=new shaka.util.EventManager;this.eventManager_.listen(this.manager_,google.ima.AdEvent.Type.PAUSED,function(){d.isPaused_=!0});this.eventManager_.listen(this.manager_,google.ima.AdEvent.Type.RESUMED,function(){d.isPaused_=!1})};shaka.ads.ClientSideAd.prototype.getDuration=function(){return this.ad_.getDuration()};
|
|
1478
1487
|
shaka.ads.ClientSideAd.prototype.getMinSuggestedDuration=function(){return this.ad_.getMinSuggestedDuration()};shaka.ads.ClientSideAd.prototype.getRemainingTime=function(){return this.manager_.getRemainingTime()};shaka.ads.ClientSideAd.prototype.isPaused=function(){return this.isPaused_};shaka.ads.ClientSideAd.prototype.isSkippable=function(){return 0<=this.ad_.getSkipTimeOffset()};
|
|
@@ -1656,7 +1665,7 @@ shaka.cast.CastProxy.prototype.cast=function(){var a=this;return $jscomp.asyncEx
|
|
|
1656
1665
|
shaka.cast.CastProxy.prototype.changeReceiverId=function(a,b){b=void 0===b?!1:b;var c=this;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){if(1==d.nextAddress){if(a==c.receiverAppId_&&b==c.androidReceiverCompatible_)return d.return();c.receiverAppId_=a;c.androidReceiverCompatible_=b;c.sender_.forceDisconnect();return d.yield(c.sender_.destroy(),2)}c.sender_=null;c.sender_=new shaka.cast.CastSender(a,function(){return c.onCastStatusChanged_()},function(){return c.onFirstCastStateUpdate_()},
|
|
1657
1666
|
function(e,f){return c.onRemoteEvent_(e,f)},function(){return c.onResumeLocal_()},function(){return c.getInitState_()},b);c.sender_.init();d.jumpToEnd()})};
|
|
1658
1667
|
shaka.cast.CastProxy.prototype.init_=function(){var a=this;this.sender_.init();this.eventManager_=new shaka.util.EventManager;for(var b=$jscomp.makeIterator(shaka.cast.CastUtils.VideoEvents),c=b.next();!c.done;c=b.next())this.eventManager_.listen(this.localVideo_,c.value,function(f){return a.videoProxyLocalEvent_(f)});for(var d in shaka.util.FakeEvent.EventName)this.eventManager_.listen(this.localPlayer_,shaka.util.FakeEvent.EventName[d],function(f){return a.playerProxyLocalEvent_(f)});this.videoProxy_=
|
|
1659
|
-
{};b={};for(var e in this.localVideo_)b.$jscomp$loop$prop$k$
|
|
1668
|
+
{};b={};for(var e in this.localVideo_)b.$jscomp$loop$prop$k$948=e,Object.defineProperty(this.videoProxy_,b.$jscomp$loop$prop$k$948,{configurable:!1,enumerable:!0,get:function(f){return function(){return a.videoProxyGet_(f.$jscomp$loop$prop$k$948)}}(b),set:function(f){return function(g){a.videoProxySet_(f.$jscomp$loop$prop$k$948,g)}}(b)}),b={$jscomp$loop$prop$k$948:b.$jscomp$loop$prop$k$948};this.playerProxy_={};this.iterateOverPlayerMethods_(function(f,g){goog.asserts.assert(a.playerProxy_,"Must have player proxy!");
|
|
1660
1669
|
Object.defineProperty(a.playerProxy_,f,{configurable:!1,enumerable:!0,get:function(){return a.playerProxyGet_(f)}})});COMPILED&&this.mapCompiledToUncompiledPlayerMethodNames_();this.videoEventTarget_=new shaka.util.FakeEventTarget;this.videoEventTarget_.dispatchTarget=this.videoProxy_;this.playerEventTarget_=new shaka.util.FakeEventTarget;this.playerEventTarget_.dispatchTarget=this.playerProxy_};
|
|
1661
1670
|
shaka.cast.CastProxy.prototype.mapCompiledToUncompiledPlayerMethodNames_=function(){var a=this,b=new Map;this.iterateOverPlayerMethods_(function(c,d){b.has(d)?(d=b.get(d),c.length<d.length?a.compiledToExternNames_.set(c,d):a.compiledToExternNames_.set(d,c)):b.set(d,c)})};
|
|
1662
1671
|
shaka.cast.CastProxy.prototype.iterateOverPlayerMethods_=function(a){function b(k){return"constructor"==k||"function"!=typeof c[k]?!1:!d.has(k)}goog.asserts.assert(this.localPlayer_,"Must have player!");var c=this.localPlayer_,d=new Set;for(e in c)b(e)&&(d.add(e),a(e,c[e]));var e=Object.getPrototypeOf(c);for(var f=Object.getPrototypeOf({});e&&e!=f;){for(var g=$jscomp.makeIterator(Object.getOwnPropertyNames(e)),h=g.next();!h.done;h=g.next())h=h.value,b(h)&&(d.add(h),a(h,c[h]));e=Object.getPrototypeOf(e)}};
|
|
@@ -1826,15 +1835,14 @@ shaka.dash.MpdUtils.createTimeline=function(a,b,c,d,e){goog.asserts.assert(0<b&&
|
|
|
1826
1835
|
'ignoring the remaining "S" elements.',l);break}n=null!=n?n:h;q=q||0;if(0>q)if(m){m=f.parseAttr(m,"t",f.parseNonNegativeInt);if(null==m){shaka.log.warning('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:','ignoring the remaining "S" elements.',l);break}else if(n>=m){shaka.log.warning('An "S" element cannot have a negative repeatif its start ','time exceeds the next "S" element\'s start time:','ignoring the remaining "S" elements.',l);break}q=
|
|
1827
1836
|
Math.ceil((m-n)/p)-1}else{if(Infinity==d){shaka.log.warning('The last "S" element cannot have a negative repeat',"if the Period has an infinite duration:",'ignoring the last "S" element.',l);break}else if(n/b>=d){shaka.log.warning('The last "S" element cannot have a negative repeat',"if its start time exceeds the Period's duration:",'igoring the last "S" element.',l);break}q=Math.ceil((d*b-n)/p)-1}0<g.length&&n!=h&&(Math.abs((n-h)/b)>=shaka.util.ManifestParserUtils.GAP_OVERLAP_TOLERANCE_SECONDS&&
|
|
1828
1837
|
shaka.log.warning("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",l),g[g.length-1].end=n/b);for(l=0;l<=q;++l)h=n+p,g.push({start:n/b,end:h/b,unscaledStart:n,partialSegments:r,segmentPosition:g.length+e}),n=h}return g};
|
|
1829
|
-
shaka.dash.MpdUtils.parseSegmentInfo=function(a,b){goog.asserts.assert(b(a.representation),"There must be at least one element of the given type.");var c=shaka.dash.MpdUtils,d=shaka.util.TXml,e=c.inheritAttribute(a,b,"timescale"),f=1;e&&(f=d.parsePositiveInt(e)||1);
|
|
1830
|
-
b
|
|
1831
|
-
shaka.dash.MpdUtils.
|
|
1832
|
-
shaka.dash.MpdUtils.inheritChild=function(a,b,c){var d=shaka.dash.MpdUtils.getNodes(a,b);a=shaka.util.TXml;b=null;d=$jscomp.makeIterator(d);for(var e=d.next();!e.done&&!(b=a.findChild(e.value,c));e=d.next());return b};
|
|
1838
|
+
shaka.dash.MpdUtils.parseSegmentInfo=function(a,b){goog.asserts.assert(b(a.representation),"There must be at least one element of the given type.");var c=shaka.dash.MpdUtils,d=shaka.util.TXml,e=c.inheritAttribute(a,b,"timescale"),f=1;e&&(f=d.parsePositiveInt(e)||1);e=c.inheritAttribute(a,b,"duration");(e=d.parsePositiveInt(e||""))&&(e/=f);var g=c.inheritAttribute(a,b,"startNumber"),h=Number(c.inheritAttribute(a,b,"presentationTimeOffset"))||0;d=d.parseNonNegativeInt(g||"");if(null==g||null==d)d=1;
|
|
1839
|
+
b=c.inheritChild(a,b,"SegmentTimeline");g=null;b&&(g=c.createTimeline(b,f,h,a.periodInfo.duration||Infinity,d));return{timescale:f,segmentDuration:e,startNumber:d,scaledPresentationTimeOffset:h/f||0,unscaledPresentationTimeOffset:h,timeline:g}};shaka.dash.MpdUtils.getNodes=function(a,b){var c=shaka.util.Functional;goog.asserts.assert(b(a.representation),"There must be at least one element of the given type");return[b(a.representation),b(a.adaptationSet),b(a.period)].filter(c.isNotNull)};
|
|
1840
|
+
shaka.dash.MpdUtils.inheritAttribute=function(a,b,c){b=shaka.dash.MpdUtils.getNodes(a,b);a=null;b=$jscomp.makeIterator(b);for(var d=b.next();!d.done&&!(a=d.value.attributes[c]);d=b.next());return a};shaka.dash.MpdUtils.inheritChild=function(a,b,c){var d=shaka.dash.MpdUtils.getNodes(a,b);a=shaka.util.TXml;b=null;d=$jscomp.makeIterator(d);for(var e=d.next();!e.done&&!(b=a.findChild(e.value,c));e=d.next());return b};
|
|
1833
1841
|
shaka.dash.MpdUtils.handleXlinkInElement_=function(a,b,c,d,e,f){for(var g=shaka.util.TXml,h=shaka.util.Error,k=shaka.util.ManifestParserUtils,l=shaka.dash.MpdUtils.XlinkNamespaceUri_,m=g.getAttributeNS(a,l,"href"),n=g.getAttributeNS(a,l,"actuate")||"onRequest",p=$jscomp.makeIterator(Object.keys(a.attributes)),q=p.next();!q.done;q=p.next()){q=q.value;var r=q.split(":"),v=shaka.util.TXml.getKnownNameSpace(l);r[0]==v&&delete a.attributes[q]}if(5<=f)return shaka.util.AbortableOperation.failed(new h(h.Severity.CRITICAL,
|
|
1834
1842
|
h.Category.MANIFEST,h.Code.DASH_XLINK_DEPTH_LIMIT));if("onLoad"!=n)return shaka.util.AbortableOperation.failed(new h(h.Severity.CRITICAL,h.Category.MANIFEST,h.Code.DASH_UNSUPPORTED_XLINK_ACTUATE));var x=k.resolveUris([d],[m]);d=shaka.net.NetworkingEngine.RequestType.MANIFEST;k=shaka.net.NetworkingEngine.makeRequest(x,b);d=e.request(d,k);goog.asserts.assert(d instanceof shaka.util.AbortableOperation,"Unexpected implementation of IAbortableOperation!");return d.chain(function(w){w=g.parseXml(w.data,
|
|
1835
1843
|
a.tagName);if(!w)return shaka.util.AbortableOperation.failed(new h(h.Severity.CRITICAL,h.Category.MANIFEST,h.Code.DASH_INVALID_XML,m));for(a.children=[];w.children.length;){var t=w.children.shift();g.isNode(t)&&(t.parent=a);a.children.push(t)}t=$jscomp.makeIterator(Object.keys(w.attributes));for(var y=t.next();!y.done;y=t.next())y=y.value,a.attributes[y]=w.attributes[y];return shaka.dash.MpdUtils.processXlinks(a,b,c,x[0],e,f+1)})};
|
|
1836
|
-
shaka.dash.MpdUtils.processXlinks=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=shaka.dash.MpdUtils,h=shaka.util.TXml,k=g.XlinkNamespaceUri_;if(h.getAttributeNS(a,k,"href"))return h=g.handleXlinkInElement_(a,b,c,d,e,f),c&&(h=h.chain(void 0,function(q){return g.processXlinks(a,b,c,d,e,f)})),h;for(var l=[],m={},n=$jscomp.makeIterator(shaka.util.TXml.getChildNodes(a)),p=n.next();!p.done;m={$jscomp$loop$prop$child$
|
|
1837
|
-
h.getAttributeNS(m.$jscomp$loop$prop$child$
|
|
1844
|
+
shaka.dash.MpdUtils.processXlinks=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=shaka.dash.MpdUtils,h=shaka.util.TXml,k=g.XlinkNamespaceUri_;if(h.getAttributeNS(a,k,"href"))return h=g.handleXlinkInElement_(a,b,c,d,e,f),c&&(h=h.chain(void 0,function(q){return g.processXlinks(a,b,c,d,e,f)})),h;for(var l=[],m={},n=$jscomp.makeIterator(shaka.util.TXml.getChildNodes(a)),p=n.next();!p.done;m={$jscomp$loop$prop$child$950:m.$jscomp$loop$prop$child$950},p=n.next())m.$jscomp$loop$prop$child$950=p.value,"urn:mpeg:dash:resolve-to-zero:2013"==
|
|
1845
|
+
h.getAttributeNS(m.$jscomp$loop$prop$child$950,k,"href")?a.children=a.children.filter(function(q){return function(r){return r!==q.$jscomp$loop$prop$child$950}}(m)):"SegmentTimeline"!=m.$jscomp$loop$prop$child$950.tagName&&l.push(shaka.dash.MpdUtils.processXlinks(m.$jscomp$loop$prop$child$950,b,c,d,e,f));return shaka.util.AbortableOperation.all(l).chain(function(){return a})};shaka.dash.MpdUtils.XlinkNamespaceUri_="http://www.w3.org/1999/xlink";shaka.media.Mp4SegmentIndexParser=function(){};shaka.media.Mp4SegmentIndexParser.parse=function(a,b,c,d,e,f,g){var h=shaka.media.Mp4SegmentIndexParser,k,l=(new shaka.util.Mp4Parser).fullBox("sidx",function(m){k=h.parseSIDX_(b,d,e,f,g,c,m)});a&&l.parse(a);if(k)return k;shaka.log.error('Invalid box type, expected "sidx".');throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.MP4_SIDX_WRONG_BOX_TYPE);};
|
|
1838
1846
|
shaka.media.Mp4SegmentIndexParser.parseSIDX_=function(a,b,c,d,e,f,g){goog.asserts.assert(null!=g.version,"SIDX is a full box and should have a valid version.");var h=[];g.reader.skip(4);var k=g.reader.readUint32();if(0==k)throw shaka.log.error("Invalid timescale."),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.MP4_SIDX_INVALID_TIMESCALE);if(0==g.version){var l=g.reader.readUint32();var m=g.reader.readUint32()}else l=g.reader.readUint64(),
|
|
1839
1847
|
m=g.reader.readUint64();g.reader.skip(2);var n=g.reader.readUint16();a=a+g.size+m;for(m=0;m<n;m++){var p=g.reader.readUint32(),q=(p&2147483648)>>>31;p&=2147483647;var r=g.reader.readUint32();g.reader.skip(4);if(1==q)throw shaka.log.error("Heirarchical SIDXs are not supported."),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MEDIA,shaka.util.Error.Code.MP4_SIDX_TYPE_NOT_SUPPORTED);h.push(new shaka.media.SegmentReference(l/k+c,(l+r)/k+c,function(){return f},a,a+p-
|
|
1840
1848
|
1,b,c,d,e));l+=r;a+=p}g.parser.stop();return h};shaka.util.EbmlParser=function(a){this.dataView_=shaka.util.BufferUtils.toDataView(a);this.reader_=new shaka.util.DataViewReader(this.dataView_,shaka.util.DataViewReader.Endianness.BIG_ENDIAN)};shaka.util.EbmlParser.prototype.hasMoreData=function(){return this.reader_.hasMoreData()};
|
|
@@ -1878,9 +1886,9 @@ mediaSegments:d}};
|
|
|
1878
1886
|
shaka.dash.SegmentList.checkSegmentListInfo_=function(a,b){if(!b.segmentDuration&&!b.timeline&&1<b.mediaSegments.length)throw shaka.log.warning("SegmentList does not contain sufficient segment information:","the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.representation),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_NO_SEGMENT_INFO);if(!b.segmentDuration&&!a.periodInfo.duration&&
|
|
1879
1887
|
!b.timeline&&1==b.mediaSegments.length)throw shaka.log.warning("SegmentList does not contain sufficient segment information:","the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",a.representation),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_NO_SEGMENT_INFO);if(b.timeline&&0==b.timeline.length)throw shaka.log.warning("SegmentList does not contain sufficient segment information:",
|
|
1880
1888
|
"the SegmentList has an empty timeline.",a.representation),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_NO_SEGMENT_INFO);};
|
|
1881
|
-
shaka.dash.SegmentList.createSegmentReferences_=function(a,b,c,d,e,f,g,h,k){var l=shaka.util.ManifestParserUtils;c=e.mediaSegments.length;e.timeline&&e.timeline.length!=e.mediaSegments.length&&(c=Math.min(e.timeline.length,e.mediaSegments.length),shaka.log.warning("The number of items in the segment timeline and the number of ","segment URLs do not match, truncating",e.mediaSegments.length,"to",c));for(var m=a-e.scaledPresentationTimeOffset,n=b?a+b:Infinity,p=[],q=e.startTime,r={},v=0;v<c;r={$jscomp$loop$prop$uris$
|
|
1882
|
-
$jscomp$loop$prop$segment$
|
|
1883
|
-
return t.$jscomp$loop$prop$uris$
|
|
1889
|
+
shaka.dash.SegmentList.createSegmentReferences_=function(a,b,c,d,e,f,g,h,k){var l=shaka.util.ManifestParserUtils;c=e.mediaSegments.length;e.timeline&&e.timeline.length!=e.mediaSegments.length&&(c=Math.min(e.timeline.length,e.mediaSegments.length),shaka.log.warning("The number of items in the segment timeline and the number of ","segment URLs do not match, truncating",e.mediaSegments.length,"to",c));for(var m=a-e.scaledPresentationTimeOffset,n=b?a+b:Infinity,p=[],q=e.startTime,r={},v=0;v<c;r={$jscomp$loop$prop$uris$952:r.$jscomp$loop$prop$uris$952,
|
|
1890
|
+
$jscomp$loop$prop$segment$953:r.$jscomp$loop$prop$segment$953},v++){r.$jscomp$loop$prop$segment$953=e.mediaSegments[v];var x=q;q=void 0;null!=e.segmentDuration?q=x+e.segmentDuration:e.timeline?q=e.timeline[v].end:(goog.asserts.assert(1==e.mediaSegments.length&&b,"There should be exactly one segment with a Period duration."),q=x+b);r.$jscomp$loop$prop$uris$952=null;var w=function(t){return function(){null==t.$jscomp$loop$prop$uris$952&&(t.$jscomp$loop$prop$uris$952=l.resolveUris(d(),[t.$jscomp$loop$prop$segment$953.mediaUri]));
|
|
1891
|
+
return t.$jscomp$loop$prop$uris$952}}(r);x=new shaka.media.SegmentReference(a+x,a+q,w,r.$jscomp$loop$prop$segment$953.start,r.$jscomp$loop$prop$segment$953.end,f,m,a,n,[],"",null,null,shaka.media.SegmentReference.Status.AVAILABLE,g);x.codecs=k;x.mimeType=h;p.push(x)}return p};
|
|
1884
1892
|
shaka.dash.SegmentList.parseMediaSegments_=function(a){var b=[a.representation.segmentList,a.adaptationSet.segmentList,a.period.segmentList].filter(shaka.util.Functional.isNotNull),c=shaka.util.TXml,d=shaka.util.StringUtils;return b.map(function(e){return c.findChildren(e,"SegmentURL")}).reduce(function(e,f){return 0<e.length?e:f}).map(function(e){e.attributes.indexRange&&!a.indexRangeWarningGiven&&(a.indexRangeWarningGiven=!0,shaka.log.warning("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));
|
|
1885
1893
|
var f=d.htmlUnescape(e.attributes.media);e=c.parseAttr(e,"mediaRange",c.parseRange,{start:0,end:null});return{mediaUri:f,start:e.start,end:e.end}})};shaka.dash.SegmentTemplate=function(){};
|
|
1886
1894
|
shaka.dash.SegmentTemplate.createStreamInfo=function(a,b,c,d,e,f,g,h){goog.asserts.assert(a.representation.segmentTemplate,"Should only be called with SegmentTemplate");var k=shaka.dash.SegmentTemplate,l=shaka.dash.TimelineSegmentIndex,m=k.createInitSegment_(a,g),n=k.parseSegmentTemplateInfo_(a);k.checkSegmentTemplateInfo_(a,n);var p=shaka.util.ObjectUtils.shallowCloneObject(a);if(n.indexTemplate)return shaka.dash.SegmentBase.checkSegmentIndexSupport(a,m),{generateSegmentIndex:function(){return k.generateSegmentIndexFromIndexTemplate_(p,b,
|
|
@@ -1895,19 +1903,20 @@ a.representation),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.
|
|
|
1895
1903
|
shaka.dash.SegmentTemplate.generateSegmentIndexFromIndexTemplate_=function(a,b,c,d){var e=shaka.dash.MpdUtils,f=shaka.util.ManifestParserUtils;goog.asserts.assert(d.indexTemplate,"must be using index template");e=e.fillUriTemplate(d.indexTemplate,a.representation.id,null,null,a.bandwidth||null,null);f=f.resolveUris(a.representation.getBaseUris(),[e]);return shaka.dash.SegmentBase.generateSegmentIndexFromUris(a,b,c,f,0,null,d.scaledPresentationTimeOffset)};
|
|
1896
1904
|
shaka.dash.SegmentTemplate.generateSegmentIndexFromDuration_=function(a,b,c,d,e,f,g){goog.asserts.assert(b.mediaTemplate,"There should be a media template with duration");var h=shaka.dash.MpdUtils,k=shaka.util.ManifestParserUtils,l=a.presentationTimeline,m=a.periodInfo.start,n=a.period.id,p=a.periodInfo.duration,q=function(){var E=null!=n&&e[n]||p;return E?m+E:Infinity},r=b.segmentDuration;goog.asserts.assert(null!=r,"Segment duration must not be null!");var v=b.startNumber,x=b.timescale,w=b.mediaTemplate,
|
|
1897
1905
|
t=a.bandwidth||null,y=a.representation.id,u=a.representation.getBaseUris,z=m-b.scaledPresentationTimeOffset,A=function(){var E=[Math.max(l.getSegmentAvailabilityStart(),m),Math.min(l.getSegmentAvailabilityEnd(),q())];goog.asserts.assert(E.every(isFinite),"Available presentation times must be finite!");goog.asserts.assert(E.every(function(I){return 0<=I}),"Available presentation times must be positive!");goog.asserts.assert(null!=r,"Segment duration must not be null!");E=E.map(function(I){return I-
|
|
1898
|
-
m});
|
|
1899
|
-
L=h.fillUriTemplate(w,y,E,null,t,L);return k.resolveUris(u(),[L])},0,null,d,z,m,q(),[],"",null,null,shaka.media.SegmentReference.Status.AVAILABLE,f);J.codecs=a.representation.codecs;J.mimeType=a.representation.mimeType;J.trueEndTime=I;return J},F=c;for(;F<=g;++F){var D=C(F);B.push(D)}var G=new shaka.media.SegmentIndex(B);B=l.getSegmentAvailabilityEnd()<q();F=l.isLive();if(B||F){var H=Math.max(c,g+1);G.updateEvery(r,function(){var E=l.getSegmentAvailabilityStart();
|
|
1900
|
-
I.next();I=I.next().value;for(var K=[];H<=I;){var J=C(H);K.push(J);H++}return E>q()&&!K.length?null:K})}return Promise.resolve(G)};
|
|
1906
|
+
m});E=[Math.ceil(E[0]/r),Math.ceil(E[1]/r)-1];a.representation.availabilityTimeOffset&&E[1]++;return E.map(function(I){return I+v})},B=A();c=a.dynamic?Math.max(B[0],B[1]-c+1):B[0];g=g||B[1];B=[];var C=function(E){goog.asserts.assert(null!=r,"Segment duration must not be null!");var I=(E-v)*r,K=I+b.scaledPresentationTimeOffset,J=I+m;I=J+r;var M=Math.min(I,q());goog.asserts.assert(J<M,"Generated a segment outside of the period!");J=new shaka.media.SegmentReference(J,M,function(){var L=K*x;"BigInt"in
|
|
1907
|
+
window&&L>Number.MAX_SAFE_INTEGER&&(L=BigInt(K)*BigInt(x));L=h.fillUriTemplate(w,y,E,null,t,L);return k.resolveUris(u(),[L])},0,null,d,z,m,q(),[],"",null,null,shaka.media.SegmentReference.Status.AVAILABLE,f);J.codecs=a.representation.codecs;J.mimeType=a.representation.mimeType;J.trueEndTime=I;return J},F=c;for(;F<=g;++F){var D=C(F);B.push(D)}var G=new shaka.media.SegmentIndex(B);B=l.getSegmentAvailabilityEnd()<q();F=l.isLive();if(B||F){var H=Math.max(c,g+1);G.updateEvery(r,function(){var E=l.getSegmentAvailabilityStart();
|
|
1908
|
+
G.evict(E);var I=$jscomp.makeIterator(A());I.next();I=I.next().value;for(var K=[];H<=I;){var J=C(H);K.push(J);H++}return E>q()&&!K.length?null:K})}return Promise.resolve(G)};
|
|
1901
1909
|
shaka.dash.SegmentTemplate.createInitSegment_=function(a,b){var c=shaka.dash.MpdUtils,d=shaka.util.ManifestParserUtils,e=c.inheritAttribute(a,shaka.dash.SegmentTemplate.fromInheritance_,"initialization");if(!e)return null;e=shaka.util.StringUtils.htmlUnescape(e);var f=a.representation.id,g=a.bandwidth||null,h=a.representation.getBaseUris,k=shaka.dash.SegmentBase.createQualityInfo(a);b=new shaka.media.InitSegmentReference(function(){goog.asserts.assert(e,"Should have returned earler");var l=c.fillUriTemplate(e,
|
|
1902
1910
|
f,null,null,g,null);return d.resolveUris(h(),[l])},0,null,k,null,null,b);b.codecs=a.representation.codecs;b.mimeType=a.representation.mimeType;return b};shaka.dash.TimelineSegmentIndex=function(a,b,c,d,e,f,g,h,k,l){shaka.media.SegmentIndex.call(this,[]);this.templateInfo_=a;this.representationId_=b;this.bandwidth_=c;this.getBaseUris_=d;this.periodStart_=e;this.periodEnd_=f;this.initSegmentReference_=g;this.aesKey_=k;this.segmentSequenceCadence_=l;h&&this.fitTimeline()};
|
|
1903
1911
|
$jscomp.inherits(shaka.dash.TimelineSegmentIndex,shaka.media.SegmentIndex);shaka.dash.TimelineSegmentIndex.prototype.getNumReferences=function(){return this.templateInfo_?this.templateInfo_.timeline.length:0};shaka.dash.TimelineSegmentIndex.prototype.release=function(){shaka.media.SegmentIndex.prototype.release.call(this);this.templateInfo_=null};
|
|
1904
1912
|
shaka.dash.TimelineSegmentIndex.prototype.evict=function(a){if(this.templateInfo_){shaka.log.debug(this.representationId_+" Evicting at "+a);for(var b=0,c=this.templateInfo_.timeline,d=0;d<c.length;d+=1){var e=c[d],f=e.end+this.periodStart_;e=e.start+this.periodStart_;if(f<=a)shaka.log.debug("Evicting "+e+" - "+f),b+=1;else break}0<b&&(this.templateInfo_.timeline=c.slice(b),this.references.length>=b&&(this.references=this.references.slice(b)),this.numEvicted_+=b,0===this.getNumReferences()&&this.release())}};
|
|
1905
|
-
shaka.dash.TimelineSegmentIndex.prototype.appendTemplateInfo=function(a,b,c,d,e){this.
|
|
1906
|
-
a,this.periodStart_=b,this.periodEnd_=c;d&&this.fitTimeline()};shaka.dash.TimelineSegmentIndex.prototype.
|
|
1913
|
+
shaka.dash.TimelineSegmentIndex.prototype.appendTemplateInfo=function(a,b,c,d,e){this.updateInitSegmentReference(e);if(this.templateInfo_){b=this.templateInfo_.timeline;this.templateInfo_.mediaTemplate=a.mediaTemplate;var f=b[b.length-1];a=a.timeline.filter(function(g){return g.start>=f.end});0<a.length&&(shaka.log.debug("Appending "+a.length+" entries"),this.templateInfo_.timeline.push.apply(this.templateInfo_.timeline,$jscomp.arrayFromIterable(a)));this.periodEnd_!==c&&(this.periodEnd_=c)}else this.templateInfo_=
|
|
1914
|
+
a,this.periodStart_=b,this.periodEnd_=c;d&&this.fitTimeline()};shaka.dash.TimelineSegmentIndex.prototype.updateInitSegmentReference=function(a){if(this.initSegmentReference_!==a){this.initSegmentReference_=a;for(var b=$jscomp.makeIterator(this.references),c=b.next();!c.done;c=b.next())(c=c.value)&&c.updateInitSegmentReference(a)}};
|
|
1915
|
+
shaka.dash.TimelineSegmentIndex.prototype.isBeforeFirstEntry=function(a){return this.templateInfo_&&this.templateInfo_.timeline&&this.templateInfo_.timeline.length?a<this.templateInfo_.timeline[0].start+this.periodStart_:!1};shaka.dash.TimelineSegmentIndex.prototype.fitTimeline=function(){if(!this.getIsImmutable()){for(var a=this.templateInfo_.timeline;a.length;)if(a[a.length-1].start>=this.periodEnd_)a.pop();else break;this.evict(this.periodStart_)}};
|
|
1907
1916
|
shaka.dash.TimelineSegmentIndex.prototype.find=function(a){shaka.log.debug("Find "+a);if(this.isBeforeFirstEntry(a))return this.numEvicted_;if(!this.templateInfo_)return null;var b=this.templateInfo_.timeline;if(a<this.periodStart_||a>=this.periodEnd_)return null;for(var c=b.length-1,d=0;d<b.length;d++){var e=b[d],f=e.start+this.periodStart_;e=d<c?b[d+1].start+this.periodStart_:Infinity===this.periodEnd_?e.end+this.periodStart_:this.periodEnd_;if(a>=f&&a<e)return d+this.numEvicted_}return null};
|
|
1908
1917
|
shaka.dash.TimelineSegmentIndex.prototype.get=function(a){var b=this;a-=this.numEvicted_;if(0>a||a>=this.getNumReferences()||!this.templateInfo_)return null;var c=this.references[a];if(!c){var d=this.templateInfo_.mediaTemplate,e=this.templateInfo_.timeline[a],f=e.segmentPosition,g=this.templateInfo_.unscaledPresentationTimeOffset+e.unscaledStart;c=this.periodStart_-this.templateInfo_.scaledPresentationTimeOffset;var h=this.periodStart_+e.end,k=h;a===this.getNumReferences()-1&&Infinity!==this.periodEnd_&&
|
|
1909
|
-
(k=this.periodEnd_);for(var l=this.templateInfo_.codecs,m=this.templateInfo_.mimeType,n=[],p=(e.end-e.start)/e.partialSegments,q={},r=0;r<e.partialSegments;q={$jscomp$loop$prop$uris$
|
|
1910
|
-
shaka.dash.TimelineSegmentIndex.createUris_(b.templateInfo_.mediaTemplate,b.representationId_,f,b.bandwidth_,g,t.$jscomp$loop$prop$subNumber$
|
|
1918
|
+
(k=this.periodEnd_);for(var l=this.templateInfo_.codecs,m=this.templateInfo_.mimeType,n=[],p=(e.end-e.start)/e.partialSegments,q={},r=0;r<e.partialSegments;q={$jscomp$loop$prop$uris$955:q.$jscomp$loop$prop$uris$955,$jscomp$loop$prop$subNumber$956:q.$jscomp$loop$prop$subNumber$956},r++){var v=e.start+p*r,x=v+p;q.$jscomp$loop$prop$subNumber$956=r+1;q.$jscomp$loop$prop$uris$955=null;var w=function(t){return function(){if(!b.templateInfo_)return[];null==t.$jscomp$loop$prop$uris$955&&(t.$jscomp$loop$prop$uris$955=
|
|
1919
|
+
shaka.dash.TimelineSegmentIndex.createUris_(b.templateInfo_.mediaTemplate,b.representationId_,f,b.bandwidth_,g,t.$jscomp$loop$prop$subNumber$956,b.getBaseUris_));return t.$jscomp$loop$prop$uris$955}}(q);v=new shaka.media.SegmentReference(this.periodStart_+v,this.periodStart_+x,w,0,null,this.initSegmentReference_,c,this.periodStart_,this.periodEnd_,[],"",null,null,shaka.media.SegmentReference.Status.AVAILABLE,this.aesKey_);v.codecs=l;v.mimeType=m;0==this.segmentSequenceCadence_?0<r&&v.markAsNonIndependent():
|
|
1911
1920
|
0!=r%this.segmentSequenceCadence_&&v.markAsNonIndependent();n.push(v)}c=new shaka.media.SegmentReference(this.periodStart_+e.start,k,function(){return 0<e.partialSegments?[]:shaka.dash.TimelineSegmentIndex.createUris_(d,b.representationId_,f,b.bandwidth_,g,null,b.getBaseUris_)},0,null,this.initSegmentReference_,c,this.periodStart_,this.periodEnd_,n,"",null,null,shaka.media.SegmentReference.Status.AVAILABLE,this.aesKey_,0<e.partialSegments);c.codecs=l;c.mimeType=m;c.trueEndTime=h;this.references[a]=
|
|
1912
1921
|
c}return c};shaka.dash.TimelineSegmentIndex.createUris_=function(a,b,c,d,e,f,g){a=shaka.dash.MpdUtils.fillUriTemplate(a,b,c,f,d||null,e);return shaka.util.ManifestParserUtils.resolveUris(g(),[a]).map(function(h){return h.toString()})};shaka.util.ContentSteeringManager=function(a){this.config_=null;this.playerInterface_=a;this.operationManager_=new shaka.util.OperationManager;this.baseUris_=[];this.defaultPathwayId_=null;this.pathwayPriority_=[];this.lastPathwayUsed_=null;this.pathwayClones_=[];this.lastTTL_=300;this.locations_=new Map;this.bannedLocations_=new Map;this.updateTimer_=null;this.manifestType_=shaka.media.ManifestParser.UNKNOWN};shaka.util.ContentSteeringManager.prototype.configure=function(a){this.config_=a};
|
|
1913
1922
|
shaka.util.ContentSteeringManager.prototype.destroy=function(){this.playerInterface_=this.config_=null;this.baseUris_=[];this.defaultPathwayId_=null;this.pathwayPriority_=[];this.pathwayClones_=[];this.locations_.clear();null!=this.updateTimer_&&(this.updateTimer_.stop(),this.updateTimer_=null);return this.operationManager_.destroy()};shaka.util.ContentSteeringManager.prototype.setManifestType=function(a){this.manifestType_=a};
|
|
@@ -1917,8 +1926,8 @@ m.yield(f.promise,4);if(2!=m.nextAddress)return g=m.yieldResult,h=shaka.util.Str
|
|
|
1917
1926
|
shaka.util.ContentSteeringManager.prototype.addQueryParams_=function(a){if(!this.pathwayPriority_.length)return a;a=new goog.Uri(a);var b=this.lastPathwayUsed_||this.pathwayPriority_[0],c=Math.round(this.playerInterface_.getBandwidthEstimate()),d=a.getQueryData();this.manifestType_==shaka.media.ManifestParser.DASH?(d.add("_DASH_pathway",b),d.add("_DASH_throughput",String(c))):this.manifestType_==shaka.media.ManifestParser.HLS&&(d.add("_HLS_pathway",b),d.add("_HLS_throughput",String(c)));d.getCount()&&
|
|
1918
1927
|
a.setQueryData(d);return a.toString()};shaka.util.ContentSteeringManager.prototype.processManifest_=function(a,b){var c=this;null!=this.updateTimer_&&(this.updateTimer_.stop(),this.updateTimer_=null);var d=a["RELOAD-URI"]||b;this.updateTimer_=new shaka.util.Timer(function(){c.requestInfo(d)});if(b=a.TTL)this.lastTTL_=b;this.updateTimer_.tickAfter(this.lastTTL_);this.pathwayPriority_=a["PATHWAY-PRIORITY"]||[];this.pathwayClones_=a["PATHWAY-CLONES"]||[]};
|
|
1919
1928
|
shaka.util.ContentSteeringManager.prototype.clearPreviousLocations=function(){this.locations_.clear()};shaka.util.ContentSteeringManager.prototype.addLocation=function(a,b,c){var d=this.locations_.get(a);d||(d=new Map);d.set(b,c);this.locations_.set(a,d)};shaka.util.ContentSteeringManager.prototype.banLocation=function(a){var b=Date.now()+6E4;this.bannedLocations_.set(a,b)};
|
|
1920
|
-
shaka.util.ContentSteeringManager.prototype.getLocations=function(a,b){var c=this;b=void 0===b?!1:b;a=this.locations_.get(a)||new Map;for(var d=[],e={},f=$jscomp.makeIterator(this.pathwayPriority_),g=f.next();!g.done;e={$jscomp$loop$prop$pathwayId$
|
|
1921
|
-
k.$jscomp$loop$prop$pathwayId$
|
|
1929
|
+
shaka.util.ContentSteeringManager.prototype.getLocations=function(a,b){var c=this;b=void 0===b?!1:b;a=this.locations_.get(a)||new Map;for(var d=[],e={},f=$jscomp.makeIterator(this.pathwayPriority_),g=f.next();!g.done;e={$jscomp$loop$prop$pathwayId$958:e.$jscomp$loop$prop$pathwayId$958},g=f.next())if(e.$jscomp$loop$prop$pathwayId$958=g.value,g=a.get(e.$jscomp$loop$prop$pathwayId$958))d.push({pathwayId:e.$jscomp$loop$prop$pathwayId$958,location:g});else if(g=this.pathwayClones_.find(function(k){return function(l){return l.ID==
|
|
1930
|
+
k.$jscomp$loop$prop$pathwayId$958}}(e))){var h=a.get(g["BASE-ID"]);h&&(g["URI-REPLACEMENT"].HOST?(h=new goog.Uri(h),h.setDomain(g["URI-REPLACEMENT"].HOST),d.push({pathwayId:e.$jscomp$loop$prop$pathwayId$958,location:h.toString()})):d.push({pathwayId:e.$jscomp$loop$prop$pathwayId$958,location:h}))}e=Date.now();f=$jscomp.makeIterator(this.bannedLocations_.keys());for(g=f.next();!g.done;g=f.next())g=g.value,h=this.bannedLocations_.get(g),e>h&&this.bannedLocations_.delete(g);d=d.filter(function(k){for(var l=
|
|
1922
1931
|
$jscomp.makeIterator(c.bannedLocations_.keys()),m=l.next();!m.done;m=l.next())if(m.value.includes((new goog.Uri(k.location)).getDomain()))return!1;return!0});d.length&&(this.lastPathwayUsed_=d[0].pathwayId);d=d.map(function(k){return k.location});if(!d.length&&this.defaultPathwayId_)for(e=$jscomp.makeIterator(this.defaultPathwayId_.split(",")),g=e.next();!g.done;g=e.next())if(f=a.get(g.value))this.lastPathwayUsed_=this.defaultPathwayId_,d.push(f);if(!d.length)for(a=$jscomp.makeIterator(a.values()),
|
|
1923
1932
|
e=a.next();!e.done;e=a.next())d.push(e.value);return b?d:shaka.util.ManifestParserUtils.resolveUris(this.baseUris_,d)};shaka.util.PeriodCombiner=function(){this.variants_=[];this.audioStreams_=[];this.videoStreams_=[];this.textStreams_=[];this.imageStreams_=[];this.useStreamOnce_=this.multiTypeVariantsAllowed_=!1;this.usedPeriodIds_=new Set};
|
|
1924
1933
|
shaka.util.PeriodCombiner.prototype.release=function(){var a=this.audioStreams_.concat(this.videoStreams_,this.textStreams_,this.imageStreams_);a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b=b.value,b.segmentIndex&&b.segmentIndex.release();this.audioStreams_=[];this.videoStreams_=[];this.textStreams_=[];this.imageStreams_=[];this.variants_=[]};shaka.util.PeriodCombiner.prototype.getVariants=function(){return this.variants_};shaka.util.PeriodCombiner.prototype.getTextStreams=function(){return this.textStreams_.slice()};
|
|
@@ -1935,8 +1944,8 @@ b.VIDEO}).map(function(L){return[c.generateVideoKey_(L),L]}))});f=a.map(function
|
|
|
1935
1944
|
n.next())q=p.value,r=c.dummyStreamDB_(b.IMAGE),q.set(c.generateImageKey_(r),r);v=new shaka.util.PeriodCombiner;return J.yield(v.combine_([],d,0,shaka.util.PeriodCombiner.cloneStreamDB_,shaka.util.PeriodCombiner.concatenateStreamDBs_),2);case 2:return x=J.yieldResult,J.yield(v.combine_([],e,0,shaka.util.PeriodCombiner.cloneStreamDB_,shaka.util.PeriodCombiner.concatenateStreamDBs_),3);case 3:return w=J.yieldResult,J.yield(v.combine_([],f,0,shaka.util.PeriodCombiner.cloneStreamDB_,shaka.util.PeriodCombiner.concatenateStreamDBs_),
|
|
1936
1945
|
4);case 4:return t=J.yieldResult,J.yield(v.combine_([],g,0,shaka.util.PeriodCombiner.cloneStreamDB_,shaka.util.PeriodCombiner.concatenateStreamDBs_),5);case 5:y=J.yieldResult;u=0;if(w.length&&x.length)for(F=$jscomp.makeIterator(x),D=F.next();!D.done;D=F.next())for(G=D.value,H=$jscomp.makeIterator(w),E=H.next();!E.done;E=H.next())I=E.value,K=u++,I.variantIds.push(K),G.variantIds.push(K);else for(z=w.concat(x),A=$jscomp.makeIterator(z),B=A.next();!B.done;B=A.next())C=B.value,C.variantIds=[u++];return J.return(w.concat(x).concat(t).concat(y))}})};
|
|
1937
1946
|
shaka.util.PeriodCombiner.prototype.combine_=function(a,b,c,d,e){var f=this,g,h,k,l,m,n,p,q,r,v,x,w,t,y,u,z,A,B,C;return $jscomp.asyncExecutePromiseGeneratorProgram(function(F){switch(F.nextAddress){case 1:g=[];for(h=0;h<c;h++)g.push(new Set);for(k=c;k<b.length;k++)g.push(new Set(b[k].values()));l=$jscomp.makeIterator(a);m=l.next();case 2:if(m.done){F.jumpTo(4);break}n=m.value;return F.yield(f.extendExistingOutputStream_(n,b,c,e,g),5);case 5:p=F.yieldResult;if(!p)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,
|
|
1938
|
-
shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.PERIOD_FLATTENING_FAILED);m=l.next();F.jumpTo(2);break;case 4:q=$jscomp.makeIterator(g);for(r=q.next();!r.done;r=q.next())for(v=r.value,x=$jscomp.makeIterator(v),w=x.next();!w.done;w=x.next())t=w.value,(y=f.createNewOutputStream_(t,b,d,e,g))&&a.push(y);u=$jscomp.makeIterator(g);for(r=u.next();!r.done;r=u.next())for(z=r.value,A={},B=$jscomp.makeIterator(z),w=B.next();!w.done;A={$jscomp$loop$prop$stream$
|
|
1939
|
-
w=B.next())if(A.$jscomp$loop$prop$stream$
|
|
1947
|
+
shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.PERIOD_FLATTENING_FAILED);m=l.next();F.jumpTo(2);break;case 4:q=$jscomp.makeIterator(g);for(r=q.next();!r.done;r=q.next())for(v=r.value,x=$jscomp.makeIterator(v),w=x.next();!w.done;w=x.next())t=w.value,(y=f.createNewOutputStream_(t,b,d,e,g))&&a.push(y);u=$jscomp.makeIterator(g);for(r=u.next();!r.done;r=u.next())for(z=r.value,A={},B=$jscomp.makeIterator(z),w=B.next();!w.done;A={$jscomp$loop$prop$stream$760$960:A.$jscomp$loop$prop$stream$760$960},
|
|
1948
|
+
w=B.next())if(A.$jscomp$loop$prop$stream$760$960=w.value,!shaka.util.PeriodCombiner.isDummy_(A.$jscomp$loop$prop$stream$760$960)&&(C=a.some(function(D){return function(G){return f.areAVStreamsCompatible_(D.$jscomp$loop$prop$stream$760$960,G)}}(A))))throw shaka.log.error("Unused stream in period-flattening!",A.$jscomp$loop$prop$stream$760$960,a),new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.PERIOD_FLATTENING_FAILED);return F.return(a)}})};
|
|
1940
1949
|
shaka.util.PeriodCombiner.prototype.extendExistingOutputStream_=function(a,b,c,d,e){var f=this;return $jscomp.asyncExecutePromiseGeneratorProgram(function(g){if(1==g.nextAddress)return f.findMatchesInAllPeriods_(b,a),goog.asserts.assert(a.createSegmentIndex,"outputStream should be a Stream type!"),a.matchedStreams?a.segmentIndex?g.yield(shaka.util.PeriodCombiner.extendOutputSegmentIndex_(a,c),2):g.jumpTo(2):(shaka.log.error("No matches extending output stream!",a,b),g.return(!1));shaka.util.PeriodCombiner.extendOutputStream_(a,
|
|
1941
1950
|
c,d,e);return g.return(!0)})};
|
|
1942
1951
|
shaka.util.PeriodCombiner.extendOutputSegmentIndex_=function(a,b){var c,d,e,f,g,h,k;return $jscomp.asyncExecutePromiseGeneratorProgram(function(l){if(1==l.nextAddress){c=[];d=a.matchedStreams;goog.asserts.assert(d,"matched streams should be valid");e=$jscomp.makeIterator(d);for(f=e.next();!f.done;f=e.next())g=f.value,c.push(g.createSegmentIndex()),g.trickModeVideo&&!g.trickModeVideo.segmentIndex&&c.push(g.trickModeVideo.createSegmentIndex());return l.yield(Promise.all(c),2)}if(a.segmentIndex instanceof
|
|
@@ -1987,9 +1996,9 @@ shaka.dash.DashParser.prototype.onExpirationUpdated=function(a,b){};shaka.dash.D
|
|
|
1987
1996
|
shaka.dash.DashParser.prototype.banLocation=function(a){this.contentSteeringManager_&&this.contentSteeringManager_.banLocation(a)};
|
|
1988
1997
|
shaka.dash.DashParser.prototype.requestManifest_=function(){var a=this,b,c,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress)return b=shaka.net.NetworkingEngine.RequestType.MANIFEST,c=shaka.net.NetworkingEngine.AdvancedRequestType.MPD,d=a.manifestUris_,1<a.manifestUris_.length&&a.contentSteeringManager_&&(e=a.contentSteeringManager_.getLocations("Location",!0),e.length&&(d=e)),f=shaka.net.NetworkingEngine.makeRequest(d,a.config_.retryParameters),g=Date.now(),
|
|
1989
1998
|
m.yield(a.makeNetworkRequest_(f,b,{type:c}),2);if(3!=m.nextAddress){h=m.yieldResult;if(!a.playerInterface_)return m.return(0);h.uri&&h.uri!=h.originalUri&&!a.manifestUris_.includes(h.uri)&&a.manifestUris_.unshift(h.uri);return m.yield(a.parseManifest_(h.data,h.uri),3)}k=Date.now();l=(k-g)/1E3;a.averageUpdateDuration_.sample(1,l);return m.return(l)})};
|
|
1990
|
-
shaka.dash.DashParser.prototype.parseManifest_=function(a,b){var c=this,d,e,f,g,h,k,l,m,n;return $jscomp.asyncExecutePromiseGeneratorProgram(function(
|
|
1991
|
-
shaka.util.Error.Code.DASH_INVALID_XML,b);e(
|
|
1992
|
-
|
|
1999
|
+
shaka.dash.DashParser.prototype.parseManifest_=function(a,b){var c=this,d,e,f,g,h,k,l,m,n,p,q;return $jscomp.asyncExecutePromiseGeneratorProgram(function(r){if(1==r.nextAddress){d=a;e=c.config_.dash.manifestPreprocessor;f=shaka.util.PlayerConfiguration.defaultManifestPreprocessor;if(e!=f){shaka.Deprecate.deprecateFeature(5,"manifest.dash.manifestPreprocessor configuration","Please Use manifest.dash.manifestPreprocessorTXml instead.");g=shaka.util.XmlUtils.parseXml(d,"MPD");if(!g)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,
|
|
2000
|
+
shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_INVALID_XML,b);e(g);d=shaka.util.XmlUtils.toArrayBuffer(g)}h=shaka.util.TXml.parseXml(d,"MPD");if(!h)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_INVALID_XML,b);k=c.config_.dash.manifestPreprocessorTXml;l=shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml;k!=l&&k(h);if(m=c.config_.dash.disableXlinkProcessing)return r.return(c.processManifest_(h,b));
|
|
2001
|
+
n=c.config_.dash.xlinkFailGracefully;p=shaka.dash.MpdUtils.processXlinks(h,c.config_.retryParameters,n,b,c.playerInterface_.networkingEngine);c.operationManager_.manage(p);return r.yield(p.promise,2)}q=r.yieldResult;return r.return(c.processManifest_(q,b))})};
|
|
1993
2002
|
shaka.dash.DashParser.prototype.processManifest_=function(a,b){var c=this,d,e,f,g,h,k,l,m,n,p,q,r,v,x,w,t,y,u,z,A,B,C,F,D,G,H,E,I,K,J,M,L,O,R,P,Q,S,N,da,Y,V,T,Z,W,aa,ea,fa,oa,ha,ba,X,ia,ja,pa,ka,ca,la,ma,na;return $jscomp.asyncExecutePromiseGeneratorProgram(function(U){switch(U.nextAddress){case 1:d=shaka.util.TXml;goog.asserts.assert(c.config_,"Must call configure() before processManifest_()!");c.contentSteeringManager_&&c.contentSteeringManager_.clearPreviousLocations();e=[b];f=[];g=new Map;h=d.findChildren(a,
|
|
1994
2003
|
"Location");k=$jscomp.makeIterator(h);for(l=k.next();!l.done;l=k.next())if(m=l.value,n=m.attributes.serviceLocation,p=d.getContents(m))q=shaka.util.ManifestParserUtils.resolveUris(e,[p])[0],n&&(c.contentSteeringManager_?c.contentSteeringManager_.addLocation("Location",n,q):g.set(n,q)),f.push(q);c.contentSteeringManager_?(r=c.contentSteeringManager_.getLocations("Location",!0),0<r.length&&(e=c.manifestUris_=r)):f.length&&(e=c.manifestUris_=f);v=Promise.resolve();if((x=d.findChild(a,"ContentSteering"))&&
|
|
1995
2004
|
c.playerInterface_){w=x.attributes.defaultServiceLocation;if(c.contentSteeringManager_)c.contentSteeringManager_.setBaseUris(e),c.contentSteeringManager_.setDefaultPathwayId(w);else if(c.contentSteeringManager_=new shaka.util.ContentSteeringManager(c.playerInterface_),c.contentSteeringManager_.configure(c.config_),c.contentSteeringManager_.setManifestType(shaka.media.ManifestParser.DASH),c.contentSteeringManager_.setBaseUris(e),c.contentSteeringManager_.setDefaultPathwayId(w),t=d.getContents(x))(y=
|
|
@@ -2009,8 +2018,8 @@ m);g=this.parsePeriod_(a,b,{start:m,duration:q,node:k,isLastPeriod:null==q||!l})
|
|
|
2009
2018
|
duration:e,durationDerivedFromPeriods:!1}):{periods:f,duration:g,durationDerivedFromPeriods:!0}};
|
|
2010
2019
|
shaka.dash.DashParser.prototype.parsePeriod_=function(a,b,c){var d=this,e=shaka.util.Functional,f=shaka.util.TXml,g=shaka.util.ManifestParserUtils.ContentType;a.period=this.createFrame_(c.node,null,b);a.periodInfo=c;a.period.availabilityTimeOffset=a.availabilityTimeOffset;a.period.id||(shaka.log.info("No Period ID given for Period with start time "+c.start+", Assigning a default"),a.period.id="__shaka_period_"+c.start);var h=f.findChildren(c.node,"EventStream");b=a.presentationTimeline.getSegmentAvailabilityStart();
|
|
2011
2020
|
h=$jscomp.makeIterator(h);for(var k=h.next();!k.done;k=h.next())this.parseEventStream_(c.start,c.duration,k.value,b);e=f.findChildren(c.node,"AdaptationSet").map(function(n){return d.parseAdaptationSet_(a,n)}).filter(e.isNotNull);if(a.dynamic){c=[];f=$jscomp.makeIterator(e);for(b=f.next();!b.done;b=f.next())for(b=$jscomp.makeIterator(b.value.representationIds),h=b.next();!h.done;h=b.next())c.push(h.value);f=new Set(c);if(c.length!=f.size)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,
|
|
2012
|
-
shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_DUPLICATE_REPRESENTATION_ID);}c=e.filter(function(n){return!n.trickModeFor});e=e.filter(function(n){return n.trickModeFor});e=$jscomp.makeIterator(e);for(f=e.next();!f.done;f=e.next())for(f=f.value,b=f.trickModeFor.split(" "),h=$jscomp.makeIterator(c),k=h.next();!k.done;k=h.next()){var l=k.value;if(b.includes(l.id)){k={};l=$jscomp.makeIterator(l.streams);for(var m=l.next();!m.done;k={$jscomp$loop$prop$stream$
|
|
2013
|
-
m=l.next())k.$jscomp$loop$prop$stream$
|
|
2021
|
+
shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_DUPLICATE_REPRESENTATION_ID);}c=e.filter(function(n){return!n.trickModeFor});e=e.filter(function(n){return n.trickModeFor});e=$jscomp.makeIterator(e);for(f=e.next();!f.done;f=e.next())for(f=f.value,b=f.trickModeFor.split(" "),h=$jscomp.makeIterator(c),k=h.next();!k.done;k=h.next()){var l=k.value;if(b.includes(l.id)){k={};l=$jscomp.makeIterator(l.streams);for(var m=l.next();!m.done;k={$jscomp$loop$prop$stream$962:k.$jscomp$loop$prop$stream$962},
|
|
2022
|
+
m=l.next())k.$jscomp$loop$prop$stream$962=m.value,k.$jscomp$loop$prop$stream$962.trickModeVideo=f.streams.find(function(n){return function(p){return shaka.util.MimeUtils.getNormalizedCodec(n.$jscomp$loop$prop$stream$962.codecs)==shaka.util.MimeUtils.getNormalizedCodec(p.codecs)}}(k))}}e=this.getStreamsFromSets_(this.config_.disableAudio,c,g.AUDIO);f=this.getStreamsFromSets_(this.config_.disableVideo,c,g.VIDEO);b=this.getStreamsFromSets_(this.config_.disableText,c,g.TEXT);g=this.getStreamsFromSets_(this.config_.disableThumbnails,
|
|
2014
2023
|
c,g.IMAGE);if(0===f.length&&0===e.length)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.DASH_EMPTY_PERIOD);return{id:a.period.id,audioStreams:e,videoStreams:f,textStreams:b,imageStreams:g}};shaka.dash.DashParser.prototype.getStreamsFromSets_=function(a,b,c){return a||!b.length?[]:b.reduce(function(d,e){if(e.contentType!=c)return d;d.push.apply(d,$jscomp.arrayFromIterable(e.streams));return d},[])};
|
|
2015
2024
|
shaka.dash.DashParser.prototype.parseAdaptationSet_=function(a,b){var c=this,d=shaka.util.TXml,e=shaka.util.Functional,f=shaka.util.ManifestParserUtils,g=f.ContentType,h=shaka.dash.ContentProtection;a.adaptationSet=this.createFrame_(b,a.period,null);var k=!1,l=d.findChildren(b,"Role"),m=l.map(function(E){return E.attributes.value}).filter(e.isNotNull),n=void 0;if(e=a.adaptationSet.contentType==g.TEXT)n=f.TextStreamKind.SUBTITLE;l=$jscomp.makeIterator(l);for(var p=l.next();!p.done;p=l.next()){p=p.value;
|
|
2016
2025
|
var q=p.attributes.schemeIdUri;if(null==q||"urn:mpeg:dash:role:2011"==q)switch(p=p.attributes.value,p){case "main":k=!0;break;case "caption":case "subtitle":n=p}}var r;q=function(E){switch(E){case 1:case 6:case 13:case 14:case 15:return"SDR";case 16:return"PQ";case 18:return"HLG"}};var v=d.findChildren(b,"EssentialProperty");l=null;var x=!1;p=!1;v=$jscomp.makeIterator(v);for(var w=v.next();!w.done;w=v.next()){w=w.value;var t=w.attributes.schemeIdUri;"http://dashif.org/guidelines/trickmode"==t?l=w.attributes.value:
|
|
@@ -2043,8 +2052,8 @@ b,c);continue}return d;case "tag:dolby.com,2014:dash:audio_channel_configuration
|
|
|
2043
2052
|
e&&e<d.length)return d[e];continue;default:shaka.log.warning("Unrecognized audio channel scheme:",b,c)}}return null};
|
|
2044
2053
|
shaka.dash.DashParser.prototype.verifyRepresentation_=function(a){var b=shaka.util.ManifestParserUtils.ContentType;var c=a.segmentBase?1:0;c+=a.segmentList?1:0;c+=a.segmentTemplate?1:0;if(0==c){if(a.contentType==b.TEXT||a.contentType==b.APPLICATION)return!0;shaka.log.warning("Representation does not contain a segment information source:","the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',a);return!1}1!=c&&(shaka.log.warning("Representation contains multiple segment information sources:",
|
|
2045
2054
|
"the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",a),a.segmentBase?(shaka.log.info("Using SegmentBase by default."),a.segmentList=null):(goog.asserts.assert(a.segmentList,"There should be a SegmentList"),shaka.log.info("Using SegmentList by default.")),a.segmentTemplate=null);return!0};
|
|
2046
|
-
shaka.dash.DashParser.prototype.requestForTiming_=function(a,b,c){var d=this,e,f,g,h,k,l,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(
|
|
2047
|
-
!
|
|
2055
|
+
shaka.dash.DashParser.prototype.requestForTiming_=function(a,b,c){var d=this,e,f,g,h,k,l,m,n;return $jscomp.asyncExecutePromiseGeneratorProgram(function(p){if(1==p.nextAddress)return e=[shaka.util.StringUtils.htmlUnescape(b)],f=shaka.util.ManifestParserUtils.resolveUris(a(),e),g=shaka.net.NetworkingEngine.makeRequest(f,d.config_.retryParameters),g.method=c,h=shaka.net.NetworkingEngine.RequestType.TIMING,k=d.playerInterface_.networkingEngine.request(h,g),d.operationManager_.manage(k),p.yield(k.promise,
|
|
2056
|
+
2);l=p.yieldResult;if("HEAD"==c){if(!l.headers||!l.headers.date)return shaka.log.warning("UTC timing response is missing","expected date header"),p.return(0);m=l.headers.date}else m=shaka.util.StringUtils.fromUTF8(l.data);n=Date.parse(m);return isNaN(n)?(shaka.log.warning("Unable to parse date from UTC timing response"),p.return(0)):p.return(n-Date.now())})};
|
|
2048
2057
|
shaka.dash.DashParser.prototype.parseUtcTiming_=function(a,b){var c=this,d,e,f,g,h,k,l,m,n;return $jscomp.asyncExecutePromiseGeneratorProgram(function(p){switch(p.nextAddress){case 1:d=b.map(function(q){return{scheme:q.attributes.schemeIdUri,value:q.attributes.value}}),e=c.config_.dash.clockSyncUri,!d.length&&e&&d.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:e}),f=$jscomp.makeIterator(d),g=f.next();case 2:if(g.done){p.jumpTo(4);break}h=g.value;p.setCatchFinallyBlocks(5);k=h.scheme;l=h.value;
|
|
2049
2058
|
switch(k){case "urn:mpeg:dash:utc:http-head:2014":case "urn:mpeg:dash:utc:http-head:2012":return p.jumpTo(7);case "urn:mpeg:dash:utc:http-xsdate:2014":case "urn:mpeg:dash:utc:http-iso:2014":case "urn:mpeg:dash:utc:http-xsdate:2012":case "urn:mpeg:dash:utc:http-iso:2012":return p.jumpTo(8);case "urn:mpeg:dash:utc:direct:2014":case "urn:mpeg:dash:utc:direct:2012":return m=Date.parse(l),p.return(isNaN(m)?0:m-Date.now());case "urn:mpeg:dash:utc:http-ntp:2014":case "urn:mpeg:dash:utc:ntp:2014":case "urn:mpeg:dash:utc:sntp:2014":shaka.log.alwaysWarn("NTP UTCTiming scheme is not supported");
|
|
2050
2059
|
break;default:shaka.log.alwaysWarn("Unrecognized scheme in UTCTiming element",k)}p.jumpTo(9);break;case 7:return p.yield(c.requestForTiming_(a,l,"HEAD"),10);case 10:return p.return(p.yieldResult);case 8:return p.yield(c.requestForTiming_(a,l,"GET"),11);case 11:return p.return(p.yieldResult);case 9:p.leaveTryBlock(3);break;case 5:n=p.enterCatchBlock(),shaka.log.warning("Error fetching time from UTCTiming elem",n.message);case 3:g=f.next();p.jumpTo(2);break;case 4:return shaka.log.alwaysWarn("A UTCTiming element should always be given in live manifests! This content may not play on clients with bad clocks!"),
|
|
@@ -2198,19 +2207,19 @@ e.id&&(h=this.parseAESDrmTag_(l,a,c,d)):"EXT-X-BYTERANGE"==l.name&&l.id<e.id&&(k
|
|
|
2198
2207
|
shaka.hls.HlsParser.prototype.createInitSegmentReference_=function(a,b,c,d){var e=0,f=null;b=b.getAttributeValue("BYTERANGE");!b&&c&&(b=c.value);b&&(e=b.split("@"),f=Number(e[0]),e=Number(e[1]),f=e+f-1,d&&(c=f+1-e,c%16&&(f+=16-c%16)));return new shaka.media.InitSegmentReference(function(){return a},e,f,null,null,null,d)};
|
|
2199
2208
|
shaka.hls.HlsParser.prototype.createSegmentReference_=function(a,b,c,d,e,f,g,h,k){var l=c.tags,m=shaka.hls.Utils.getFirstTagWithName(l,"EXTINF"),n=0;f=0;var p=null;c.partialSegments.length&&!this.lowLatencyMode_&&shaka.log.alwaysWarn("Low-latency HLS live stream detected, but low-latency streaming mode is not enabled in Shaka Player. Set streaming.lowLatencyMode configuration to true, and see https://bit.ly/3clctcj for details.");var q=null;if(!this.config_.hls.ignoreManifestProgramDateTime){var r=
|
|
2200
2209
|
shaka.hls.Utils.getFirstTagWithName(l,"EXT-X-PROGRAM-DATE-TIME");r&&r.value&&(q=shaka.util.TXml.parseDate(r.value),goog.asserts.assert(null!=q,"EXT-X-PROGRAM-DATE-TIME format not valid"))}var v=shaka.media.SegmentReference.Status.AVAILABLE;shaka.hls.Utils.getFirstTagWithName(l,"EXT-X-GAP")&&(v=shaka.media.SegmentReference.Status.MISSING);if(!m){if(0==c.partialSegments.length)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.HLS_REQUIRED_TAG_MISSING,
|
|
2201
|
-
"EXTINF");if(!this.lowLatencyMode_)return null}var x=[];r=!1;var w=null,t=!1,y=!1;if(this.lowLatencyMode_&&c.partialSegments.length){n=("video/mp4"==g.mimeType||"audio/mp4"==g.mimeType)&&window.ReadableStream&&this.config_.hls.allowLowLatencyByteRangeOptimization;for(var u=q,z={},A=0;A<c.partialSegments.length;z={$jscomp$loop$prop$uris$
|
|
2202
|
-
D=Number(B.getAttributeValue("DURATION"))||this.partialTargetDuration_;if(D){var G=F+D,H=0,E=null;"EXT-X-PRELOAD-HINT"==B.name?(H=(H=B.getAttributeValue("BYTERANGE-START"))?Number(H):0,(C=B.getAttributeValue("BYTERANGE-LENGTH"))?E=H+Number(C)-1:H&&(E=Number.MAX_SAFE_INTEGER)):(H=B.getAttributeValue("BYTERANGE"),E=$jscomp.makeIterator(this.parseByteRange_(C,H)),H=E.next().value,E=E.next().value);z.$jscomp$loop$prop$pUri$
|
|
2203
|
-
"YES"==B.getAttributeValue("GAP")&&(C=shaka.media.SegmentReference.Status.MISSING,t=!0);z.$jscomp$loop$prop$uris$
|
|
2210
|
+
"EXTINF");if(!this.lowLatencyMode_)return null}var x=[];r=!1;var w=null,t=!1,y=!1;if(this.lowLatencyMode_&&c.partialSegments.length){n=("video/mp4"==g.mimeType||"audio/mp4"==g.mimeType)&&window.ReadableStream&&this.config_.hls.allowLowLatencyByteRangeOptimization;for(var u=q,z={},A=0;A<c.partialSegments.length;z={$jscomp$loop$prop$uris$799$964:z.$jscomp$loop$prop$uris$799$964,$jscomp$loop$prop$pUri$965:z.$jscomp$loop$prop$pUri$965},A++){var B=c.partialSegments[A],C=0==A?b:x[x.length-1],F=0==A?d:C.endTime,
|
|
2211
|
+
D=Number(B.getAttributeValue("DURATION"))||this.partialTargetDuration_;if(D){var G=F+D,H=0,E=null;"EXT-X-PRELOAD-HINT"==B.name?(H=(H=B.getAttributeValue("BYTERANGE-START"))?Number(H):0,(C=B.getAttributeValue("BYTERANGE-LENGTH"))?E=H+Number(C)-1:H&&(E=Number.MAX_SAFE_INTEGER)):(H=B.getAttributeValue("BYTERANGE"),E=$jscomp.makeIterator(this.parseByteRange_(C,H)),H=E.next().value,E=E.next().value);z.$jscomp$loop$prop$pUri$965=B.getAttributeValue("URI");if(z.$jscomp$loop$prop$pUri$965){C=shaka.media.SegmentReference.Status.AVAILABLE;
|
|
2212
|
+
"YES"==B.getAttributeValue("GAP")&&(C=shaka.media.SegmentReference.Status.MISSING,t=!0);z.$jscomp$loop$prop$uris$799$964=null;var I=function(J){return function(){null==J.$jscomp$loop$prop$uris$799$964&&(goog.asserts.assert(J.$jscomp$loop$prop$pUri$965,"Partial uri should be defined!"),J.$jscomp$loop$prop$uris$799$964=shaka.hls.Utils.constructSegmentUris(h(),J.$jscomp$loop$prop$pUri$965,e));return J.$jscomp$loop$prop$uris$799$964}}(z);n&&0<=H&&null!=E&&(w=I,r=!0);F=new shaka.media.SegmentReference(F,
|
|
2204
2213
|
G,I,H,E,a,0,0,Infinity,[],"",null,u,C,k);"EXT-X-PRELOAD-HINT"==B.name&&(F.markAsPreload(),y=!0);"YES"!=B.getAttributeValue("INDEPENDENT")&&0<A&&F.markAsNonIndependent();x.push(F);u&&(u+=D)}}}}if(m){m=m.value.split(",");m=Number(m[0]);if(0==m)return null;n=d+m}else if(x.length)n=x[x.length-1].endTime;else return null;r&&(t||0!=x[0].startByte?(r=!1,w=null):x=[]);(t=shaka.hls.Utils.getFirstTagWithName(l,"EXT-X-BYTERANGE"))?(p=$jscomp.makeIterator(this.parseByteRange_(b,t.value)),f=p.next().value,p=p.next().value):
|
|
2205
2214
|
x.length&&(f=x[0].startByte,p=x[x.length-1].endByte);b="";t=null;g.type==shaka.util.ManifestParserUtils.ContentType.IMAGE&&(b="1x1",g=shaka.hls.Utils.getFirstTagWithName(l,"EXT-X-TILES"))&&(b=g.getRequiredAttrValue("LAYOUT"),(g=g.getAttributeValue("DURATION"))&&(t=Number(g)));var K=null;a=new shaka.media.SegmentReference(d,n,function(){if(w)return w();null==K&&(K=shaka.hls.Utils.constructSegmentUris(h(),c.verbatimSegmentUri,e));return K||[]},f,p,a,0,0,Infinity,x,b,t,q,v,k,0<x.length&&!!c.verbatimSegmentUri);
|
|
2206
2215
|
r&&(this.lowLatencyByterangeOptimization_=!0,a.markAsByterangeOptimization(),y&&a.markAsPreload());return a};shaka.hls.HlsParser.prototype.parseByteRange_=function(a,b){var c=0,d=null;b&&(c=b.split("@"),b=Number(c[0]),c[1]?c=Number(c[1]):(goog.asserts.assert(a,"Cannot refer back to previous HLS segment!"),c=a.endByte+1),d=c+b-1);return[c,d]};
|
|
2207
2216
|
shaka.hls.HlsParser.prototype.createSegments_=function(a,b,c,d,e,f){var g=a.segments;goog.asserts.assert(g.length,"Playlist should have segments!");var h=void 0,k=shaka.hls.Utils.getFirstTagWithNameAsNumber(a.tags,"EXT-X-DISCONTINUITY-SEQUENCE",0),l=shaka.hls.Utils.getFirstTagWithNameAsNumber(a.tags,"EXT-X-MEDIA-SEQUENCE",0),m=shaka.hls.Utils.getFirstTagWithName(a.tags,"EXT-X-SKIP"),n=m?Number(m.getAttributeValue("SKIPPED-SEGMENTS")):0,p=l+n,q=0;this.isLive_()&&c.has(p)&&(q=c.get(p));0===q&&this.presentationType_==
|
|
2208
2217
|
shaka.hls.HlsParser.PresentationType_.LIVE&&0<c.size&&!c.has(p)&&(q=this.presentationTimeline_.getSegmentAvailabilityStart());var r=[],v=null;m=[];for(var x=0;x<g.length;x++){var w=g[x],t=0==x?q:v.endTime;p=l+n+x;shaka.hls.Utils.getFirstTagWithName(w.tags,"EXT-X-DISCONTINUITY")&&k++;var y=$jscomp.makeIterator(w.tags);for(var u=y.next();!u.done;u=y.next())u=u.value,"EXT-X-KEY"==u.name&&(h=this.isAesMethod_(u.getRequiredAttrValue("METHOD"))?this.parseAESDrmTag_(u,a,e,d):void 0);c.set(p,t);y=this.getInitSegmentReference_(a,
|
|
2209
2218
|
w.tags,e,d);!this.lowLatencyMode_&&this.playerInterface_.isAutoLowLatencyMode()&&(this.playerInterface_.enableLowLatencyMode(),this.lowLatencyMode_=this.playerInterface_.isLowLatencyMode());if(t=this.createSegmentReference_(y,v,w,t,d,a,b,e,h))(v=shaka.hls.Utils.getFirstTagWithNameAsNumber(w.tags,"EXT-X-BITRATE"))?m.push({bitrate:v,duration:t.endTime-t.startTime}):m.length&&(v=m.pop(),v.duration+=t.endTime-t.startTime,m.push(v)),v=t,t.discontinuitySequence=k,this.ignoreManifestProgramDateTimeFor_(f)&&
|
|
2210
|
-
null!=this.minSequenceNumber_&&p<this.minSequenceNumber_||r.push(t)}a=void 0;m.length&&(a=m.reduce(function(z,A){return z+A.duration},0),a=Math.round(m.reduce(function(z,A){return z+A.bitrate*A.duration},0)/a*1E3));if(m=r.some(function(z){return null!=z.syncTime}))for(b={},c=0;c<r.length;b={$jscomp$loop$prop$forwardI$
|
|
2211
|
-
$jscomp$loop$prop$backwardAdd$
|
|
2212
|
-
b.$jscomp$loop$prop$backwardAdd$
|
|
2213
|
-
(b.$jscomp$loop$prop$reference$
|
|
2219
|
+
null!=this.minSequenceNumber_&&p<this.minSequenceNumber_||r.push(t)}a=void 0;m.length&&(a=m.reduce(function(z,A){return z+A.duration},0),a=Math.round(m.reduce(function(z,A){return z+A.bitrate*A.duration},0)/a*1E3));if(m=r.some(function(z){return null!=z.syncTime}))for(b={},c=0;c<r.length;b={$jscomp$loop$prop$forwardI$967:b.$jscomp$loop$prop$forwardI$967,$jscomp$loop$prop$forwardAdd$968:b.$jscomp$loop$prop$forwardAdd$968,$jscomp$loop$prop$backwardI$969:b.$jscomp$loop$prop$backwardI$969,$jscomp$loop$prop$reference$802$970:b.$jscomp$loop$prop$reference$802$970,
|
|
2220
|
+
$jscomp$loop$prop$backwardAdd$971:b.$jscomp$loop$prop$backwardAdd$971},c++)if(b.$jscomp$loop$prop$reference$802$970=r[c],null==b.$jscomp$loop$prop$reference$802$970.syncTime)for(b.$jscomp$loop$prop$forwardAdd$968=0,b.$jscomp$loop$prop$forwardI$967=c,d=function(z){return function(){var A=r[z.$jscomp$loop$prop$forwardI$967];if(A){if(null!=A.syncTime)return A.syncTime+z.$jscomp$loop$prop$forwardAdd$968;z.$jscomp$loop$prop$forwardAdd$968-=A.endTime-A.startTime;z.$jscomp$loop$prop$forwardI$967+=1}return null}}(b),
|
|
2221
|
+
b.$jscomp$loop$prop$backwardAdd$971=0,b.$jscomp$loop$prop$backwardI$969=c,e=function(z){return function(){var A=r[z.$jscomp$loop$prop$backwardI$969];if(A){A!=z.$jscomp$loop$prop$reference$802$970&&(z.$jscomp$loop$prop$backwardAdd$971+=A.endTime-A.startTime);if(null!=A.syncTime)return A.syncTime+z.$jscomp$loop$prop$backwardAdd$971;--z.$jscomp$loop$prop$backwardI$969}return null}}(b);null==b.$jscomp$loop$prop$reference$802$970.syncTime;)b.$jscomp$loop$prop$reference$802$970.syncTime=e(),null==b.$jscomp$loop$prop$reference$802$970.syncTime&&
|
|
2222
|
+
(b.$jscomp$loop$prop$reference$802$970.syncTime=d());if(m)for(b=$jscomp.makeIterator(r),c=b.next();!c.done;c=b.next())for(d=c.value,c=d.syncTime,d=$jscomp.makeIterator(d.partialReferences),e=d.next();!e.done;e=d.next())e=e.value,e.syncTime=c,c+=e.endTime-e.startTime;b=this.lowestSyncTime_;if(m&&Infinity!=b&&!this.ignoreManifestProgramDateTimeFor_(f))for(f=$jscomp.makeIterator(r),c=f.next();!c.done;c=f.next())c.value.syncAgainst(b);return{segments:r,bandwidth:a}};
|
|
2214
2223
|
shaka.hls.HlsParser.prototype.guessMimeTypeBeforeLoading_=function(a,b){if(a==shaka.util.ManifestParserUtils.ContentType.TEXT){if("vtt"==b||"wvtt"==b)return"text/vtt";if(b&&""!==b)return"application/mp4"}return a!=shaka.util.ManifestParserUtils.ContentType.IMAGE||b&&"jpeg"!=b?a==shaka.util.ManifestParserUtils.ContentType.AUDIO&&"mp4a.40.34"==b?"audio/mpeg":"mjpg"==b?"application/mp4":null:"image/jpeg"};
|
|
2215
2224
|
shaka.hls.HlsParser.prototype.guessMimeTypeFallback_=function(a){return a==shaka.util.ManifestParserUtils.ContentType.TEXT?"text/vtt":shaka.hls.HlsParser.EXTENSION_MAP_BY_CONTENT_TYPE_[a].mp4};
|
|
2216
2225
|
shaka.hls.HlsParser.prototype.guessMimeType_=function(a,b,c,d,e){var f=this,g,h,k,l,m,n,p,q,r,v,x,w,t,y;return $jscomp.asyncExecutePromiseGeneratorProgram(function(u){switch(u.nextAddress){case 1:g=shaka.hls.HlsParser;h=shaka.net.NetworkingEngine.RequestType.SEGMENT;goog.asserts.assert(c.segments.length,"Playlist should have segments!");k=Math.trunc((c.segments.length-1)/2);l=shaka.hls.Utils.constructSegmentUris(e(),c.segments[k].verbatimSegmentUri,d);m=new goog.Uri(l[0]);n=m.getPath().split(".").pop();
|
|
@@ -2297,8 +2306,8 @@ shaka.mss.MssParser.prototype.update=function(){var a=this,b;return $jscomp.asyn
|
|
|
2297
2306
|
shaka.mss.MssParser.prototype.onInitialVariantChosen=function(a){};shaka.mss.MssParser.prototype.banLocation=function(a){};
|
|
2298
2307
|
shaka.mss.MssParser.prototype.requestManifest_=function(){var a=this,b,c,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress)return b=shaka.net.NetworkingEngine.RequestType.MANIFEST,c=shaka.net.NetworkingEngine.AdvancedRequestType.MSS,d=shaka.net.NetworkingEngine.makeRequest(a.manifestUris_,a.config_.retryParameters),e=a.playerInterface_.networkingEngine,f=Date.now(),g=e.request(b,d,{type:c}),a.operationManager_.manage(g),m.yield(g.promise,2);h=m.yieldResult;
|
|
2299
2308
|
if(!a.playerInterface_)return m.return();h.uri&&!a.manifestUris_.includes(h.uri)&&a.manifestUris_.unshift(h.uri);a.parseManifest_(h.data,h.uri);k=Date.now();l=(k-f)/1E3;a.averageUpdateDuration_.sample(1,l);m.jumpToEnd()})};
|
|
2300
|
-
shaka.mss.MssParser.prototype.parseManifest_=function(a,b){var c=a;
|
|
2301
|
-
shaka.util.TXml.parseXml(c,"SmoothStreamingMedia");if(!a)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.MSS_INVALID_XML,b);
|
|
2309
|
+
shaka.mss.MssParser.prototype.parseManifest_=function(a,b){var c=a;a=this.config_.mss.manifestPreprocessor;if(a!=shaka.util.PlayerConfiguration.defaultManifestPreprocessor){shaka.Deprecate.deprecateFeature(5,"manifest.mss.manifestPreprocessor configuration","Please Use manifest.mss.manifestPreprocessorTXml instead.");c=shaka.util.XmlUtils.parseXml(c,"SmoothStreamingMedia");if(!c)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.MSS_INVALID_XML,
|
|
2310
|
+
b);a(c);c=shaka.util.XmlUtils.toArrayBuffer(c)}a=shaka.util.TXml.parseXml(c,"SmoothStreamingMedia");if(!a)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.MSS_INVALID_XML,b);c=this.config_.mss.manifestPreprocessorTXml;c!=shaka.util.PlayerConfiguration.defaultManifestPreprocessorTXml&&c(a);this.processManifest_(a,b);return Promise.resolve()};
|
|
2302
2311
|
shaka.mss.MssParser.prototype.processManifest_=function(a,b){var c=shaka.util.TXml;this.presentationTimeline_||(this.presentationTimeline_=new shaka.media.PresentationTimeline(null,0));if(b=c.parseAttr(a,"IsLive",c.parseBoolean,!1))throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.MANIFEST,shaka.util.Error.Code.MSS_LIVE_CONTENT_NOT_SUPPORTED);this.presentationTimeline_.setStatic(!b);var d=c.parseAttr(a,"TimeScale",c.parseNonNegativeInt,shaka.mss.MssParser.DEFAULT_TIME_SCALE_);
|
|
2303
2312
|
goog.asserts.assert(d&&0<=d,"Timescale must be defined!");var e=c.parseAttr(a,"DVRWindowLength",c.parseNonNegativeInt);b&&(0===e||isNaN(e))&&(e=Infinity);var f=c.parseAttr(a,"CanSeek",c.parseBoolean,!1);0===e&&f&&(e=Infinity);f=null;e&&0<e&&(f=e/d);b&&!isNaN(this.config_.availabilityWindowOverride)&&(f=this.config_.availabilityWindowOverride);null==f&&(f=Infinity);this.presentationTimeline_.setSegmentAvailabilityDuration(f);c=c.parseAttr(a,"Duration",c.parseNonNegativeInt,Infinity);goog.asserts.assert(c&&
|
|
2304
2313
|
0<=c,"Duration must be defined!");b||this.presentationTimeline_.setDuration(c/d);b={variants:[],textStreams:[],timescale:d,duration:c/d};this.parseStreamIndexes_(a,b);this.manifest_?(this.manifest_.variants=b.variants,this.manifest_.textStreams=b.textStreams,this.playerInterface_.filter(this.manifest_)):(this.manifest_={presentationTimeline:this.presentationTimeline_,variants:b.variants,textStreams:b.textStreams,imageStreams:[],offlineSessionIds:[],minBufferTime:0,sequenceMode:this.config_.mss.sequenceMode,
|
|
@@ -2314,8 +2323,8 @@ l,d,t);t.mssPrivateData.codecPrivateData=k;switch(l){case "audio":if(!k)return s
|
|
|
2314
2323
|
videoConfig:new Uint8Array([]),hSpacing:0,vSpacing:0,data:null,stream:t},y=(new shaka.util.Mp4Generator([y])).initSegment(),f.initSegmentDataByStreamId_.set(t.id,y);y=new shaka.media.InitSegmentReference(function(){return[]},0,null,null,void 0,y);y=f.createSegments_(y,t,a,c);t.segmentIndex=new shaka.media.SegmentIndex(y);return Promise.resolve()};t.closeSegmentIndex=function(){t.segmentIndex&&(t.segmentIndex.release(),t.segmentIndex=null)};return t};
|
|
2315
2324
|
shaka.mss.MssParser.prototype.getCodecPrivateData_=function(a,b,c,d){if(a=a.attributes.CodecPrivateData)return a;if("audio"!==b)return null;b=d.channelsCount||2;a=d.audioSamplingRate||44100;var e={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12};d=e[a];if("AACH"===c)return c=new Uint8Array(4),a=e[2*a],c[0]=40|d>>1,c[1]=d<<7|b<<3|a>>1,c[2]=a<<7|8,c[3]=0,b=new Uint16Array(2),b[0]=(c[0]<<8)+c[1],b[1]=(c[2]<<8)+c[3],b[0].toString(16)+b[1].toString(16);
|
|
2316
2325
|
c=new Uint8Array(2);c[0]=16|d>>1;c[1]=d<<7|b<<3;b=new Uint16Array(1);b[0]=(c[0]<<8)+c[1];return b[0].toString(16)};shaka.mss.MssParser.prototype.getAACCodec_=function(a,b,c){a=0;"AACH"===b&&(a=5);c?0===a&&(a=(parseInt(c.substr(0,2),16)&248)>>3):(a=2,"AACH"===b&&(a=5));return"mp4a.40."+a};shaka.mss.MssParser.prototype.getH264Codec_=function(a,b){a=/00000001[0-9]7/.exec(b);return a.length&&b?"avc1."+b.substr(b.indexOf(a[0])+10,6):""};
|
|
2317
|
-
shaka.mss.MssParser.prototype.createSegments_=function(a,b,c,d){var e=this,f=shaka.util.ManifestParserUtils;c=c.attributes.Url;goog.asserts.assert(c,"Missing URL for segments");var g=c.replace("{bitrate}",String(b.bandwidth));c=[];var h={};d=$jscomp.makeIterator(d);for(var k=d.next();!k.done;h={$jscomp$loop$prop$time$
|
|
2318
|
-
c.push(new shaka.media.SegmentReference(h.$jscomp$loop$prop$time$
|
|
2326
|
+
shaka.mss.MssParser.prototype.createSegments_=function(a,b,c,d){var e=this,f=shaka.util.ManifestParserUtils;c=c.attributes.Url;goog.asserts.assert(c,"Missing URL for segments");var g=c.replace("{bitrate}",String(b.bandwidth));c=[];var h={};d=$jscomp.makeIterator(d);for(var k=d.next();!k.done;h={$jscomp$loop$prop$time$973:h.$jscomp$loop$prop$time$973},k=d.next())h.$jscomp$loop$prop$time$973=k.value,k=function(l){return function(){return f.resolveUris(e.manifestUris_,[g.replace("{start time}",String(l.$jscomp$loop$prop$time$973.unscaledStart))])}}(h),
|
|
2327
|
+
c.push(new shaka.media.SegmentReference(h.$jscomp$loop$prop$time$973.start,h.$jscomp$loop$prop$time$973.end,k,0,null,a,0,0,b.mssPrivateData.duration));return c};
|
|
2319
2328
|
shaka.mss.MssParser.prototype.createTimeline_=function(a,b,c){goog.asserts.assert(0<b&&Infinity>b,"timescale must be a positive, finite integer");goog.asserts.assert(0<c,"duration must be a positive integer");var d=shaka.util.TXml;a=d.findChildren(a,"c");for(var e=[],f=0,g=0;g<a.length;++g){var h=a[g],k=a[g+1],l=d.parseAttr(h,"t",d.parseNonNegativeInt),m=d.parseAttr(h,"d",d.parseNonNegativeInt),n=d.parseAttr(h,"r",d.parseInt);if(!m){shaka.log.warning('"c" element must have a duration:','ignoring the remaining "c" elements.',
|
|
2320
2329
|
h);break}l=null!=l?l:f;n=n||0;if(0>n)if(k){k=d.parseAttr(k,"t",d.parseNonNegativeInt);if(null==k){shaka.log.warning('An "c" element cannot have a negative repeat','if the next "c" element does not have a valid start time:','ignoring the remaining "c" elements.',h);break}else if(l>=k){shaka.log.warning('An "c" element cannot have a negative repeatif its start ','time exceeds the next "c" element\'s start time:','ignoring the remaining "c" elements.',h);break}n=Math.ceil((k-l)/m)-1}else{if(Infinity==
|
|
2321
2330
|
c){shaka.log.warning('The last "c" element cannot have a negative repeat',"if the Period has an infinite duration:",'ignoring the last "c" element.',h);break}else if(l/b>=c){shaka.log.warning('The last "c" element cannot have a negative repeat',"if its start time exceeds the duration:",'igoring the last "c" element.',h);break}n=Math.ceil((c*b-l)/m)-1}for(h=0;h<=n;++h)f=l+m,e.push({start:l/b,end:f/b,unscaledStart:l}),l=f}return e};
|
|
@@ -2354,10 +2363,10 @@ shaka.offline.indexeddb.BaseStorageCell.prototype.getManifests=function(a){var b
|
|
|
2354
2363
|
shaka.offline.indexeddb.BaseStorageCell.prototype.getAllManifests=function(){var a=this,b,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){return 1==d.nextAddress?(b=a.connection_.startReadOnlyOperation(a.manifestStore_),c=new Map,d.yield(b.forEachEntry(function(e,f){var g;return $jscomp.asyncExecutePromiseGeneratorProgram(function(h){if(1==h.nextAddress)return h.yield(a.convertManifest(f),2);g=h.yieldResult;c.set(e,g);h.jumpToEnd()})}),2)):3!=d.nextAddress?d.yield(b.promise(),3):
|
|
2355
2364
|
d.return(c)})};shaka.offline.indexeddb.BaseStorageCell.prototype.convertSegmentData=function(a){return a};shaka.offline.indexeddb.BaseStorageCell.prototype.convertManifest=function(a){return Promise.resolve(a)};shaka.offline.indexeddb.BaseStorageCell.prototype.rejectAdd=function(a){return Promise.reject(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.STORAGE,shaka.util.Error.Code.NEW_KEY_OPERATION_NOT_SUPPORTED,"Cannot add new value to "+a))};
|
|
2356
2365
|
shaka.offline.indexeddb.BaseStorageCell.prototype.rejectUpdate=function(a){return Promise.reject(new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.STORAGE,shaka.util.Error.Code.MODIFY_OPERATION_NOT_SUPPORTED,"Cannot modify values in "+a))};
|
|
2357
|
-
shaka.offline.indexeddb.BaseStorageCell.prototype.add=function(a,b){var c=this,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress){d=c.connection_.startReadWriteOperation(a);e=d.store();f=[];g={};h=$jscomp.makeIterator(b);for(k=h.next();!k.done;g={$jscomp$loop$prop$request$
|
|
2358
|
-
return m.yield(d.promise(),2)}return m.return(f)})};shaka.offline.indexeddb.BaseStorageCell.prototype.remove_=function(a,b,c){a=this.connection_.startReadWriteOperation(a);var d=a.store(),e={};b=$jscomp.makeIterator(b);for(var f=b.next();!f.done;e={$jscomp$loop$prop$key$
|
|
2359
|
-
shaka.offline.indexeddb.BaseStorageCell.prototype.get_=function(a,b){var c=this,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress){d=c.connection_.startReadOnlyOperation(a);e=d.store();f={};g=[];h={};k=$jscomp.makeIterator(b);for(l=k.next();!l.done;h={$jscomp$loop$prop$request$
|
|
2360
|
-
h.$jscomp$loop$prop$request$
|
|
2366
|
+
shaka.offline.indexeddb.BaseStorageCell.prototype.add=function(a,b){var c=this,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress){d=c.connection_.startReadWriteOperation(a);e=d.store();f=[];g={};h=$jscomp.makeIterator(b);for(k=h.next();!k.done;g={$jscomp$loop$prop$request$975:g.$jscomp$loop$prop$request$975},k=h.next())l=k.value,g.$jscomp$loop$prop$request$975=e.add(l),g.$jscomp$loop$prop$request$975.onsuccess=function(n){return function(p){f.push(n.$jscomp$loop$prop$request$975.result)}}(g);
|
|
2367
|
+
return m.yield(d.promise(),2)}return m.return(f)})};shaka.offline.indexeddb.BaseStorageCell.prototype.remove_=function(a,b,c){a=this.connection_.startReadWriteOperation(a);var d=a.store(),e={};b=$jscomp.makeIterator(b);for(var f=b.next();!f.done;e={$jscomp$loop$prop$key$977:e.$jscomp$loop$prop$key$977},f=b.next())e.$jscomp$loop$prop$key$977=f.value,d.delete(e.$jscomp$loop$prop$key$977).onsuccess=function(g){return function(){return c(g.$jscomp$loop$prop$key$977)}}(e);return a.promise()};
|
|
2368
|
+
shaka.offline.indexeddb.BaseStorageCell.prototype.get_=function(a,b){var c=this,d,e,f,g,h,k,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(m){if(1==m.nextAddress){d=c.connection_.startReadOnlyOperation(a);e=d.store();f={};g=[];h={};k=$jscomp.makeIterator(b);for(l=k.next();!l.done;h={$jscomp$loop$prop$request$979:h.$jscomp$loop$prop$request$979,$jscomp$loop$prop$key$980:h.$jscomp$loop$prop$key$980},l=k.next())h.$jscomp$loop$prop$key$980=l.value,h.$jscomp$loop$prop$request$979=e.get(h.$jscomp$loop$prop$key$980),
|
|
2369
|
+
h.$jscomp$loop$prop$request$979.onsuccess=function(n){return function(){void 0==n.$jscomp$loop$prop$request$979.result&&g.push(n.$jscomp$loop$prop$key$980);f[n.$jscomp$loop$prop$key$980]=n.$jscomp$loop$prop$request$979.result}}(h);return m.yield(d.promise(),2)}if(g.length)throw new shaka.util.Error(shaka.util.Error.Severity.CRITICAL,shaka.util.Error.Category.STORAGE,shaka.util.Error.Code.KEY_NOT_FOUND,"Could not find values for "+g);return m.return(b.map(function(n){return f[n]}))})};shaka.offline.indexeddb.EmeSessionStorageCell=function(a,b){this.connection_=new shaka.offline.indexeddb.DBConnection(a);this.store_=b};shaka.offline.indexeddb.EmeSessionStorageCell.prototype.destroy=function(){return this.connection_.destroy()};
|
|
2361
2370
|
shaka.offline.indexeddb.EmeSessionStorageCell.prototype.getAll=function(){var a=this,b,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){return 1==d.nextAddress?(b=a.connection_.startReadOnlyOperation(a.store_),c=[],d.yield(b.forEachEntry(function(e,f){c.push(f)}),2)):3!=d.nextAddress?d.yield(b.promise(),3):d.return(c)})};
|
|
2362
2371
|
shaka.offline.indexeddb.EmeSessionStorageCell.prototype.add=function(a){var b=this.connection_.startReadWriteOperation(this.store_),c=b.store();a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())c.add(d.value);return b.promise()};
|
|
2363
2372
|
shaka.offline.indexeddb.EmeSessionStorageCell.prototype.remove=function(a){var b=this,c;return $jscomp.asyncExecutePromiseGeneratorProgram(function(d){return 1==d.nextAddress?(c=b.connection_.startReadWriteOperation(b.store_),d.yield(c.forEachEntry(function(e,f,g){a.includes(f.sessionId)&&g.delete()}),2)):d.yield(c.promise(),0)})};shaka.offline.StorageCellHandle={};shaka.offline.StorageCellPath={};shaka.offline.StorageMuxer=function(){this.mechanisms_=new Map};shaka.offline.StorageMuxer.prototype.destroy=function(){for(var a=[],b=$jscomp.makeIterator(this.mechanisms_.values()),c=b.next();!c.done;c=b.next())a.push(c.value.destroy());this.mechanisms_.clear();return Promise.all(a)};
|
|
@@ -2443,9 +2452,9 @@ shaka.offline.Storage.prototype.store_=function(a,b,c,d,e){var f=this,g,h,k,l,m,
|
|
|
2443
2452
|
shaka.util.Error.Category.STORAGE,shaka.util.Error.Code.CANNOT_STORE_LIVE_OFFLINE,a);return u.yield(f.createDrmEngine(p,function(z){n=n||z},d),7);case 7:h=u.yieldResult;f.ensureNotDestroyed_();if(n)throw n;return u.yield(f.filterManifest_(p,h,d),8);case 8:return u.yield(k.init(),9);case 9:return f.ensureNotDestroyed_(),u.yield(k.getActive(),10);case 10:return l=u.yieldResult,f.ensureNotDestroyed_(),goog.asserts.assert(h,"drmEngine should be non-null here."),r=f.makeManifestDB_(h,p,a,b,d,e),v=r.manifestDB,
|
|
2444
2453
|
x=r.toDownload,u.yield(l.cell.addManifests([v]),11);case 11:w=u.yieldResult;f.ensureNotDestroyed_();m=w[0];goog.asserts.assert(h,"drmEngine should be non-null here.");f.ensureNotDestroyed_();if(n)throw n;return u.yield(f.downloadSegments_(x,m,v,e,d,l.cell,p,h),12);case 12:return f.ensureNotDestroyed_(),f.setManifestDrmFields_(p,v,h,d),u.yield(l.cell.updateManifest(m,v),13);case 13:return f.ensureNotDestroyed_(),t=shaka.offline.OfflineUri.manifest(l.path.mechanism,l.path.cell,m),u.return(shaka.offline.StoredContentUtils.fromManifestDB(t,
|
|
2445
2454
|
v));case 3:return u.enterFinallyBlock(),u.yield(k.destroy(),14);case 14:if(!g){u.jumpTo(15);break}return u.yield(g.stop(),15);case 15:if(!h){u.jumpTo(17);break}return u.yield(h.destroy(),17);case 17:u.leaveFinallyBlock(0);break;case 2:y=u.enterCatchBlock();if(null==m){u.jumpTo(19);break}return u.yield(shaka.offline.Storage.cleanStoredManifest(m),19);case 19:throw n||y;}})};
|
|
2446
|
-
shaka.offline.Storage.prototype.downloadSegments_=function(a,b,c,d,e,f,g,h){var k=this,l,m,n,p,q,r,v,x,w,t;return $jscomp.asyncExecutePromiseGeneratorProgram(function(y){switch(y.nextAddress){case 1:l={};m=0;n=function(u,z){var A,B,C,F,D,G,H;return $jscomp.asyncExecutePromiseGeneratorProgram(function(E){if(1==E.nextAddress){A={};B=$jscomp.makeIterator(u);for(C=B.next();!C.done;A={$jscomp$loop$prop$download$
|
|
2447
|
-
C.value,F=A.$jscomp$loop$prop$download$
|
|
2448
|
-
d.queue(A.$jscomp$loop$prop$download$
|
|
2455
|
+
shaka.offline.Storage.prototype.downloadSegments_=function(a,b,c,d,e,f,g,h){var k=this,l,m,n,p,q,r,v,x,w,t;return $jscomp.asyncExecutePromiseGeneratorProgram(function(y){switch(y.nextAddress){case 1:l={};m=0;n=function(u,z){var A,B,C,F,D,G,H;return $jscomp.asyncExecutePromiseGeneratorProgram(function(E){if(1==E.nextAddress){A={};B=$jscomp.makeIterator(u);for(C=B.next();!C.done;A={$jscomp$loop$prop$download$832$982:A.$jscomp$loop$prop$download$832$982},C=B.next())A.$jscomp$loop$prop$download$832$982=
|
|
2456
|
+
C.value,F=A.$jscomp$loop$prop$download$832$982.makeSegmentRequest(e),D=A.$jscomp$loop$prop$download$832$982.estimateId,G=A.$jscomp$loop$prop$download$832$982.isInitSegment,H=function(I){return function(K){var J,M,L;return $jscomp.asyncExecutePromiseGeneratorProgram(function(O){if(1==O.nextAddress)return O.yield(f.addSegments([{data:K}]),2);J=O.yieldResult;k.ensureNotDestroyed_();M=I.$jscomp$loop$prop$download$832$982.ref;L=shaka.offline.DownloadInfo.idForSegmentRef(M);l[L]=J[0];m+=K.byteLength;O.jumpToEnd()})}}(A),
|
|
2457
|
+
d.queue(A.$jscomp$loop$prop$download$832$982.groupId,F,D,G,H);return E.yield(d.waitToFinish(),2)}if(!z)return E.jumpTo(0);k.ensureNotDestroyed_();k.setManifestDrmFields_(g,c,h,e);return E.yield(f.updateManifest(b,c),0)})};p=!1;y.setCatchFinallyBlocks(2);if(!k.getManifestIsEncrypted_(g)||!p||k.getManifestIncludesInitData_(g)){y.jumpTo(4);break}return y.yield(n(a.filter(function(u){return u.isInitSegment}),!0),5);case 5:return k.ensureNotDestroyed_(),a=a.filter(function(u){return!u.isInitSegment}),
|
|
2449
2458
|
q=l,r=m,l={},m=0,y.yield(shaka.offline.Storage.assignSegmentsToManifest(f,b,c,q,r,function(){return k.ensureNotDestroyed_()}),6);case 6:k.ensureNotDestroyed_();case 4:if(p){y.jumpTo(7);break}return y.yield(n(a,!1),8);case 8:return k.ensureNotDestroyed_(),v=l,x=m,l={},m=0,y.yield(shaka.offline.Storage.assignSegmentsToManifest(f,b,c,v,x,function(){return k.ensureNotDestroyed_()}),9);case 9:k.ensureNotDestroyed_(),goog.asserts.assert(!c.isIncomplete,"The manifest should be complete by now");case 7:y.leaveTryBlock(0);
|
|
2450
2459
|
break;case 2:return w=y.enterCatchBlock(),t=Object.values(l),y.yield(f.removeSegments(t,function(u){}),10);case 10:throw w;}})};
|
|
2451
2460
|
shaka.offline.Storage.cleanStoredManifest=function(a){var b,c,d,e;return $jscomp.asyncExecutePromiseGeneratorProgram(function(f){switch(f.nextAddress){case 1:return b=new shaka.offline.StorageMuxer,f.yield(b.init(),2);case 2:return f.yield(b.getActive(),3);case 3:return c=f.yieldResult,d=shaka.offline.OfflineUri.manifest(c.path.mechanism,c.path.cell,a),f.yield(b.destroy(),4);case 4:return e=new shaka.offline.Storage,f.yield(e.remove(d.toString()),0)}})};
|
|
@@ -2705,8 +2714,8 @@ shaka.text.SrtTextParser.convertSrtCue_=function(a){a=a.split(/\n/);a[0].match(/
|
|
|
2705
2714
|
goog.exportProperty(shaka.text.SrtTextParser.prototype,"parseMedia",shaka.text.SrtTextParser.prototype.parseMedia);goog.exportProperty(shaka.text.SrtTextParser.prototype,"setManifestType",shaka.text.SrtTextParser.prototype.setManifestType);goog.exportProperty(shaka.text.SrtTextParser.prototype,"setSequenceMode",shaka.text.SrtTextParser.prototype.setSequenceMode);goog.exportProperty(shaka.text.SrtTextParser.prototype,"parseInit",shaka.text.SrtTextParser.prototype.parseInit);
|
|
2706
2715
|
shaka.text.TextEngine.registerParser("text/srt",function(){return new shaka.text.SrtTextParser});shaka.text.SsaTextParser=function(){};shaka.text.SsaTextParser.prototype.parseInit=function(a){goog.asserts.assert(!1,"SSA does not have init segments")};shaka.text.SsaTextParser.prototype.setSequenceMode=function(a){};shaka.text.SsaTextParser.prototype.setManifestType=function(a){};
|
|
2707
2716
|
shaka.text.SsaTextParser.prototype.parseMedia=function(a,b){b=shaka.text.SsaTextParser;var c="",d="";a=shaka.util.StringUtils.fromUTF8(a).split(/\r?\n\s*\r?\n/);a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=b.ssaContent_.exec(e);if(f){var g=f[1];f=f[2];if("V4 Styles"==g||"V4+ Styles"==g){c=f;continue}if("Events"==g){d=f;continue}}shaka.log.warning("SsaTextParser parser encountered an unknown part.",e)}a=[];e=null;c=c.split(/\r?\n/);c=$jscomp.makeIterator(c);for(f=
|
|
2708
|
-
c.next();!f.done;f=c.next())if(g=f.value,!/^\s*;/.test(g)&&(f=b.lineParts_.exec(g)))if(g=f[1].trim(),f=f[2].trim(),"Format"==g)e=f.split(b.valuesFormat_);else if("Style"==g){g=f.split(b.valuesFormat_);f={};for(var h=0;h<e.length&&h<g.length;h++)f[e[h]]=g[h];a.push(f)}e=[];c=null;g=d.split(/\r?\n/);d={};g=$jscomp.makeIterator(g);for(f=g.next();!f.done;d={$jscomp$loop$prop$styleName$
|
|
2709
|
-
h=h[2].trim(),"Format"==f)c=h.split(b.valuesFormat_);else if("Dialogue"==f){h=h.split(b.valuesFormat_);f={};for(var k=0;k<c.length&&k<h.length;k++)f[c[k]]=h[k];k=b.parseTime_(f.Start);var l=b.parseTime_(f.End);h=h.slice(c.length-1).join(",").replace(/\\N/g,"\n").replace(/\{[^}]+\}/g,"");h=new shaka.text.Cue(k,l,h);d.$jscomp$loop$prop$styleName$
|
|
2717
|
+
c.next();!f.done;f=c.next())if(g=f.value,!/^\s*;/.test(g)&&(f=b.lineParts_.exec(g)))if(g=f[1].trim(),f=f[2].trim(),"Format"==g)e=f.split(b.valuesFormat_);else if("Style"==g){g=f.split(b.valuesFormat_);f={};for(var h=0;h<e.length&&h<g.length;h++)f[e[h]]=g[h];a.push(f)}e=[];c=null;g=d.split(/\r?\n/);d={};g=$jscomp.makeIterator(g);for(f=g.next();!f.done;d={$jscomp$loop$prop$styleName$984:d.$jscomp$loop$prop$styleName$984},f=g.next())if(f=f.value,!/^\s*;/.test(f)&&(h=b.lineParts_.exec(f)))if(f=h[1].trim(),
|
|
2718
|
+
h=h[2].trim(),"Format"==f)c=h.split(b.valuesFormat_);else if("Dialogue"==f){h=h.split(b.valuesFormat_);f={};for(var k=0;k<c.length&&k<h.length;k++)f[c[k]]=h[k];k=b.parseTime_(f.Start);var l=b.parseTime_(f.End);h=h.slice(c.length-1).join(",").replace(/\\N/g,"\n").replace(/\{[^}]+\}/g,"");h=new shaka.text.Cue(k,l,h);d.$jscomp$loop$prop$styleName$984=f.Style;(f=a.find(function(m){return function(n){return n.Name==m.$jscomp$loop$prop$styleName$984}}(d)))&&b.addStyle_(h,f);e.push(h)}return e};
|
|
2710
2719
|
shaka.text.SsaTextParser.addStyle_=function(a,b){var c=shaka.text.Cue,d=shaka.text.SsaTextParser,e=b.Fontname;e&&(a.fontFamily=e);if(e=b.Fontsize)a.fontSize=e+"px";if(e=b.PrimaryColour)if(e=d.parseSsaColor_(e))a.color=e;if(e=b.BackColour)if(d=d.parseSsaColor_(e))a.backgroundColor=d;b.Bold&&(a.fontWeight=c.fontWeight.BOLD);b.Italic&&(a.fontStyle=c.fontStyle.ITALIC);b.Underline&&a.textDecoration.push(c.textDecoration.UNDERLINE);if(d=b.Spacing)a.letterSpacing=d+"px";if(d=b.Alignment)switch(parseInt(d,
|
|
2711
2720
|
10)){case 1:a.displayAlign=c.displayAlign.AFTER;a.textAlign=c.textAlign.START;break;case 2:a.displayAlign=c.displayAlign.AFTER;a.textAlign=c.textAlign.CENTER;break;case 3:a.displayAlign=c.displayAlign.AFTER;a.textAlign=c.textAlign.END;break;case 5:a.displayAlign=c.displayAlign.BEFORE;a.textAlign=c.textAlign.START;break;case 6:a.displayAlign=c.displayAlign.BEFORE;a.textAlign=c.textAlign.CENTER;break;case 7:a.displayAlign=c.displayAlign.BEFORE;a.textAlign=c.textAlign.END;break;case 9:a.displayAlign=
|
|
2712
2721
|
c.displayAlign.CENTER;a.textAlign=c.textAlign.START;break;case 10:a.displayAlign=c.displayAlign.CENTER;a.textAlign=c.textAlign.CENTER;break;case 11:a.displayAlign=c.displayAlign.CENTER,a.textAlign=c.textAlign.END}if(b=b.AlphaLevel)a.opacity=parseFloat(b)};shaka.text.SsaTextParser.parseSsaColor_=function(a){a=parseInt(a.replace("&H",""),16);return 0<=a?"rgba("+(a&255)+","+(a>>8&255)+","+(a>>16&255)+","+(a>>24&255^255)/255+")":null};
|
|
@@ -2920,7 +2929,7 @@ englishName:"Serbian (Serbia)"},su:{nativeName:"Basa Sunda",englishName:"Sundane
|
|
|
2920
2929
|
tl:{nativeName:"Filipino",englishName:"Filipino"},"tl-PH":{nativeName:"Filipino",englishName:"Filipino"},tlh:{nativeName:"tlhIngan-Hol",englishName:"Klingon"},tr:{nativeName:"T\u00fcrk\u00e7e",englishName:"Turkish"},"tr-TR":{nativeName:"T\u00fcrk\u00e7e",englishName:"Turkish"},"tt-RU":{nativeName:"\u0442\u0430\u0442\u0430\u0440\u0447\u0430",englishName:"Tatar"},uk:{nativeName:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",englishName:"Ukrainian"},"uk-UA":{nativeName:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",
|
|
2921
2930
|
englishName:"Ukrainian"},ur:{nativeName:"\u0627\u0631\u062f\u0648",englishName:"Urdu"},"ur-PK":{nativeName:"\u0627\u0631\u062f\u0648",englishName:"Urdu"},uz:{nativeName:"O'zbek",englishName:"Uzbek"},"uz-UZ":{nativeName:"O'zbek",englishName:"Uzbek"},vi:{nativeName:"Ti\u1ebfng Vi\u1ec7t",englishName:"Vietnamese"},"vi-VN":{nativeName:"Ti\u1ebfng Vi\u1ec7t",englishName:"Vietnamese"},"xh-ZA":{nativeName:"isiXhosa",englishName:"Xhosa"},yi:{nativeName:"\u05d9\u05d9\u05b4\u05d3\u05d9\u05e9",englishName:"Yiddish"},
|
|
2922
2931
|
"yi-DE":{nativeName:"\u05d9\u05d9\u05b4\u05d3\u05d9\u05e9 (German)",englishName:"Yiddish (German)"},zh:{nativeName:"\u4e2d\u6587",englishName:"Chinese"},"zh-HANS":{nativeName:"\u4e2d\u6587\u7b80\u4f53",englishName:"Chinese Simplified"},"zh-HANT":{nativeName:"\u4e2d\u6587\u7e41\u9ad4",englishName:"Chinese Traditional"},"zh-CN":{nativeName:"\u4e2d\u6587\uff08\u4e2d\u56fd\uff09",englishName:"Chinese Simplified (China)"},"zh-HK":{nativeName:"\u4e2d\u6587\uff08\u9999\u6e2f\uff09",englishName:"Chinese Traditional (Hong Kong)"},
|
|
2923
|
-
"zh-SG":{nativeName:"\u4e2d\u6587\uff08\u65b0\u52a0\u5761\uff09",englishName:"Chinese Simplified (Singapore)"},"zh-TW":{nativeName:"\u4e2d\u6587\uff08\u53f0\u7063\uff09",englishName:"Chinese Traditional (Taiwan)"},"zu-ZA":{nativeName:"isiZulu",englishName:"Zulu"}}},$jscomp$iter$
|
|
2932
|
+
"zh-SG":{nativeName:"\u4e2d\u6587\uff08\u65b0\u52a0\u5761\uff09",englishName:"Chinese Simplified (Singapore)"},"zh-TW":{nativeName:"\u4e2d\u6587\uff08\u53f0\u7063\uff09",englishName:"Chinese Traditional (Taiwan)"},"zu-ZA":{nativeName:"isiZulu",englishName:"Zulu"}}},$jscomp$iter$532=$jscomp.makeIterator(Object.keys(mozilla.LanguageMapping)),$jscomp$key$key=$jscomp$iter$532.next();!$jscomp$key$key.done;$jscomp$key$key=$jscomp$iter$532.next()){var key=$jscomp$key$key.value;mozilla.LanguageMapping[key.toLowerCase()]=
|
|
2924
2933
|
mozilla.LanguageMapping[key]};shaka.ui.Element=function(a,b){var c=this;this.parent=a;this.controls=b;this.eventManager=new shaka.util.EventManager;this.localization=this.controls.getLocalization();this.player=this.controls.getPlayer();this.video=this.controls.getVideo();this.adManager=this.player.getAdManager();this.ad=b.getAd();this.eventManager.listen(this.adManager,shaka.ads.AdManager.AD_STARTED,function(d){c.ad=d.ad});this.eventManager.listen(this.adManager,shaka.ads.AdManager.AD_STOPPED,function(){c.ad=null})};
|
|
2925
2934
|
shaka.ui.Element.prototype.release=function(){this.eventManager.release();this.ad=this.adManager=this.video=this.player=this.localization=this.eventManager=this.controls=this.parent=null};goog.exportSymbol("shaka.ui.Element",shaka.ui.Element);goog.exportProperty(shaka.ui.Element.prototype,"release",shaka.ui.Element.prototype.release);shaka.ui.Enums={};
|
|
2926
2935
|
shaka.ui.Enums.MaterialDesignIcons={FULLSCREEN:"fullscreen",EXIT_FULLSCREEN:"fullscreen_exit",CLOSE:"close",CLOSED_CAPTIONS:"closed_caption",CLOSED_CAPTIONS_OFF:"closed_caption_disabled",CHECKMARK:"done",LANGUAGE:"language",PIP:"picture_in_picture_alt",EXIT_PIP:"branding_watermark",BACK:"arrow_back",RESOLUTION:"settings",MUTE:"volume_up",UNMUTE:"volume_off",CAST:"cast",EXIT_CAST:"cast_connected",OPEN_OVERFLOW:"more_vert",REWIND:"fast_rewind",FAST_FORWARD:"fast_forward",PLAY:"play_arrow",PLAYBACK_RATE:"slow_motion_video",
|
|
@@ -2972,8 +2981,8 @@ r=shaka.net.NetworkingEngine.AdvancedRequestType.MEDIA_SEGMENT;v=shaka.util.Netw
|
|
|
2972
2981
|
new Blob([B],{type:"image/jpeg"});p=URL.createObjectURL(B)})),w.parse(x.data,!1)):(t=d.mimeType||"image/jpeg",y=new Blob([x.data],{type:t}),p=URL.createObjectURL(y));A.leaveTryBlock(4);break;case 5:u=A.enterCatchBlock();if(u.code==shaka.util.Error.Code.OPERATION_ABORTED)return A.return();throw u;case 4:try{c.thumbnailContainer_.removeChild(c.thumbnailImage_)}catch(B){}c.thumbnailImage_=shaka.util.Dom.createHTMLElement("img");c.thumbnailImage_.id="shaka-player-ui-thumbnail-image";c.thumbnailImage_.draggable=
|
|
2973
2982
|
!1;c.thumbnailImage_.src=p;c.thumbnailImage_.onload=function(){p.startsWith("blob:")&&URL.revokeObjectURL(p)};c.thumbnailContainer_.insertBefore(c.thumbnailImage_,c.thumbnailContainer_.firstChild);case 3:z=l/g.width,g.imageHeight?c.thumbnailImage_.height=g.imageHeight:g.sprite||(c.thumbnailImage_.style.height="100%",c.thumbnailImage_.style.objectFit="contain"),g.imageWidth?c.thumbnailImage_.width=g.imageWidth:g.sprite||(c.thumbnailImage_.style.width="100%",c.thumbnailImage_.style.objectFit="contain"),
|
|
2974
2983
|
c.thumbnailImage_.style.left="-"+z*g.positionX+"px",c.thumbnailImage_.style.top="-"+z*g.positionY+"px",c.thumbnailImage_.style.transform="scale("+z+")",c.thumbnailImage_.style.transformOrigin="left top",m=Math.floor(l*g.height/g.width),c.thumbnailContainer_.style.height=m+"px",c.thumbnailContainer_.style.top=-(m-k)+"px",A.jumpToEnd()}})};
|
|
2975
|
-
shaka.ui.SeekBar.prototype.getThumbnailTrack_=function(){var a=this.player.getImageTracks();if(!a.length)return null;for(var b={},c=$jscomp.makeIterator(["image/avif","image/webp","image/jpeg","image/png","image/svg+xml"]),d=c.next();!d.done;b={$jscomp$loop$prop$mimeType$
|
|
2976
|
-
(d=a.filter(function(e){return function(f){return f.mimeType.toLowerCase()===e.$jscomp$loop$prop$mimeType$
|
|
2984
|
+
shaka.ui.SeekBar.prototype.getThumbnailTrack_=function(){var a=this.player.getImageTracks();if(!a.length)return null;for(var b={},c=$jscomp.makeIterator(["image/avif","image/webp","image/jpeg","image/png","image/svg+xml"]),d=c.next();!d.done;b={$jscomp$loop$prop$mimeType$986:b.$jscomp$loop$prop$mimeType$986,$jscomp$loop$prop$estimatedBandwidth$987:b.$jscomp$loop$prop$estimatedBandwidth$987},d=c.next())if(b.$jscomp$loop$prop$mimeType$986=d.value,b.$jscomp$loop$prop$estimatedBandwidth$987=this.player.getStats().estimatedBandwidth,
|
|
2985
|
+
(d=a.filter(function(e){return function(f){return f.mimeType.toLowerCase()===e.$jscomp$loop$prop$mimeType$986&&f.bandwidth<.01*e.$jscomp$loop$prop$estimatedBandwidth$987}}(b)).sort(function(e,f){return f.bandwidth-e.bandwidth}))&&d.length)return d[0];return a.find(function(e){return"application/mp4"==e.mimeType&&"mjpg"==e.codecs})||a[0]};shaka.ui.SeekBar.prototype.hideThumbnail_=function(){this.thumbnailContainer_.style.visibility="hidden";this.thumbnailTime_.textContent=""};
|
|
2977
2986
|
shaka.ui.SeekBar.prototype.timeFormatter_=function(a){var b=Math.round(a);a=Math.floor(b/3600);var c=Math.floor((b-3600*a)/60);b=b-3600*a-60*c;10>b&&(b="0"+b);return 0<a?(10>c&&(c="0"+c),a+":"+c+":"+b):c+":"+b};goog.exportSymbol("shaka.ui.SeekBar",shaka.ui.SeekBar);shaka.ui.SeekBar.Transparent_Image_='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>';shaka.ui.SeekBar.Factory=function(){};shaka.ui.SeekBar.Factory.prototype.create=function(a,b){return new shaka.ui.SeekBar(a,b)};
|
|
2978
2987
|
goog.exportProperty(shaka.ui.SeekBar,"Factory",shaka.ui.SeekBar.Factory);/*
|
|
2979
2988
|
@license
|
|
@@ -3151,10 +3160,10 @@ b.parentElement==a){e=b;break}e||(e=document.createElement("canvas"),e.classList
|
|
|
3151
3160
|
goog.exportProperty(shaka.ui.Overlay.prototype,"getConfiguration",shaka.ui.Overlay.prototype.getConfiguration);goog.exportProperty(shaka.ui.Overlay.prototype,"isMobile",shaka.ui.Overlay.prototype.isMobile);goog.exportProperty(shaka.ui.Overlay.prototype,"destroy",shaka.ui.Overlay.prototype.destroy);shaka.ui.Overlay.TrackLabelFormat={LANGUAGE:0,ROLE:1,LANGUAGE_ROLE:2,LABEL:3};goog.exportProperty(shaka.ui.Overlay,"TrackLabelFormat",shaka.ui.Overlay.TrackLabelFormat);
|
|
3152
3161
|
shaka.ui.Overlay.FailReasonCode={NO_BROWSER_SUPPORT:0,PLAYER_FAILED_TO_LOAD:1};goog.exportProperty(shaka.ui.Overlay,"FailReasonCode",shaka.ui.Overlay.FailReasonCode);"complete"==document.readyState?function(){return $jscomp.asyncExecutePromiseGeneratorProgram(function(a){if(1==a.nextAddress)return a.yield(Promise.resolve(),2);shaka.ui.Overlay.scanPageForShakaElements_();a.jumpToEnd()})}():window.addEventListener("load",shaka.ui.Overlay.scanPageForShakaElements_);shaka.ui.LanguageUtils=function(){};
|
|
3153
3162
|
shaka.ui.LanguageUtils.updateTracks=function(a,b,c,d,e,f,g,h){var k=shaka.ui.Locales.Ids,l=a.find(function(C){return 1==C.active}),m=shaka.ui.Utils.getFirstDescendantWithClassName(b,"shaka-back-to-overflow-button");shaka.util.Dom.removeAllChildren(b);b.appendChild(m);m=function(C){return"variant"==C.type?C.audioRoles?C.audioRoles.join(", "):void 0:C.roles.join(", ")};for(var n=function(C,F,D,G){C=[C,F];h&&null!=G&&C.push(G);D&&g==shaka.ui.Overlay.TrackLabelFormat.LABEL&&C.push(D);return C.join(": ")},
|
|
3154
|
-
p=function(C){var F="";5<=C&&(F=" "+f.resolve(k.SURROUND));return F},q=new Map,r=$jscomp.makeIterator(a),v=r.next();!v.done;v=r.next())v=v.value,q.has(v.language)||q.set(v.language,new Set),q.get(v.language).add(m(v));q=new Set;l=l?n(l.language,m(l),l.label,l.channelsCount):"";r={};a=$jscomp.makeIterator(a);for(v=a.next();!v.done;r={$jscomp$loop$prop$track$
|
|
3155
|
-
var x=r.$jscomp$loop$prop$track$
|
|
3156
|
-
switch(g){case shaka.ui.Overlay.TrackLabelFormat.LANGUAGE:h&&(B.textContent+=p(u));x&&(B.textContent+=" ("+w+")");break;case shaka.ui.Overlay.TrackLabelFormat.ROLE:h&&(B.textContent+=p(u));t?B.textContent=t:(shaka.log.alwaysWarn("Track #"+r.$jscomp$loop$prop$track$
|
|
3157
|
-
t);x&&(B.textContent+=" ("+w+")");break;case shaka.ui.Overlay.TrackLabelFormat.LABEL:y?B.textContent=y:(shaka.log.alwaysWarn("Track #"+r.$jscomp$loop$prop$track$
|
|
3163
|
+
p=function(C){var F="";5<=C&&(F=" "+f.resolve(k.SURROUND));return F},q=new Map,r=$jscomp.makeIterator(a),v=r.next();!v.done;v=r.next())v=v.value,q.has(v.language)||q.set(v.language,new Set),q.get(v.language).add(m(v));q=new Set;l=l?n(l.language,m(l),l.label,l.channelsCount):"";r={};a=$jscomp.makeIterator(a);for(v=a.next();!v.done;r={$jscomp$loop$prop$track$899$989:r.$jscomp$loop$prop$track$899$989},v=a.next()){r.$jscomp$loop$prop$track$899$989=v.value;v=r.$jscomp$loop$prop$track$899$989.language;
|
|
3164
|
+
var x=r.$jscomp$loop$prop$track$899$989.forced,w=f.resolve(k.SUBTITLE_FORCED),t=m(r.$jscomp$loop$prop$track$899$989),y=r.$jscomp$loop$prop$track$899$989.label,u=r.$jscomp$loop$prop$track$899$989.channelsCount,z=n(v,t,y,u);if(!q.has(z)){q.add(z);var A=shaka.util.Dom.createButton();A.addEventListener("click",function(C){return function(){c(C.$jscomp$loop$prop$track$899$989)}}(r));var B=shaka.util.Dom.createHTMLElement("span");A.appendChild(B);B.textContent=shaka.ui.LanguageUtils.getLanguageName(v,f);
|
|
3165
|
+
switch(g){case shaka.ui.Overlay.TrackLabelFormat.LANGUAGE:h&&(B.textContent+=p(u));x&&(B.textContent+=" ("+w+")");break;case shaka.ui.Overlay.TrackLabelFormat.ROLE:h&&(B.textContent+=p(u));t?B.textContent=t:(shaka.log.alwaysWarn("Track #"+r.$jscomp$loop$prop$track$899$989.id+" does not have a role, but the UI is configured to only show role."),B.textContent="?");x&&(B.textContent+=" ("+w+")");break;case shaka.ui.Overlay.TrackLabelFormat.LANGUAGE_ROLE:h&&(B.textContent+=p(u));t&&(B.textContent+=": "+
|
|
3166
|
+
t);x&&(B.textContent+=" ("+w+")");break;case shaka.ui.Overlay.TrackLabelFormat.LABEL:y?B.textContent=y:(shaka.log.alwaysWarn("Track #"+r.$jscomp$loop$prop$track$899$989.id+" does not have a label, but the UI is configured to only show labels."),B.textContent="?")}d&&z==l&&(A.appendChild(shaka.ui.Utils.checkmarkIcon()),B.classList.add("shaka-chosen-item"),A.ariaSelected="true",e.textContent=B.textContent);b.appendChild(A)}}};
|
|
3158
3167
|
shaka.ui.LanguageUtils.getLanguageName=function(a,b){if(!a&&!b)return"";switch(a){case "mul":return b.resolve(shaka.ui.Locales.Ids.MULTIPLE_LANGUAGES);case "und":return b.resolve(shaka.ui.Locales.Ids.UNDETERMINED_LANGUAGE);case "zxx":return b.resolve(shaka.ui.Locales.Ids.NOT_APPLICABLE)}var c=shaka.util.LanguageUtils.getBase(a);return a in mozilla.LanguageMapping?mozilla.LanguageMapping[a].nativeName:c in mozilla.LanguageMapping?mozilla.LanguageMapping[c].nativeName+" ("+a+")":b.resolve(shaka.ui.Locales.Ids.UNRECOGNIZED_LANGUAGE)+
|
|
3159
3168
|
" ("+a+")"};shaka.ui.SettingsMenu=function(a,b,c){shaka.ui.Element.call(this,a,b);var d=this;this.addButton_(c);this.addMenu_();this.inOverflowMenu_();this.eventManager.listen(this.button,"click",function(){d.onButtonClick_()})};$jscomp.inherits(shaka.ui.SettingsMenu,shaka.ui.Element);
|
|
3160
3169
|
shaka.ui.SettingsMenu.prototype.addButton_=function(a){this.button=shaka.util.Dom.createButton();this.button.classList.add("shaka-overflow-button");this.icon=shaka.util.Dom.createHTMLElement("i");this.icon.classList.add("material-icons-round");this.icon.textContent=a;this.button.appendChild(this.icon);a=shaka.util.Dom.createHTMLElement("label");a.classList.add("shaka-overflow-button-label");a.classList.add("shaka-overflow-menu-only");this.nameSpan=shaka.util.Dom.createHTMLElement("span");a.appendChild(this.nameSpan);
|
|
@@ -3202,8 +3211,8 @@ this.eventManager.listen(this.player,"loaded",function(){c.updatePlaybackRateSel
|
|
|
3202
3211
|
$jscomp.inherits(shaka.ui.PlaybackRateSelection,shaka.ui.SettingsMenu);shaka.ui.PlaybackRateSelection.prototype.updateLocalizedStrings_=function(){var a=shaka.ui.Locales.Ids;this.backButton.ariaLabel=this.localization.resolve(a.BACK);this.button.ariaLabel=this.localization.resolve(a.PLAYBACK_RATE);this.nameSpan.textContent=this.localization.resolve(a.PLAYBACK_RATE);this.backSpan.textContent=this.localization.resolve(a.PLAYBACK_RATE)};
|
|
3203
3212
|
shaka.ui.PlaybackRateSelection.prototype.updatePlaybackRateSelection_=function(a){var b=this,c=shaka.ui.Utils.getDescendantIfExists(this.menu,"material-icons-round shaka-chosen-item");if(c){var d=c.parentElement;d.removeAttribute("aria-selected");d.getElementsByTagName("span")[0].classList.remove("shaka-chosen-item");d.removeChild(c)}if(c=Array.from(this.menu.querySelectorAll("span")).find(function(e){return b.playbackRates_.get(e.textContent)==a}))d=c.parentElement,d.appendChild(shaka.ui.Utils.checkmarkIcon()),
|
|
3204
3213
|
d.ariaSelected="true",c.classList.add("shaka-chosen-item");this.currentSelection.textContent=a+"x";this.button.setAttribute("shaka-status",a+"x")};
|
|
3205
|
-
shaka.ui.PlaybackRateSelection.prototype.addPlaybackRates_=function(){for(var a=this,b={},c=$jscomp.makeIterator(this.playbackRates_.keys()),d=c.next();!d.done;b={$jscomp$loop$prop$rateStr$
|
|
3206
|
-
a.playbackRates_.get(f.$jscomp$loop$prop$rateStr$
|
|
3214
|
+
shaka.ui.PlaybackRateSelection.prototype.addPlaybackRates_=function(){for(var a=this,b={},c=$jscomp.makeIterator(this.playbackRates_.keys()),d=c.next();!d.done;b={$jscomp$loop$prop$rateStr$991:b.$jscomp$loop$prop$rateStr$991},d=c.next()){b.$jscomp$loop$prop$rateStr$991=d.value;d=shaka.util.Dom.createButton();var e=shaka.util.Dom.createHTMLElement("span");e.textContent=b.$jscomp$loop$prop$rateStr$991;d.appendChild(e);this.eventManager.listen(d,"click",function(f){return function(){a.video.playbackRate=
|
|
3215
|
+
a.playbackRates_.get(f.$jscomp$loop$prop$rateStr$991);a.video.defaultPlaybackRate=a.playbackRates_.get(f.$jscomp$loop$prop$rateStr$991)}}(b));this.menu.appendChild(d)}shaka.ui.Utils.focusOnTheChosenItem(this.menu)};goog.exportSymbol("shaka.ui.PlaybackRateSelection",shaka.ui.PlaybackRateSelection);shaka.ui.PlaybackRateSelection.Factory=function(){};shaka.ui.PlaybackRateSelection.Factory.prototype.create=function(a,b){return new shaka.ui.PlaybackRateSelection(a,b)};
|
|
3207
3216
|
shaka.ui.OverflowMenu.registerElement("playback_rate",new shaka.ui.PlaybackRateSelection.Factory);shaka.ui.Controls.registerElement("playback_rate",new shaka.ui.PlaybackRateSelection.Factory);shaka.ui.PresentationTimeTracker=function(a,b){shaka.ui.Element.call(this,a,b);var c=this;this.currentTime_=shaka.util.Dom.createButton();this.currentTime_.classList.add("shaka-current-time");this.setValue_("0:00");this.parent.appendChild(this.currentTime_);this.eventManager.listen(this.currentTime_,"click",function(){c.player.isLive()&&(c.video.currentTime=c.player.seekRange().end)});this.eventManager.listen(this.controls,"timeandseekrangeupdated",function(){c.updateTime_()});this.eventManager.listen(this.player,
|
|
3208
3217
|
"trackschanged",function(){c.onTracksChanged_()})};$jscomp.inherits(shaka.ui.PresentationTimeTracker,shaka.ui.Element);shaka.ui.PresentationTimeTracker.prototype.setValue_=function(a){a!=this.currentTime_.textContent&&(this.currentTime_.textContent=a)};
|
|
3209
3218
|
shaka.ui.PresentationTimeTracker.prototype.updateTime_=function(){var a=this.controls.isSeeking(),b=this.controls.getDisplayTime(),c=this.player.seekRange(),d=c.end-c.start,e=shaka.ui.Utils;this.player.isLive()?(b=Math.max(0,Math.floor(c.end-b)),d=3600<=d,1<=b||a?(this.setValue_("- "+e.buildTimeString(b,d)),this.currentTime_.disabled=!1):(this.setValue_(this.localization.resolve(shaka.ui.Locales.Ids.LIVE)),this.currentTime_.disabled=!0)):(a=3600<=d,b=e.buildTimeString(Math.max(0,b-c.start),a),d&&
|
|
@@ -3223,10 +3232,10 @@ d.yield(a.video.remote.watchAvailability(b),13);case 13:c=d.yieldResult;a.callba
|
|
|
3223
3232
|
shaka.ui.RemoteButton.Factory=function(){};shaka.ui.RemoteButton.Factory.prototype.create=function(a,b){return new shaka.ui.RemoteButton(a,b)};shaka.ui.OverflowMenu.registerElement("remote",new shaka.ui.RemoteButton.Factory);shaka.ui.Controls.registerElement("remote",new shaka.ui.RemoteButton.Factory);shaka.ui.ResolutionSelection=function(a,b){shaka.ui.SettingsMenu.call(this,a,b,shaka.ui.Enums.MaterialDesignIcons.RESOLUTION);var c=this;this.button.classList.add("shaka-resolution-button");this.button.classList.add("shaka-tooltip-status");this.menu.classList.add("shaka-resolutions");this.eventManager.listen(this.localization,shaka.ui.Localization.LOCALE_UPDATED,function(){c.updateLocalizedStrings_()});this.eventManager.listen(this.localization,shaka.ui.Localization.LOCALE_CHANGED,function(){c.updateLocalizedStrings_()});
|
|
3224
3233
|
this.eventManager.listen(this.player,"variantchanged",function(){c.updateResolutionSelection_()});this.eventManager.listen(this.player,"trackschanged",function(){c.updateResolutionSelection_()});this.eventManager.listen(this.player,"abrstatuschanged",function(){c.updateResolutionSelection_()});this.updateResolutionSelection_()};$jscomp.inherits(shaka.ui.ResolutionSelection,shaka.ui.SettingsMenu);
|
|
3225
3234
|
shaka.ui.ResolutionSelection.prototype.updateResolutionSelection_=function(){var a=this,b=shaka.ui.Overlay.TrackLabelFormat,c=[];this.player.getLoadMode()!=shaka.Player.LoadMode.SRC_EQUALS&&(c=this.player.getVariantTracks());var d=c.find(function(l){return l.active});d&&(c=c.filter(function(l){if(l.language!=d.language||a.controls.getConfig().showAudioChannelCountVariants&&l.channelsCount!=d.channelsCount)return!1;var m=a.controls.getConfig().trackLabelFormat;return(m==b.ROLE||m==b.LANGUAGE_ROLE)&&
|
|
3226
|
-
JSON.stringify(l.audioRoles)!=JSON.stringify(d.audioRoles)||m==b.LABEL&&l.label!=d.label?!1:!0}));c=c.filter(function(l,m){var n=-1;n=a.player.isAudioOnly()?c.findIndex(function(p){return p.bandwidth==l.bandwidth}):c.findIndex(function(p){return p.height==l.height&&p.frameRate==l.frameRate&&p.hdr==l.hdr&&p.videoLayout==l.videoLayout});return n==m});this.player.isAudioOnly()?c.sort(function(l,m){goog.asserts.assert(null!=l.bandwidth,"Null bandwidth");goog.asserts.assert(null!=
|
|
3227
|
-
return m.bandwidth-l.bandwidth}):c.sort(function(l,m){goog.asserts.assert(null!=l.height,"Null height");goog.asserts.assert(null!=m.height,"Null height");return m.height-l.height});var e=shaka.ui.Utils.getFirstDescendantWithClassName(this.menu,"shaka-back-to-overflow-button");shaka.util.Dom.removeAllChildren(this.menu);this.menu.appendChild(e);e=this.player.getConfiguration().abr.enabled;for(var f={},g=$jscomp.makeIterator(c),h=g.next();!h.done;f={$jscomp$loop$prop$track$
|
|
3228
|
-
h=g.next()){f.$jscomp$loop$prop$track$
|
|
3229
|
-
this.getResolutionLabel_(f.$jscomp$loop$prop$track$
|
|
3235
|
+
JSON.stringify(l.audioRoles)!=JSON.stringify(d.audioRoles)||m==b.LABEL&&l.label!=d.label?!1:!0}));c=c.filter(function(l,m){var n=-1;n=a.player.isAudioOnly()?c.findIndex(function(p){return p.bandwidth==l.bandwidth}):c.findIndex(function(p){return p.height==l.height&&p.videoBandwidth==l.videoBandwidth&&p.frameRate==l.frameRate&&p.hdr==l.hdr&&p.videoLayout==l.videoLayout});return n==m});this.player.isAudioOnly()?c.sort(function(l,m){goog.asserts.assert(null!=l.bandwidth,"Null bandwidth");goog.asserts.assert(null!=
|
|
3236
|
+
m.bandwidth,"Null bandwidth");return m.bandwidth-l.bandwidth}):c.sort(function(l,m){goog.asserts.assert(null!=l.height,"Null height");goog.asserts.assert(null!=m.height,"Null height");return m.height-l.height});var e=shaka.ui.Utils.getFirstDescendantWithClassName(this.menu,"shaka-back-to-overflow-button");shaka.util.Dom.removeAllChildren(this.menu);this.menu.appendChild(e);e=this.player.getConfiguration().abr.enabled;for(var f={},g=$jscomp.makeIterator(c),h=g.next();!h.done;f={$jscomp$loop$prop$track$993:f.$jscomp$loop$prop$track$993},
|
|
3237
|
+
h=g.next()){f.$jscomp$loop$prop$track$993=h.value;h=shaka.util.Dom.createButton();h.classList.add("explicit-resolution");this.eventManager.listen(h,"click",function(l){return function(){return a.onTrackSelected_(l.$jscomp$loop$prop$track$993)}}(f));var k=shaka.util.Dom.createHTMLElement("span");this.player.isAudioOnly()&&f.$jscomp$loop$prop$track$993.bandwidth?k.textContent=Math.round(f.$jscomp$loop$prop$track$993.bandwidth/1E3)+" kbits/s":k.textContent=f.$jscomp$loop$prop$track$993.height&&f.$jscomp$loop$prop$track$993.width?
|
|
3238
|
+
this.getResolutionLabel_(f.$jscomp$loop$prop$track$993):"Unknown";h.appendChild(k);e||f.$jscomp$loop$prop$track$993!=d||(h.ariaSelected="true",h.appendChild(shaka.ui.Utils.checkmarkIcon()),k.classList.add("shaka-chosen-item"),this.currentSelection.textContent=k.textContent);this.menu.appendChild(h)}f=shaka.util.Dom.createButton();f.classList.add("shaka-enable-abr-button");this.eventManager.listen(f,"click",function(){a.player.configure({abr:{enabled:!0}});a.updateResolutionSelection_()});this.abrOnSpan_=
|
|
3230
3239
|
shaka.util.Dom.createHTMLElement("span");this.abrOnSpan_.classList.add("shaka-auto-span");this.abrOnSpan_.textContent=this.localization.resolve(shaka.ui.Locales.Ids.AUTO_QUALITY);f.appendChild(this.abrOnSpan_);e&&(f.ariaSelected="true",f.appendChild(shaka.ui.Utils.checkmarkIcon()),this.abrOnSpan_.classList.add("shaka-chosen-item"),this.currentSelection.textContent=this.localization.resolve(shaka.ui.Locales.Ids.AUTO_QUALITY));this.button.setAttribute("shaka-status",this.currentSelection.textContent);
|
|
3231
3240
|
this.menu.appendChild(f);shaka.ui.Utils.focusOnTheChosenItem(this.menu);this.controls.dispatchEvent(new shaka.util.FakeEvent("resolutionselectionupdated"));this.updateLocalizedStrings_();shaka.ui.Utils.setDisplay(this.button,1<c.length)};
|
|
3232
3241
|
shaka.ui.ResolutionSelection.prototype.getResolutionLabel_=function(a){var b=a.height||0,c=a.width||0,d=b;c/b>16/9&&(d=Math.round(9*c/16));b=d+"p";2160==d&&(b="4K");(d=a.frameRate)&&(50<=d||20>=d)&&(b+=Math.round(a.frameRate));if("PQ"==a.hdr||"HLG"==a.hdr)b+=" (HDR)";"CH-STEREO"==a.videoLayout&&(b+=" (3D)");return b};
|