shaka-player 4.6.1 → 4.6.3

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 (47) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/CONTRIBUTORS +1 -0
  3. package/demo/config.js +5 -0
  4. package/demo/custom.js +2 -0
  5. package/dist/demo.compiled.debug.js +29 -28
  6. package/dist/demo.compiled.debug.map +2 -2
  7. package/dist/demo.compiled.js +29 -28
  8. package/dist/demo.compiled.map +2 -2
  9. package/dist/locales.js +32 -32
  10. package/dist/shaka-player.compiled.d.ts +1 -0
  11. package/dist/shaka-player.compiled.debug.d.ts +1 -0
  12. package/dist/shaka-player.compiled.debug.externs.js +1 -0
  13. package/dist/shaka-player.compiled.debug.js +274 -270
  14. package/dist/shaka-player.compiled.debug.map +3 -3
  15. package/dist/shaka-player.compiled.externs.js +1 -0
  16. package/dist/shaka-player.compiled.js +862 -860
  17. package/dist/shaka-player.compiled.map +3 -3
  18. package/dist/shaka-player.ui.d.ts +1 -0
  19. package/dist/shaka-player.ui.debug.d.ts +1 -0
  20. package/dist/shaka-player.ui.debug.externs.js +1 -0
  21. package/dist/shaka-player.ui.debug.js +188 -184
  22. package/dist/shaka-player.ui.debug.map +3 -3
  23. package/dist/shaka-player.ui.externs.js +1 -0
  24. package/dist/shaka-player.ui.js +1000 -997
  25. package/dist/shaka-player.ui.map +3 -3
  26. package/docs/tutorials/lcevc.md +2 -2
  27. package/externs/lcevc.js +6 -0
  28. package/externs/shaka/codecs.js +6 -0
  29. package/externs/shaka/transmuxer.js +6 -0
  30. package/lib/cea/cea608_memory.js +13 -2
  31. package/lib/dash/dash_parser.js +2 -2
  32. package/lib/hls/hls_parser.js +2 -1
  33. package/lib/media/media_source_engine.js +11 -5
  34. package/lib/media/segment_reference.js +2 -1
  35. package/lib/media/streaming_engine.js +1 -1
  36. package/lib/player.js +1 -1
  37. package/lib/text/ui_text_displayer.js +50 -4
  38. package/lib/transmuxer/ts_transmuxer.js +15 -0
  39. package/lib/util/error.js +6 -0
  40. package/lib/util/mp4_box_parsers.js +39 -5
  41. package/package.json +2 -2
  42. package/test/cea/cea608_memory_unit.js +8 -8
  43. package/test/cea/cea_decoder_unit.js +11 -11
  44. package/test/demo/demo_unit.js +0 -3
  45. package/test/test/assets/audio-xhe-aac.mp4 +0 -0
  46. package/test/util/mp4_box_parsers_unit.js +36 -0
  47. package/ui/presentation_time.js +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.6.3](https://github.com/shaka-project/shaka-player/compare/v4.6.2...v4.6.3) (2023-11-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **DASH:** Fix bad url when specify using a full WebVTT with BaseURL ([#5954](https://github.com/shaka-project/shaka-player/issues/5954)) ([b77d73a](https://github.com/shaka-project/shaka-player/commit/b77d73aaf46f44bded11505c1bafbc01708afd12))
9
+ * **Demo:** Pressing "Edit" button unstores custom asset, but does not update "stored" button ([#5936](https://github.com/shaka-project/shaka-player/issues/5936)) ([7e2e543](https://github.com/shaka-project/shaka-player/commit/7e2e5439658220e221645f4089b472cf7bc5cdce))
10
+ * Fix ESDS box parser ([#5952](https://github.com/shaka-project/shaka-player/issues/5952)) ([ceff4e7](https://github.com/shaka-project/shaka-player/commit/ceff4e79442aba858d332df6ae894e4b5f4284d4))
11
+ * Fix reset Media Source when using mixed codecs in different containers ([#5949](https://github.com/shaka-project/shaka-player/issues/5949)) ([2a2df18](https://github.com/shaka-project/shaka-player/commit/2a2df182fd98aaee9afe6ad456c740745e67b0b9))
12
+ * **HLS:** Fix m4s extension detection ([#5951](https://github.com/shaka-project/shaka-player/issues/5951)) ([aa1c361](https://github.com/shaka-project/shaka-player/commit/aa1c361a8ac50688893d96be6981d90859c2b526))
13
+ * Properly size region anchor from LINE units ([#5941](https://github.com/shaka-project/shaka-player/issues/5941)) ([35ecd06](https://github.com/shaka-project/shaka-player/commit/35ecd060650a2db5a4d494440510d4f605998e8e))
14
+
15
+ ## [4.6.2](https://github.com/shaka-project/shaka-player/compare/v4.6.1...v4.6.2) (2023-11-27)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **CEA:** Fix positioning in CEA-608 ([#5925](https://github.com/shaka-project/shaka-player/issues/5925)) ([bc2f542](https://github.com/shaka-project/shaka-player/commit/bc2f542e3adf36f0e828c95e20fec9043fe50cc2))
21
+ * **Demo:** Allow configure some missing configs ([#5918](https://github.com/shaka-project/shaka-player/issues/5918)) ([8144dd3](https://github.com/shaka-project/shaka-player/commit/8144dd390928013fe3081732ff4638414e4eafc2))
22
+ * Fix init segment comparison ([#5920](https://github.com/shaka-project/shaka-player/issues/5920)) ([ebd20b6](https://github.com/shaka-project/shaka-player/commit/ebd20b6b3529bd672040f42e3ce8957342faf02e))
23
+ * Fix transmuxer when sample has no video data ([#5933](https://github.com/shaka-project/shaka-player/issues/5933)) ([8070f0f](https://github.com/shaka-project/shaka-player/commit/8070f0fe1d4eb8d893e2f1a52ccbfe6306f0118f))
24
+ * Only append to the buffer init segments when the segment is independent ([#5921](https://github.com/shaka-project/shaka-player/issues/5921)) ([3db2b2d](https://github.com/shaka-project/shaka-player/commit/3db2b2d68331432533119517892198d6927376e0))
25
+ * **UI:** Correctly display video time and duration for VOD ([#5929](https://github.com/shaka-project/shaka-player/issues/5929)) ([d51f18a](https://github.com/shaka-project/shaka-player/commit/d51f18ad9e097b43939c61b979a3399dd2a1bf1f))
26
+
3
27
  ## [4.6.1](https://github.com/shaka-project/shaka-player/compare/v4.6.0...v4.6.1) (2023-11-22)
4
28
 
5
29
 
package/CONTRIBUTORS CHANGED
@@ -55,6 +55,7 @@ Esteban Dosztal <edosztal@gmail.com>
55
55
  Fadomire <fadomire@gmail.com>
56
56
  Fernando Neira <slocomber@gmail.com>
57
57
  François Beaufort <fbeaufort@google.com>
58
+ Gary Katsevman <git@gkatsev.com>
58
59
  Gerardo Meola <meola.gerardo@gmail.com>
59
60
  Gil Gonen <gil.gonen@gmail.com>
60
61
  Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
package/demo/config.js CHANGED
@@ -200,6 +200,8 @@ shakaDemo.Config = class {
200
200
  'manifest.hls.ignoreImageStreamFailures')
201
201
  .addTextInput_('Default Audio Codec', 'manifest.hls.defaultAudioCodec')
202
202
  .addTextInput_('Default Video Codec', 'manifest.hls.defaultVideoCodec')
203
+ .addTextInput_('Default media playlist full mime type',
204
+ 'manifest.hls.mediaPlaylistFullMimeType')
203
205
  .addBoolInput_('Ignore Program Date Time from manifest',
204
206
  'manifest.hls.ignoreManifestProgramDateTime')
205
207
  .addBoolInput_('Use Safari behavior for live',
@@ -401,6 +403,8 @@ shakaDemo.Config = class {
401
403
  'streaming.observeQualityChanges')
402
404
  .addNumberInput_('Max Variant Disabled Time',
403
405
  'streaming.maxDisabledTime')
406
+ .addBoolInput_('Parse PRFT box',
407
+ 'streaming.parsePrftBox')
404
408
  .addNumberInput_('Segment Prefetch Limit',
405
409
  'streaming.segmentPrefetchLimit')
406
410
  .addBoolInput_('Live Sync', 'streaming.liveSync')
@@ -510,6 +514,7 @@ shakaDemo.Config = class {
510
514
  this.addSection_('Language', docLink)
511
515
  .addTextInput_('Preferred Audio Language', 'preferredAudioLanguage')
512
516
  .addTextInput_('Preferred Audio Label', 'preferredAudioLabel')
517
+ .addTextInput_('Preferred Variant Role', 'preferredVariantRole')
513
518
  .addTextInput_('Preferred Text Language', 'preferredTextLanguage')
514
519
  .addTextInput_('Preferred Text Role', 'preferredTextRole')
515
520
  .addSelectInput_('Auto-Show Text',
package/demo/custom.js CHANGED
@@ -828,6 +828,8 @@ shakaDemo.Custom = class {
828
828
  c.addButton('Edit', async () => {
829
829
  if (asset.unstoreCallback) {
830
830
  await asset.unstoreCallback();
831
+ this.saveAssetInfos_(this.assets_);
832
+ this.remakeSavedList_();
831
833
  }
832
834
  this.showAssetDialog_(asset);
833
835
  });
@@ -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,
@@ -256,9 +257,9 @@ var b=[];const c=document.createElement("div"),d=this.makeAssetDialogContentsMai
256
257
  q.classList.remove("hidden");for(const u of m)u.classList.remove("mdl-button--accent");t.classList.add("mdl-button--accent")});p.appendChild(t);k.push(q);m.push(t);r?t.classList.add("mdl-button--accent"):q.classList.add("hidden")};b("Main",d,!0);b("Drm",e,!1);b("Headers",f,!1);b("Ads",g,!1);b("Extra Tracks",h,!1);b("Extra Config",l,!1);this.dialog_.appendChild(p);this.dialog_.appendChild(d);this.dialog_.appendChild(e);this.dialog_.appendChild(f);this.dialog_.appendChild(g);this.dialog_.appendChild(h);
257
258
  this.dialog_.appendChild(l);this.dialog_.appendChild(a);this.dialog_.appendChild(c);componentHandler.upgradeDom();this.dialog_.showModal()}loadAssetInfos_(){var a=window.localStorage.getItem(shakaDemo.Custom.saveId_);return a?(a=JSON.parse(a),new Set(a.map(b=>{b=ShakaDemoAssetInfo.fromJSON(b);shakaDemoMain.setupOfflineSupport(b);return b}))):new Set}saveAssetInfos_(a){const b=shakaDemo.Custom.saveId_;a=Array.from(a);window.localStorage.setItem(b,JSON.stringify(a))}makeButton_(a,b,c){const d=document.createElement("button");
258
259
  switch(b){case shakaDemo.Custom.ButtonStyle_.FAB:d.classList.add("mdl-button--fab");d.classList.add("mdl-button--colored");b=document.createElement("i");b.classList.add("material-icons-round");b.textContent=a;d.appendChild(b);break;case shakaDemo.Custom.ButtonStyle_.RAISED:d.textContent=a;d.classList.add("mdl-button--raised");break;case shakaDemo.Custom.ButtonStyle_.PLAIN:d.textContent=a}d.addEventListener("click",c);d.classList.add("mdl-button");d.classList.add("mdl-js-button");d.classList.add("mdl-js-ripple-effect");
259
- return d}createAssetCardFor_(a){return new shakaDemo.AssetCard(this.savedList_,a,!1,b=>{b.addButton("Play",()=>{shakaDemoMain.loadAsset(a);this.updateSelected_()});b.addButton("Edit",async()=>{a.unstoreCallback&&await a.unstoreCallback();this.showAssetDialog_(a)});b.addButton("Delete",async()=>{this.assets_.delete(a);a.unstoreCallback&&await a.unstoreCallback();this.saveAssetInfos_(this.assets_);this.remakeSavedList_()},"Delete this custom asset?");b.addStoreButton()})}updateSelected_(){for(const a of this.assetCards_)a.selectByAsset(shakaDemoMain.selectedAsset)}remakeSavedList_(){shaka.util.Dom.removeAllChildren(this.savedList_);
260
- if(0==this.assets_.size){const a=(b,c)=>{const d=document.createElement("h2");d.classList.add("mdl-typography--"+b);d.textContent=c;this.savedList_.appendChild(d)};a("title","Try Shaka Player with your own content!");a("body-2","Press the button below to add a custom asset.");a("body-1","Custom assets will remain even after reloading the page.")}else this.assetCards_=Array.from(this.assets_).map(a=>this.createAssetCardFor_(a)),this.updateSelected_()}};
261
- shakaDemo.Custom.ButtonStyle_={RAISED:0,FAB:1,PLAIN:2};shakaDemo.Custom.saveId_="shakaPlayerDemoSavedAssets";document.addEventListener("shaka-main-loaded",shakaDemo.Custom.init);document.addEventListener("shaka-main-cleanup",()=>{shakaDemoCustom=null});shakaDemo.Utils=class{static runThroughHashParams(a,b){const c=[],d=(l,p)=>{c.push(p);a(l,p)};d("audiolang","preferredAudioLanguage");d("textlang","preferredTextLanguage");d("textrole","preferredTextRole");d("channels","preferredAudioChannelCount");c.push("abr.enabled");c.push("drm.advanced");c.push("drm.servers");const e=[],f=[],g=l=>{for(const p in l){e.includes(p)&&!f.includes(p)&&f.push(p);e.push(p);const k=l[p];"number"!=typeof k&&"string"!=typeof k&&"boolean"!=typeof k&&g(k)}};g(b);const h=
260
+ return d}createAssetCardFor_(a){return new shakaDemo.AssetCard(this.savedList_,a,!1,b=>{b.addButton("Play",()=>{shakaDemoMain.loadAsset(a);this.updateSelected_()});b.addButton("Edit",async()=>{a.unstoreCallback&&(await a.unstoreCallback(),this.saveAssetInfos_(this.assets_),this.remakeSavedList_());this.showAssetDialog_(a)});b.addButton("Delete",async()=>{this.assets_.delete(a);a.unstoreCallback&&await a.unstoreCallback();this.saveAssetInfos_(this.assets_);this.remakeSavedList_()},"Delete this custom asset?");
261
+ b.addStoreButton()})}updateSelected_(){for(const a of this.assetCards_)a.selectByAsset(shakaDemoMain.selectedAsset)}remakeSavedList_(){shaka.util.Dom.removeAllChildren(this.savedList_);if(0==this.assets_.size){const a=(b,c)=>{const d=document.createElement("h2");d.classList.add("mdl-typography--"+b);d.textContent=c;this.savedList_.appendChild(d)};a("title","Try Shaka Player with your own content!");a("body-2","Press the button below to add a custom asset.");a("body-1","Custom assets will remain even after reloading the page.")}else this.assetCards_=
262
+ Array.from(this.assets_).map(a=>this.createAssetCardFor_(a)),this.updateSelected_()}};shakaDemo.Custom.ButtonStyle_={RAISED:0,FAB:1,PLAIN:2};shakaDemo.Custom.saveId_="shakaPlayerDemoSavedAssets";document.addEventListener("shaka-main-loaded",shakaDemo.Custom.init);document.addEventListener("shaka-main-cleanup",()=>{shakaDemoCustom=null});shakaDemo.Utils=class{static runThroughHashParams(a,b){const c=[],d=(l,p)=>{c.push(p);a(l,p)};d("audiolang","preferredAudioLanguage");d("textlang","preferredTextLanguage");d("textrole","preferredTextRole");d("channels","preferredAudioChannelCount");c.push("abr.enabled");c.push("drm.advanced");c.push("drm.servers");const e=[],f=[],g=l=>{for(const p in l){e.includes(p)&&!f.includes(p)&&f.push(p);e.push(p);const k=l[p];"number"!=typeof k&&"string"!=typeof k&&"boolean"!=typeof k&&g(k)}};g(b);const h=
262
263
  (l,p)=>{for(const k in l){let m=k;const n=p+k;if(c.includes(n))continue;f.includes(k)&&(m=n);const q=l[k];"number"==typeof q||"string"==typeof q||"boolean"==typeof q?a(m,n):h(q,n+".")}};h(b,"")}static browserSupportsUncompiledMode(){try{return eval("async ()=>{}"),!0}catch(a){return!1}}};let shakaDemoFront;
263
264
  shakaDemo.Front=class{static init(){const a=shakaDemoMain.addNavButton("front");shakaDemoFront=new shakaDemo.Front(a.container)}constructor(a){this.assetCards_=[];this.messageDiv_=document.createElement("div");this.assetCardDiv_=document.createElement("div");a.appendChild(this.messageDiv_);this.makeMessage_();a.appendChild(this.assetCardDiv_);document.addEventListener("shaka-main-selected-asset-changed",()=>{this.updateSelected_()});document.addEventListener("shaka-main-offline-progress",()=>{this.updateOfflineProgress_()});
264
265
  document.addEventListener("shaka-main-page-changed",()=>{this.assetCardDiv_.childNodes.length||a.classList.contains("hidden")||this.remakeAssetCards_()})}makeMessage_(){if(!window.localStorage.getItem("shakaPlayerHideFrontMessage")){var a=(b,c)=>{const d=document.createElement("h2");d.classList.add("mdl-typography--"+b);d.textContent=c;this.messageDiv_.appendChild(d)};a("body-2","This is a demo of Google's Shaka Player, a JavaScript library for adaptive video streaming.");a("body-1",'Choose a video to playback; more assets are available via the "all content" tab.');