shaka-player 4.6.1 → 4.6.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/demo/config.js +5 -0
  3. package/dist/demo.compiled.debug.js +26 -25
  4. package/dist/demo.compiled.debug.map +2 -2
  5. package/dist/demo.compiled.js +26 -25
  6. package/dist/demo.compiled.map +2 -2
  7. package/dist/locales.js +32 -32
  8. package/dist/shaka-player.compiled.d.ts +1 -0
  9. package/dist/shaka-player.compiled.debug.d.ts +1 -0
  10. package/dist/shaka-player.compiled.debug.externs.js +1 -0
  11. package/dist/shaka-player.compiled.debug.js +24 -23
  12. package/dist/shaka-player.compiled.debug.map +3 -3
  13. package/dist/shaka-player.compiled.externs.js +1 -0
  14. package/dist/shaka-player.compiled.js +694 -694
  15. package/dist/shaka-player.compiled.map +2 -2
  16. package/dist/shaka-player.ui.d.ts +1 -0
  17. package/dist/shaka-player.ui.debug.d.ts +1 -0
  18. package/dist/shaka-player.ui.debug.externs.js +1 -0
  19. package/dist/shaka-player.ui.debug.js +29 -27
  20. package/dist/shaka-player.ui.debug.map +3 -3
  21. package/dist/shaka-player.ui.externs.js +1 -0
  22. package/dist/shaka-player.ui.js +794 -794
  23. package/dist/shaka-player.ui.map +2 -2
  24. package/docs/tutorials/lcevc.md +2 -2
  25. package/lib/cea/cea608_memory.js +13 -2
  26. package/lib/media/segment_reference.js +2 -1
  27. package/lib/media/streaming_engine.js +1 -1
  28. package/lib/player.js +1 -1
  29. package/lib/transmuxer/ts_transmuxer.js +15 -0
  30. package/lib/util/error.js +6 -0
  31. package/package.json +2 -2
  32. package/test/cea/cea608_memory_unit.js +8 -8
  33. package/test/cea/cea_decoder_unit.js +11 -11
  34. package/test/demo/demo_unit.js +0 -3
  35. package/ui/presentation_time.js +5 -5
@@ -213,31 +213,32 @@ this.reload_();for(let b=0;b<a.length;b++){const c=this.sections_[b];a[b]&&c.ope
213
213
  "drm.minHdcpVersion").addBoolInput_("Ignore duplicate init data","drm.ignoreDuplicateInitData");const b=shakaDemoMain.getConfiguration().drm.advanced||{};a=(d,e,f)=>{this.addDatalistInput_(d,f,g=>{for(const h of shakaDemo.Main.commonDrmSystems)h in b||(b[h]=shakaDemo.Main.defaultAdvancedDrmConfig());for(const h in b)b[h][e]=g.value;shakaDemoMain.configure("drm.advanced",b);shakaDemoMain.remakeHash()});if(d=Object.keys(b)[0])d=b[d][e],this.latestInput_.input().value=d};const c="SW_SECURE_CRYPTO SW_SECURE_DECODE HW_SECURE_CRYPTO HW_SECURE_DECODE HW_SECURE_ALL 150 2000 3000".split(" ");
214
214
  a("Video Robustness","videoRobustness",c);a("Audio Robustness","audioRobustness",c);a("Session Type","sessionType",["temporary","persistent-license"]);this.addRetrySection_("drm","DRM Retry Parameters")}addManifestSection_(){const a=this.resolveExternLink_(".ManifestConfiguration");this.addSection_("Manifest",a).addBoolInput_("Ignore DASH DRM Info","manifest.dash.ignoreDrmInfo").addBoolInput_("Auto-Correct DASH Drift","manifest.dash.autoCorrectDrift").addBoolInput_("Disable Xlink processing","manifest.dash.disableXlinkProcessing").addBoolInput_("Xlink Should Fail Gracefully",
215
215
  "manifest.dash.xlinkFailGracefully").addBoolInput_("Ignore DASH suggestedPresentationDelay","manifest.dash.ignoreSuggestedPresentationDelay").addBoolInput_("Ignore empty DASH AdaptationSets","manifest.dash.ignoreEmptyAdaptationSet").addBoolInput_("Ignore DASH maxSegmentDuration","manifest.dash.ignoreMaxSegmentDuration").addBoolInput_("Ignore HLS Text Stream Failures","manifest.hls.ignoreTextStreamFailures").addBoolInput_("Ignore HLS Image Stream Failures","manifest.hls.ignoreImageStreamFailures").addTextInput_("Default Audio Codec",
216
- "manifest.hls.defaultAudioCodec").addTextInput_("Default Video Codec","manifest.hls.defaultVideoCodec").addBoolInput_("Ignore Program Date Time from manifest","manifest.hls.ignoreManifestProgramDateTime").addBoolInput_("Use Safari behavior for live","manifest.hls.useSafariBehaviorForLive").addNumberInput_("Live segments delay","manifest.hls.liveSegmentsDelay").addBoolInput_("Enable HLS sequence mode","manifest.hls.sequenceMode").addBoolInput_("Ignore Manifest Timestamps in Segments Mode","manifest.hls.ignoreManifestTimestampsInSegmentsMode").addBoolInput_("Disable codec guessing",
217
- "manifest.hls.disableCodecGuessing").addBoolInput_("Allow LL-HLS byterange optimization","manifest.hls.allowLowLatencyByteRangeOptimization").addNumberInput_("Availability Window Override","manifest.availabilityWindowOverride",!0,!1,!0).addTextInput_("Clock Sync URI","manifest.dash.clockSyncUri").addNumberInput_("Default Presentation Delay","manifest.defaultPresentationDelay").addBoolInput_("Enable Audio Groups","manifest.dash.enableAudioGroups").addBoolInput_("Ignore Min Buffer Time","manifest.dash.ignoreMinBufferTime").addNumberInput_("Initial Segment Limit",
218
- "manifest.dash.initialSegmentLimit",!1,!1,!0).addBoolInput_("Enable DASH sequence mode","manifest.dash.sequenceMode").addBoolInput_("Disable Audio","manifest.disableAudio").addBoolInput_("Disable Video","manifest.disableVideo").addBoolInput_("Disable Text","manifest.disableText").addBoolInput_("Disable Thumbnails","manifest.disableThumbnails").addBoolInput_("Enable segment-relative VTT Timing","manifest.segmentRelativeVttTiming").addBoolInput_("Enable MSS sequence mode","manifest.mss.sequenceMode");
219
- this.addRetrySection_("manifest","Manifest Retry Parameters")}addAbrSection_(){const a=this.resolveExternLink_(".AbrConfiguration");this.addSection_("Adaptation",a).addBoolInput_("Enabled","abr.enabled").addBoolInput_("Use Network Information API","abr.useNetworkInformation").addNumberInput_("Default Bandwidth EstimatZ","abr.defaultBandwidthEstimate").addNumberInput_("Bandwidth Downgrade Target","abr.bandwidthDowngradeTarget",!0).addNumberInput_("Bandwidth Upgrade Target","abr.bandwidthUpgradeTarget",
220
- !0).addNumberInput_("Switch Interval","abr.switchInterval",!0).addNumberInput_("Min total Bytes","abr.advanced.minTotalBytes").addNumberInput_("Min Bytes","abr.advanced.minBytes").addNumberInput_("Fast half life","abr.advanced.fastHalfLife",!0).addNumberInput_("Slow half life","abr.advanced.slowHalfLife",!0).addBoolInput_("Restrict to element size","abr.restrictToElementSize").addBoolInput_("Restrict to screen size","abr.restrictToScreenSize").addBoolInput_("Ignore device pixel ratio","abr.ignoreDevicePixelRatio").addBoolInput_("Clear video buffer on abr rendition switch",
221
- "abr.clearBufferSwitch").addNumberInput_("Safe margin on abr switch rendition","abr.safeMarginSwitch",!0);this.addRetrictionsSection_("abr","Adaptation Restrictions")}addCmcdSection_(){const a=this.resolveExternLink_(".CmcdConfiguration");this.addSection_("CMCD",a).addBoolInput_("Enabled","cmcd.enabled").addTextInput_("Session ID","cmcd.sessionId").addTextInput_("Content ID","cmcd.contentId").addBoolInput_("Use Headers","cmcd.useHeaders")}addLcevcSection_(){const a=this.resolveExternLink_(".LcevcConfiguration");
222
- this.addSection_("MPEG-5 Part-2 LCEVC",a).addBoolInput_("Enabled","lcevc.enabled").addBoolInput_("LCEVC Dynamic Performance scaling","lcevc.dynamicPerformanceScaling").addNumberInput_("LCEVC Log Level","lcevc.logLevel").addBoolInput_("Draw LCEVC Logo","lcevc.drawLogo")}addAdsSection_(){const a=this.resolveExternLink_(".AdsConfiguration");this.addSection_("Ads",a).addBoolInput_("Custom playhead tracker","ads.customPlayheadTracker")}addRetrictionsSection_(a,b){a=(a?a+".":"")+"restrictions.";const c=
223
- this.resolveExternLink_(".Restrictions");this.addSection_(b,c).addNumberInput_("Min Width",a+"minWidth").addNumberInput_("Max Width",a+"maxWidth").addNumberInput_("Min Height",a+"minHeight").addNumberInput_("Max Height",a+"maxHeight").addNumberInput_("Min Pixels",a+"minPixels").addNumberInput_("Max Pixels",a+"maxPixels").addNumberInput_("Min Framerate",a+"minFrameRate").addNumberInput_("Max Framerate",a+"maxFrameRate").addNumberInput_("Min Bandwidth",a+"minBandwidth").addNumberInput_("Max Bandwidth",
224
- a+"maxBandwidth")}addRetrySection_(a,b){a+=".retryParameters.";const c=this.resolveExternLink_(".RetryParameters");this.addSection_(b,c).addNumberInput_("Max Attempts",a+"maxAttempts").addNumberInput_("Base Delay",a+"baseDelay",!0).addNumberInput_("Backoff Factor",a+"backoffFactor",!0).addNumberInput_("Fuzz Factor",a+"fuzzFactor",!0).addNumberInput_("Timeout Factor",a+"timeout",!0).addNumberInput_("Stall Timeout",a+"stallTimeout",!0).addNumberInput_("Connection Timeout",a+"connectionTimeout",!0)}addOfflineSection_(){const a=
225
- this.resolveExternLink_(".OfflineConfiguration");this.addSection_("Offline",a).addBoolInput_("Use Persistent Licenses","offline.usePersistentLicense").addNumberInput_("Number of Parallel Downloads","offline.numberOfParallelDownloads")}addStreamingSection_(){const a=this.resolveExternLink_(".StreamingConfiguration");this.addSection_("Streaming",a).addNumberInput_("Gap detection threshold","streaming.gapDetectionThreshold",!0).addNumberInput_("Gap Jump Timer Time","streaming.gapJumpTimerTime",!0).addNumberInput_("Buffering Goal",
226
- "streaming.bufferingGoal",!0).addNumberInput_("Duration Backoff","streaming.durationBackoff",!0).addNumberInput_("Rebuffering Goal","streaming.rebufferingGoal",!0).addNumberInput_("Buffer Behind","streaming.bufferBehind",!0).addNumberInput_("Safe Seek Offset","streaming.safeSeekOffset",!0).addNumberInput_("Stall Threshold","streaming.stallThreshold",!0).addNumberInput_("Safe Skip Distance","streaming.stallSkip",!0).addNumberInput_("Inaccurate Manifest Tolerance","streaming.inaccurateManifestTolerance",
227
- !0).addBoolInput_("Low Latency Mode","streaming.lowLatencyMode").addBoolInput_("Auto Low Latency Mode","streaming.autoLowLatencyMode").addBoolInput_("Force HTTPS","streaming.forceHTTPS").addBoolInput_("Prefer native HLS playback when available","streaming.preferNativeHls").addNumberInput_("Update interval seconds","streaming.updateIntervalSeconds",!0).addBoolInput_("Dispatch all emsg boxes","streaming.dispatchAllEmsgBoxes").addBoolInput_("Observe media quality changes","streaming.observeQualityChanges").addNumberInput_("Max Variant Disabled Time",
228
- "streaming.maxDisabledTime").addNumberInput_("Segment Prefetch Limit","streaming.segmentPrefetchLimit").addBoolInput_("Live Sync","streaming.liveSync").addNumberInput_("Max latency for live sync","streaming.liveSyncMaxLatency",!0,!0).addNumberInput_("Playback rate for live sync","streaming.liveSyncPlaybackRate",!0,!1).addNumberInput_("Min latency for live sync","streaming.liveSyncMinLatency",!0,!0).addNumberInput_("Min playback rate for live sync","streaming.liveSyncMinPlaybackRate",!0,!1);shakaDemoMain.getNativeControlsEnabled()?
229
- (this.addCustomBoolInput_("Always Stream Text",b=>{},"Text must always be streamed while native controls are enabled, for captions to work."),this.latestInput_.input().disabled=!0,this.latestInput_.input().checked=!0):this.addBoolInput_("Always Stream Text","streaming.alwaysStreamText");this.addSelectInput_("Preferred HDR Level","preferredVideoHdrLevel",{"":"",AUTO:"AUTO",SDR:"SDR",PQ:"PQ",HLG:"HLG"},{AUTO:"Auto Detect",SDR:"SDR",PQ:"PQ",HLG:"HLG","":"No Preference"});this.addSelectInput_("Preferred video layout",
230
- "preferredVideoLayout",{"":"","CH-STEREO":"CH-STEREO","CH-MONO":"CH-MONO"},{"CH-STEREO":"Stereoscopic","CH-MONO":"Monoscopic","":"No Preference"});this.addBoolInput_("Start At Segment Boundary","streaming.startAtSegmentBoundary").addBoolInput_("Ignore Text Stream Failures","streaming.ignoreTextStreamFailures").addBoolInput_("Stall Detector Enabled","streaming.stallEnabled").addBoolInput_("Use native HLS on Safari","streaming.useNativeHlsOnSafari");this.addRetrySection_("streaming","Streaming Retry Parameters")}addMediaSourceSection_(){const a=
231
- shaka.config.CodecSwitchingStrategy,b=this.resolveExternLink_(".MediaSourceConfiguration");this.addSection_("Media source",b).addTextInput_("Source buffer extra features","mediaSource.sourceBufferExtraFeatures").addBoolInput_("Force Transmux","mediaSource.forceTransmux").addBoolInput_("Insert fake encryption in init segments when needed by the platform.","mediaSource.insertFakeEncryptionInInit").addSelectInput_("Codec Switching Strategy","mediaSource.codecSwitchingStrategy",a,{RELOAD:"reload",SMOOTH:"smooth"})}addLanguageSection_(){const a=
232
- this.resolveExternLink_(".PlayerConfiguration"),b=shaka.config.AutoShowText;this.addSection_("Language",a).addTextInput_("Preferred Audio Language","preferredAudioLanguage").addTextInput_("Preferred Audio Label","preferredAudioLabel").addTextInput_("Preferred Text Language","preferredTextLanguage").addTextInput_("Preferred Text Role","preferredTextRole").addSelectInput_("Auto-Show Text","autoShowText",b,{NEVER:"Never",ALWAYS:"Always",IF_PREFERRED_TEXT_LANGUAGE:"If preferred text language",IF_SUBTITLES_MAY_BE_NEEDED:"If subtitles may be needed"});
233
- this.addCustomTextInput_("Preferred UI Locale",c=>{shakaDemoMain.setUILocale(c.value);shakaDemoMain.remakeHash()});this.latestInput_.input().value=shakaDemoMain.getUILocale();this.addNumberInput_("Preferred Audio Channel Count","preferredAudioChannelCount");this.addBoolInput_("Prefer Forced Subs","preferForcedSubs")}addMetaSection_(){this.addSection_(null,null);this.addCustomBoolInput_("Shaka Controls",d=>{shakaDemoMain.setNativeControlsEnabled(!d.checked);d.checked&&(shakaDemoMain.configure("streaming.alwaysStreamText",
234
- !0),shakaDemoMain.remakeHash());this.reloadAndSaveState_()});shakaDemoMain.getNativeControlsEnabled()||(this.latestInput_.input().checked=!0);shakaDemoMain.getNativeControlsEnabled()?(this.addCustomBoolInput_("Enabled Trick Play Controls",d=>{},"Trick Play controls require the Shaka UI."),this.latestInput_.input().disabled=!0,this.latestInput_.input().checked=!1):(this.addCustomBoolInput_("Enabled Trick Play Controls",d=>{shakaDemoMain.setTrickPlayControlsEnabled(d.checked)}),shakaDemoMain.getTrickPlayControlsEnabled()&&
235
- (this.latestInput_.input().checked=!0));if(shaka.log){var a=shaka.log.Level,b=shaka.log.setLevel;this.addCustomSelectInput_("Log Level",{info:"Info",debug:"Debug",v:"Verbose",vv:"Very Verbose"},d=>{switch(d.value){case "info":b(a.INFO);break;case "debug":b(a.DEBUG);break;case "vv":b(a.V2);break;case "v":b(a.V1)}shakaDemoMain.remakeHash()});var c=this.latestInput_.input();switch(shaka.log.currentLevel){case a.DEBUG:c.value="debug";break;case a.V2:c.value="vv";break;case a.V1:c.value="v";break;default:c.value=
236
- "info"}}}resolveExternLink_(a){return"../docs/api/shaka.extern.html#"+a}addSection_(a,b){this.sections_.push(new shakaDemo.InputContainer(this.container_,a,a?shakaDemo.InputContainer.Style.ACCORDION:shakaDemo.InputContainer.Style.VERTICAL,b));return this}addBoolInput_(a,b,c){this.addCustomBoolInput_(a,d=>{shakaDemoMain.configure(b,d.checked);shakaDemoMain.remakeHash()},c);shakaDemoMain.getCurrentConfigValue(b)&&(this.latestInput_.input().checked=!0);return this}addCustomBoolInput_(a,b,c){this.createRow_(a,
237
- c);this.latestInput_=new shakaDemo.BoolInput(this.getLatestSection_(),a,b);return this}addTextInput_(a,b,c){this.addCustomTextInput_(a,d=>{shakaDemoMain.configure(b,d.value);shakaDemoMain.remakeHash()},c);this.latestInput_.input().value=shakaDemoMain.getCurrentConfigValue(b);return this}addCustomTextInput_(a,b,c){this.createRow_(a,c);this.latestInput_=new shakaDemo.TextInput(this.getLatestSection_(),a,b);return this}addNumberInput_(a,b,c=!1,d=!0,e=!1,f){this.createRow_(a,f);this.latestInput_=new shakaDemo.NumberInput(this.getLatestSection_(),
238
- a,g=>{shakaDemoMain.resetConfiguration(b);shakaDemoMain.remakeHash();"Infinity"==g.value?(shakaDemoMain.configure(b,Infinity),shakaDemoMain.remakeHash()):""==g.value&&e||(g=Number(g.value),0==g&&!d||isNaN(g)||Math.floor(g)!=g&&!c||(shakaDemoMain.configure(b,g),shakaDemoMain.remakeHash()))},c,d,e);this.latestInput_.input().value=shakaDemoMain.getCurrentConfigValue(b);isNaN(Number(this.latestInput_.input().value))&&e&&(this.latestInput_.input().value="");return this}addDatalistInput_(a,b,c,d){this.createRow_(a,
239
- d);this.latestInput_=new shakaDemo.DatalistInput(this.getLatestSection_(),a,c,b);return this}addCustomSelectInput_(a,b,c,d){this.createRow_(a,d);this.latestInput_=new shakaDemo.SelectInput(this.getLatestSection_(),null,c,b);return this}addSelectInput_(a,b,c,d,e){for(const f in c)f in d||(d[f]=f);this.addCustomSelectInput_(a,d,f=>{shakaDemoMain.configure(b,c[f.value]);shakaDemoMain.remakeHash()},e);a=shakaDemoMain.getCurrentConfigValue(b);for(const f in c)c[f]==a&&(this.latestInput_.input().value=
240
- f);return this}createRow_(a,b){this.getLatestSection_().addRow(a,b||null)}getLatestSection_(){goog.asserts.assert(0<this.sections_.length,"Must have at least one section.");return this.sections_[this.sections_.length-1]}};document.addEventListener("shaka-main-loaded",shakaDemo.Config.init);document.addEventListener("shaka-main-cleanup",()=>{shakaDemoConfig=null});let shakaDemoCustom;
216
+ "manifest.hls.defaultAudioCodec").addTextInput_("Default Video Codec","manifest.hls.defaultVideoCodec").addTextInput_("Default media playlist full mime type","manifest.hls.mediaPlaylistFullMimeType").addBoolInput_("Ignore Program Date Time from manifest","manifest.hls.ignoreManifestProgramDateTime").addBoolInput_("Use Safari behavior for live","manifest.hls.useSafariBehaviorForLive").addNumberInput_("Live segments delay","manifest.hls.liveSegmentsDelay").addBoolInput_("Enable HLS sequence mode","manifest.hls.sequenceMode").addBoolInput_("Ignore Manifest Timestamps in Segments Mode",
217
+ "manifest.hls.ignoreManifestTimestampsInSegmentsMode").addBoolInput_("Disable codec guessing","manifest.hls.disableCodecGuessing").addBoolInput_("Allow LL-HLS byterange optimization","manifest.hls.allowLowLatencyByteRangeOptimization").addNumberInput_("Availability Window Override","manifest.availabilityWindowOverride",!0,!1,!0).addTextInput_("Clock Sync URI","manifest.dash.clockSyncUri").addNumberInput_("Default Presentation Delay","manifest.defaultPresentationDelay").addBoolInput_("Enable Audio Groups",
218
+ "manifest.dash.enableAudioGroups").addBoolInput_("Ignore Min Buffer Time","manifest.dash.ignoreMinBufferTime").addNumberInput_("Initial Segment Limit","manifest.dash.initialSegmentLimit",!1,!1,!0).addBoolInput_("Enable DASH sequence mode","manifest.dash.sequenceMode").addBoolInput_("Disable Audio","manifest.disableAudio").addBoolInput_("Disable Video","manifest.disableVideo").addBoolInput_("Disable Text","manifest.disableText").addBoolInput_("Disable Thumbnails","manifest.disableThumbnails").addBoolInput_("Enable segment-relative VTT Timing",
219
+ "manifest.segmentRelativeVttTiming").addBoolInput_("Enable MSS sequence mode","manifest.mss.sequenceMode");this.addRetrySection_("manifest","Manifest Retry Parameters")}addAbrSection_(){const a=this.resolveExternLink_(".AbrConfiguration");this.addSection_("Adaptation",a).addBoolInput_("Enabled","abr.enabled").addBoolInput_("Use Network Information API","abr.useNetworkInformation").addNumberInput_("Default Bandwidth EstimatZ","abr.defaultBandwidthEstimate").addNumberInput_("Bandwidth Downgrade Target",
220
+ "abr.bandwidthDowngradeTarget",!0).addNumberInput_("Bandwidth Upgrade Target","abr.bandwidthUpgradeTarget",!0).addNumberInput_("Switch Interval","abr.switchInterval",!0).addNumberInput_("Min total Bytes","abr.advanced.minTotalBytes").addNumberInput_("Min Bytes","abr.advanced.minBytes").addNumberInput_("Fast half life","abr.advanced.fastHalfLife",!0).addNumberInput_("Slow half life","abr.advanced.slowHalfLife",!0).addBoolInput_("Restrict to element size","abr.restrictToElementSize").addBoolInput_("Restrict to screen size",
221
+ "abr.restrictToScreenSize").addBoolInput_("Ignore device pixel ratio","abr.ignoreDevicePixelRatio").addBoolInput_("Clear video buffer on abr rendition switch","abr.clearBufferSwitch").addNumberInput_("Safe margin on abr switch rendition","abr.safeMarginSwitch",!0);this.addRetrictionsSection_("abr","Adaptation Restrictions")}addCmcdSection_(){const a=this.resolveExternLink_(".CmcdConfiguration");this.addSection_("CMCD",a).addBoolInput_("Enabled","cmcd.enabled").addTextInput_("Session ID","cmcd.sessionId").addTextInput_("Content ID",
222
+ "cmcd.contentId").addBoolInput_("Use Headers","cmcd.useHeaders")}addLcevcSection_(){const a=this.resolveExternLink_(".LcevcConfiguration");this.addSection_("MPEG-5 Part-2 LCEVC",a).addBoolInput_("Enabled","lcevc.enabled").addBoolInput_("LCEVC Dynamic Performance scaling","lcevc.dynamicPerformanceScaling").addNumberInput_("LCEVC Log Level","lcevc.logLevel").addBoolInput_("Draw LCEVC Logo","lcevc.drawLogo")}addAdsSection_(){const a=this.resolveExternLink_(".AdsConfiguration");this.addSection_("Ads",
223
+ a).addBoolInput_("Custom playhead tracker","ads.customPlayheadTracker")}addRetrictionsSection_(a,b){a=(a?a+".":"")+"restrictions.";const c=this.resolveExternLink_(".Restrictions");this.addSection_(b,c).addNumberInput_("Min Width",a+"minWidth").addNumberInput_("Max Width",a+"maxWidth").addNumberInput_("Min Height",a+"minHeight").addNumberInput_("Max Height",a+"maxHeight").addNumberInput_("Min Pixels",a+"minPixels").addNumberInput_("Max Pixels",a+"maxPixels").addNumberInput_("Min Framerate",a+"minFrameRate").addNumberInput_("Max Framerate",
224
+ a+"maxFrameRate").addNumberInput_("Min Bandwidth",a+"minBandwidth").addNumberInput_("Max Bandwidth",a+"maxBandwidth")}addRetrySection_(a,b){a+=".retryParameters.";const c=this.resolveExternLink_(".RetryParameters");this.addSection_(b,c).addNumberInput_("Max Attempts",a+"maxAttempts").addNumberInput_("Base Delay",a+"baseDelay",!0).addNumberInput_("Backoff Factor",a+"backoffFactor",!0).addNumberInput_("Fuzz Factor",a+"fuzzFactor",!0).addNumberInput_("Timeout Factor",a+"timeout",!0).addNumberInput_("Stall Timeout",
225
+ a+"stallTimeout",!0).addNumberInput_("Connection Timeout",a+"connectionTimeout",!0)}addOfflineSection_(){const a=this.resolveExternLink_(".OfflineConfiguration");this.addSection_("Offline",a).addBoolInput_("Use Persistent Licenses","offline.usePersistentLicense").addNumberInput_("Number of Parallel Downloads","offline.numberOfParallelDownloads")}addStreamingSection_(){const a=this.resolveExternLink_(".StreamingConfiguration");this.addSection_("Streaming",a).addNumberInput_("Gap detection threshold",
226
+ "streaming.gapDetectionThreshold",!0).addNumberInput_("Gap Jump Timer Time","streaming.gapJumpTimerTime",!0).addNumberInput_("Buffering Goal","streaming.bufferingGoal",!0).addNumberInput_("Duration Backoff","streaming.durationBackoff",!0).addNumberInput_("Rebuffering Goal","streaming.rebufferingGoal",!0).addNumberInput_("Buffer Behind","streaming.bufferBehind",!0).addNumberInput_("Safe Seek Offset","streaming.safeSeekOffset",!0).addNumberInput_("Stall Threshold","streaming.stallThreshold",!0).addNumberInput_("Safe Skip Distance",
227
+ "streaming.stallSkip",!0).addNumberInput_("Inaccurate Manifest Tolerance","streaming.inaccurateManifestTolerance",!0).addBoolInput_("Low Latency Mode","streaming.lowLatencyMode").addBoolInput_("Auto Low Latency Mode","streaming.autoLowLatencyMode").addBoolInput_("Force HTTPS","streaming.forceHTTPS").addBoolInput_("Prefer native HLS playback when available","streaming.preferNativeHls").addNumberInput_("Update interval seconds","streaming.updateIntervalSeconds",!0).addBoolInput_("Dispatch all emsg boxes",
228
+ "streaming.dispatchAllEmsgBoxes").addBoolInput_("Observe media quality changes","streaming.observeQualityChanges").addNumberInput_("Max Variant Disabled Time","streaming.maxDisabledTime").addBoolInput_("Parse PRFT box","streaming.parsePrftBox").addNumberInput_("Segment Prefetch Limit","streaming.segmentPrefetchLimit").addBoolInput_("Live Sync","streaming.liveSync").addNumberInput_("Max latency for live sync","streaming.liveSyncMaxLatency",!0,!0).addNumberInput_("Playback rate for live sync","streaming.liveSyncPlaybackRate",
229
+ !0,!1).addNumberInput_("Min latency for live sync","streaming.liveSyncMinLatency",!0,!0).addNumberInput_("Min playback rate for live sync","streaming.liveSyncMinPlaybackRate",!0,!1);shakaDemoMain.getNativeControlsEnabled()?(this.addCustomBoolInput_("Always Stream Text",b=>{},"Text must always be streamed while native controls are enabled, for captions to work."),this.latestInput_.input().disabled=!0,this.latestInput_.input().checked=!0):this.addBoolInput_("Always Stream Text","streaming.alwaysStreamText");
230
+ this.addSelectInput_("Preferred HDR Level","preferredVideoHdrLevel",{"":"",AUTO:"AUTO",SDR:"SDR",PQ:"PQ",HLG:"HLG"},{AUTO:"Auto Detect",SDR:"SDR",PQ:"PQ",HLG:"HLG","":"No Preference"});this.addSelectInput_("Preferred video layout","preferredVideoLayout",{"":"","CH-STEREO":"CH-STEREO","CH-MONO":"CH-MONO"},{"CH-STEREO":"Stereoscopic","CH-MONO":"Monoscopic","":"No Preference"});this.addBoolInput_("Start At Segment Boundary","streaming.startAtSegmentBoundary").addBoolInput_("Ignore Text Stream Failures",
231
+ "streaming.ignoreTextStreamFailures").addBoolInput_("Stall Detector Enabled","streaming.stallEnabled").addBoolInput_("Use native HLS on Safari","streaming.useNativeHlsOnSafari");this.addRetrySection_("streaming","Streaming Retry Parameters")}addMediaSourceSection_(){const a=shaka.config.CodecSwitchingStrategy,b=this.resolveExternLink_(".MediaSourceConfiguration");this.addSection_("Media source",b).addTextInput_("Source buffer extra features","mediaSource.sourceBufferExtraFeatures").addBoolInput_("Force Transmux",
232
+ "mediaSource.forceTransmux").addBoolInput_("Insert fake encryption in init segments when needed by the platform.","mediaSource.insertFakeEncryptionInInit").addSelectInput_("Codec Switching Strategy","mediaSource.codecSwitchingStrategy",a,{RELOAD:"reload",SMOOTH:"smooth"})}addLanguageSection_(){const a=this.resolveExternLink_(".PlayerConfiguration"),b=shaka.config.AutoShowText;this.addSection_("Language",a).addTextInput_("Preferred Audio Language","preferredAudioLanguage").addTextInput_("Preferred Audio Label",
233
+ "preferredAudioLabel").addTextInput_("Preferred Variant Role","preferredVariantRole").addTextInput_("Preferred Text Language","preferredTextLanguage").addTextInput_("Preferred Text Role","preferredTextRole").addSelectInput_("Auto-Show Text","autoShowText",b,{NEVER:"Never",ALWAYS:"Always",IF_PREFERRED_TEXT_LANGUAGE:"If preferred text language",IF_SUBTITLES_MAY_BE_NEEDED:"If subtitles may be needed"});this.addCustomTextInput_("Preferred UI Locale",c=>{shakaDemoMain.setUILocale(c.value);shakaDemoMain.remakeHash()});
234
+ this.latestInput_.input().value=shakaDemoMain.getUILocale();this.addNumberInput_("Preferred Audio Channel Count","preferredAudioChannelCount");this.addBoolInput_("Prefer Forced Subs","preferForcedSubs")}addMetaSection_(){this.addSection_(null,null);this.addCustomBoolInput_("Shaka Controls",d=>{shakaDemoMain.setNativeControlsEnabled(!d.checked);d.checked&&(shakaDemoMain.configure("streaming.alwaysStreamText",!0),shakaDemoMain.remakeHash());this.reloadAndSaveState_()});shakaDemoMain.getNativeControlsEnabled()||
235
+ (this.latestInput_.input().checked=!0);shakaDemoMain.getNativeControlsEnabled()?(this.addCustomBoolInput_("Enabled Trick Play Controls",d=>{},"Trick Play controls require the Shaka UI."),this.latestInput_.input().disabled=!0,this.latestInput_.input().checked=!1):(this.addCustomBoolInput_("Enabled Trick Play Controls",d=>{shakaDemoMain.setTrickPlayControlsEnabled(d.checked)}),shakaDemoMain.getTrickPlayControlsEnabled()&&(this.latestInput_.input().checked=!0));if(shaka.log){var a=shaka.log.Level,b=
236
+ shaka.log.setLevel;this.addCustomSelectInput_("Log Level",{info:"Info",debug:"Debug",v:"Verbose",vv:"Very Verbose"},d=>{switch(d.value){case "info":b(a.INFO);break;case "debug":b(a.DEBUG);break;case "vv":b(a.V2);break;case "v":b(a.V1)}shakaDemoMain.remakeHash()});var c=this.latestInput_.input();switch(shaka.log.currentLevel){case a.DEBUG:c.value="debug";break;case a.V2:c.value="vv";break;case a.V1:c.value="v";break;default:c.value="info"}}}resolveExternLink_(a){return"../docs/api/shaka.extern.html#"+
237
+ a}addSection_(a,b){this.sections_.push(new shakaDemo.InputContainer(this.container_,a,a?shakaDemo.InputContainer.Style.ACCORDION:shakaDemo.InputContainer.Style.VERTICAL,b));return this}addBoolInput_(a,b,c){this.addCustomBoolInput_(a,d=>{shakaDemoMain.configure(b,d.checked);shakaDemoMain.remakeHash()},c);shakaDemoMain.getCurrentConfigValue(b)&&(this.latestInput_.input().checked=!0);return this}addCustomBoolInput_(a,b,c){this.createRow_(a,c);this.latestInput_=new shakaDemo.BoolInput(this.getLatestSection_(),
238
+ a,b);return this}addTextInput_(a,b,c){this.addCustomTextInput_(a,d=>{shakaDemoMain.configure(b,d.value);shakaDemoMain.remakeHash()},c);this.latestInput_.input().value=shakaDemoMain.getCurrentConfigValue(b);return this}addCustomTextInput_(a,b,c){this.createRow_(a,c);this.latestInput_=new shakaDemo.TextInput(this.getLatestSection_(),a,b);return this}addNumberInput_(a,b,c=!1,d=!0,e=!1,f){this.createRow_(a,f);this.latestInput_=new shakaDemo.NumberInput(this.getLatestSection_(),a,g=>{shakaDemoMain.resetConfiguration(b);
239
+ shakaDemoMain.remakeHash();"Infinity"==g.value?(shakaDemoMain.configure(b,Infinity),shakaDemoMain.remakeHash()):""==g.value&&e||(g=Number(g.value),0==g&&!d||isNaN(g)||Math.floor(g)!=g&&!c||(shakaDemoMain.configure(b,g),shakaDemoMain.remakeHash()))},c,d,e);this.latestInput_.input().value=shakaDemoMain.getCurrentConfigValue(b);isNaN(Number(this.latestInput_.input().value))&&e&&(this.latestInput_.input().value="");return this}addDatalistInput_(a,b,c,d){this.createRow_(a,d);this.latestInput_=new shakaDemo.DatalistInput(this.getLatestSection_(),
240
+ a,c,b);return this}addCustomSelectInput_(a,b,c,d){this.createRow_(a,d);this.latestInput_=new shakaDemo.SelectInput(this.getLatestSection_(),null,c,b);return this}addSelectInput_(a,b,c,d,e){for(const f in c)f in d||(d[f]=f);this.addCustomSelectInput_(a,d,f=>{shakaDemoMain.configure(b,c[f.value]);shakaDemoMain.remakeHash()},e);a=shakaDemoMain.getCurrentConfigValue(b);for(const f in c)c[f]==a&&(this.latestInput_.input().value=f);return this}createRow_(a,b){this.getLatestSection_().addRow(a,b||null)}getLatestSection_(){goog.asserts.assert(0<
241
+ this.sections_.length,"Must have at least one section.");return this.sections_[this.sections_.length-1]}};document.addEventListener("shaka-main-loaded",shakaDemo.Config.init);document.addEventListener("shaka-main-cleanup",()=>{shakaDemoConfig=null});let shakaDemoCustom;
241
242
  shakaDemo.Custom=class{static init(){const a=shakaDemoMain.addNavButton("custom");shakaDemoCustom=new shakaDemo.Custom(a.container)}constructor(a){this.dialog_=document.createElement("dialog");this.dialog_.classList.add("mdl-dialog");a.appendChild(this.dialog_);this.dialog_.showModal||dialogPolyfill.registerDialog(this.dialog_);this.assets_=this.loadAssetInfos_();this.assetCards_=[];this.savedList_=document.createElement("div");a.appendChild(this.savedList_);const b=document.createElement("div");b.classList.add("add-button-container");
242
243
  a.appendChild(b);const c=this.makeButton_("add",shakaDemo.Custom.ButtonStyle_.FAB,()=>{this.showAssetDialog_(ShakaDemoAssetInfo.makeBlankAsset())});b.appendChild(c);document.addEventListener("shaka-main-selected-asset-changed",()=>{this.updateSelected_()});document.addEventListener("shaka-main-offline-progress",()=>{this.updateOfflineProgress_()});document.addEventListener("shaka-main-page-changed",()=>{this.savedList_.childNodes.length||a.classList.contains("hidden")||this.remakeSavedList_()})}assets(){return Array.from(this.assets_)}updateOfflineProgress_(){for(const a of this.assetCards_)a.updateProgress()}makeField_(a,
243
244
  b,c,d,e){a.addRow(null,null);a=new shakaDemo.TextInput(a,b,d,e);a.extra().textContent=b;c(a.input(),a.container())}makeAssetDialogContentsHeaders_(a,b){const c=document.createElement("div"),d=[],e=(f,g)=>{const h=document.createElement("div");c.appendChild(h);const l=new shakaDemo.InputContainer(h,"License Header",shakaDemo.InputContainer.Style.VERTICAL,null),p={headerName:f,div:h};d.push(p);let k=!f;const m=(n,q)=>{f&&a.licenseRequestHeaders.delete(f);f=n;p.headerName=n;g=q;if(f&&g){k&&(k=!1,e(null,