shaka-player 3.1.5 → 3.2.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 (134) hide show
  1. package/CHANGELOG.md +129 -6
  2. package/README.md +4 -4
  3. package/build/types/polyfill +1 -0
  4. package/demo/common/asset.js +9 -7
  5. package/demo/common/assets.js +10 -1
  6. package/demo/common/message_ids.js +2 -1
  7. package/demo/config.js +5 -2
  8. package/demo/index.html +1 -1
  9. package/demo/locales/en.json +2 -1
  10. package/demo/locales/source.json +8 -4
  11. package/demo/main.js +2 -1
  12. package/dist/demo.compiled.debug.js +14 -14
  13. package/dist/demo.compiled.debug.map +2 -2
  14. package/dist/demo.compiled.js +14 -14
  15. package/dist/demo.compiled.map +2 -2
  16. package/dist/deps.js +21 -20
  17. package/dist/locales.js +30 -30
  18. package/dist/receiver.compiled.debug.js +8 -8
  19. package/dist/receiver.compiled.debug.map +2 -2
  20. package/dist/receiver.compiled.js +8 -8
  21. package/dist/receiver.compiled.map +2 -2
  22. package/dist/shaka-player.compiled.d.ts +63 -10
  23. package/dist/shaka-player.compiled.debug.d.ts +63 -10
  24. package/dist/shaka-player.compiled.debug.externs.js +786 -716
  25. package/dist/shaka-player.compiled.debug.js +563 -534
  26. package/dist/shaka-player.compiled.debug.map +4 -4
  27. package/dist/shaka-player.compiled.externs.js +786 -716
  28. package/dist/shaka-player.compiled.js +820 -809
  29. package/dist/shaka-player.compiled.map +4 -4
  30. package/dist/shaka-player.ui.d.ts +63 -10
  31. package/dist/shaka-player.ui.debug.d.ts +63 -10
  32. package/dist/shaka-player.ui.debug.externs.js +542 -472
  33. package/dist/shaka-player.ui.debug.js +594 -566
  34. package/dist/shaka-player.ui.debug.map +4 -4
  35. package/dist/shaka-player.ui.externs.js +542 -472
  36. package/dist/shaka-player.ui.js +938 -927
  37. package/dist/shaka-player.ui.map +4 -4
  38. package/docs/tutorials/ui.md +5 -5
  39. package/externs/aria.js +6 -0
  40. package/externs/shaka/ads.js +24 -1
  41. package/externs/shaka/manifest.js +6 -1
  42. package/externs/shaka/offline.js +5 -0
  43. package/externs/shaka/player.js +61 -9
  44. package/externs/shaka/text.js +10 -10
  45. package/externs/texttrack.js +3 -0
  46. package/lib/ads/ad_manager.js +16 -15
  47. package/lib/ads/client_side_ad_manager.js +6 -2
  48. package/lib/ads/server_side_ad_manager.js +19 -2
  49. package/lib/cast/cast_proxy.js +8 -0
  50. package/lib/cast/cast_utils.js +6 -1
  51. package/lib/cea/cea608_data_channel.js +56 -56
  52. package/lib/cea/cea608_memory.js +33 -33
  53. package/lib/cea/cea708_service.js +43 -43
  54. package/lib/cea/cea708_window.js +38 -38
  55. package/lib/cea/cea_decoder.js +13 -14
  56. package/lib/cea/cea_utils.js +23 -23
  57. package/lib/cea/dtvcc_packet_builder.js +7 -7
  58. package/lib/cea/i_caption_decoder.js +2 -3
  59. package/lib/cea/i_cea_parser.js +2 -2
  60. package/lib/cea/mp4_cea_parser.js +6 -6
  61. package/lib/dash/dash_parser.js +5 -0
  62. package/lib/hls/hls_parser.js +159 -12
  63. package/lib/media/closed_caption_parser.js +1 -2
  64. package/lib/media/drm_engine.js +162 -192
  65. package/lib/media/segment_index.js +4 -1
  66. package/lib/media/segment_reference.js +37 -2
  67. package/lib/media/streaming_engine.js +6 -6
  68. package/lib/net/networking_engine.js +1 -0
  69. package/lib/offline/download_manager.js +1 -2
  70. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  71. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  72. package/lib/offline/manifest_converter.js +3 -1
  73. package/lib/offline/storage.js +12 -14
  74. package/lib/player.js +426 -149
  75. package/lib/polyfill/aria.js +82 -0
  76. package/lib/routing/walker.js +2 -3
  77. package/lib/text/srt_text_parser.js +4 -4
  78. package/lib/text/text_engine.js +2 -2
  79. package/lib/text/vtt_text_parser.js +2 -2
  80. package/lib/text/web_vtt_generator.js +55 -12
  81. package/lib/util/error.js +6 -0
  82. package/lib/util/manifest_parser_utils.js +1 -0
  83. package/lib/util/mp4_box_parsers.js +20 -20
  84. package/lib/util/multi_map.js +8 -0
  85. package/lib/util/player_configuration.js +13 -1
  86. package/lib/util/stream_utils.js +168 -88
  87. package/lib/util/xml_utils.js +31 -12
  88. package/package.json +1 -1
  89. package/roadmap.md +24 -22
  90. package/shaka-player.uncompiled.js +1 -0
  91. package/test/cast/cast_utils_unit.js +1 -0
  92. package/test/cea/cea608_memory_unit.js +1 -1
  93. package/test/cea/cea708_service_unit.js +8 -8
  94. package/test/cea/cea708_window_unit.js +6 -6
  95. package/test/cea/cea_decoder_unit.js +1 -1
  96. package/test/cea/dtvcc_packet_builder_unit.js +2 -2
  97. package/test/dash/dash_parser_manifest_unit.js +43 -1
  98. package/test/hls/hls_parser_unit.js +250 -0
  99. package/test/media/drm_engine_integration.js +86 -12
  100. package/test/media/drm_engine_unit.js +310 -450
  101. package/test/offline/manifest_convert_unit.js +2 -0
  102. package/test/offline/storage_integration.js +9 -19
  103. package/test/player_integration.js +85 -0
  104. package/test/player_src_equals_integration.js +85 -0
  105. package/test/player_unit.js +25 -37
  106. package/test/test/assets/chapters.srt +11 -0
  107. package/test/test/assets/chapters.vtt +10 -0
  108. package/test/test/assets/chapters2.vtt +10 -0
  109. package/test/test/util/cea_utils.js +12 -12
  110. package/test/test/util/fake_ad_manager.js +7 -0
  111. package/test/test/util/manifest_generator.js +2 -0
  112. package/test/test/util/manifest_parser_util.js +3 -1
  113. package/test/text/web_vtt_generator_unit.js +81 -7
  114. package/test/util/stream_utils_unit.js +118 -10
  115. package/ui/airplay_button.js +1 -1
  116. package/ui/audio_language_selection.js +2 -5
  117. package/ui/cast_button.js +4 -6
  118. package/ui/constants.js +0 -3
  119. package/ui/fast_forward_button.js +2 -3
  120. package/ui/fullscreen_button.js +1 -3
  121. package/ui/language_utils.js +1 -1
  122. package/ui/loop_button.js +1 -3
  123. package/ui/mute_button.js +1 -3
  124. package/ui/overflow_menu.js +2 -3
  125. package/ui/pip_button.js +5 -7
  126. package/ui/playback_rate_selection.js +3 -6
  127. package/ui/presentation_time.js +1 -3
  128. package/ui/resolution_selection.js +4 -7
  129. package/ui/rewind_button.js +2 -3
  130. package/ui/seek_bar.js +2 -4
  131. package/ui/spacer.js +1 -1
  132. package/ui/text_selection.js +8 -11
  133. package/ui/ui_utils.js +1 -1
  134. package/ui/volume_bar.js +1 -3
@@ -1004,10 +1004,10 @@ shaka.media.StreamingEngine = class {
1004
1004
  if (bufferedAhead >= scaledBufferingGoal) {
1005
1005
  shaka.log.v2(logPrefix, 'buffering goal met');
1006
1006
 
1007
- // Do not try to predict the next update. Just poll twice every second.
1008
- // The playback rate can change at any time, so any prediction we make now
1009
- // could be terribly invalid soon.
1010
- return 0.5;
1007
+ // Do not try to predict the next update. Just poll according to
1008
+ // configuration (seconds). The playback rate can change at any time, so
1009
+ // any prediction we make now could be terribly invalid soon.
1010
+ return this.config_.updateIntervalSeconds / 2;
1011
1011
  }
1012
1012
 
1013
1013
  const bufferEnd =
@@ -1019,7 +1019,7 @@ shaka.media.StreamingEngine = class {
1019
1019
  // In any case just try again... if the manifest is incomplete or is not
1020
1020
  // being updated then we'll idle forever; otherwise, we'll end up getting
1021
1021
  // a SegmentReference eventually.
1022
- return 1;
1022
+ return this.config_.updateIntervalSeconds;
1023
1023
  }
1024
1024
 
1025
1025
  // Do not let any one stream get far ahead of any other.
@@ -1050,7 +1050,7 @@ shaka.media.StreamingEngine = class {
1050
1050
  // For example, let video buffering catch up to audio buffering before
1051
1051
  // fetching another audio segment.
1052
1052
  shaka.log.v2(logPrefix, 'waiting for other streams to buffer');
1053
- return 1;
1053
+ return this.config_.updateIntervalSeconds;
1054
1054
  }
1055
1055
 
1056
1056
  const p = this.fetchAndAppend_(mediaState, presentationTime, reference);
@@ -707,6 +707,7 @@ shaka.net.NetworkingEngine.RequestType = {
707
707
  'LICENSE': 2,
708
708
  'APP': 3,
709
709
  'TIMING': 4,
710
+ 'SERVER_CERTIFICATE': 5,
710
711
  };
711
712
 
712
713
 
@@ -44,9 +44,8 @@ shaka.offline.DownloadManager = class {
44
44
 
45
45
  /** @private {!shaka.util.Destroyer} */
46
46
  this.destroyer_ = new shaka.util.Destroyer(() => {
47
- const promises = Array.from(this.groups_.values());
48
47
  // Add a "catch" block to stop errors from being returned.
49
- return Promise.all(promises.map((p) => p.catch(() => {})));
48
+ return this.abortAll().catch(() => {});
50
49
  });
51
50
 
52
51
  /**
@@ -204,6 +204,7 @@ shaka.offline.indexeddb.V1StorageCell = class
204
204
  appendWindowStart,
205
205
  appendWindowEnd,
206
206
  timestampOffset,
207
+ tilesLayout: '',
207
208
  };
208
209
  }
209
210
 
@@ -148,6 +148,7 @@ shaka.offline.indexeddb.V2StorageCell = class
148
148
  appendWindowEnd: periodEnd,
149
149
  timestampOffset,
150
150
  dataKey: old.dataKey,
151
+ tilesLayout: '',
151
152
  };
152
153
  }
153
154
  };
@@ -229,7 +229,9 @@ shaka.offline.ManifestConverter = class {
229
229
  initSegmentReference,
230
230
  segmentDB.timestampOffset,
231
231
  segmentDB.appendWindowStart,
232
- segmentDB.appendWindowEnd);
232
+ segmentDB.appendWindowEnd,
233
+ /* partialReferences= */ [],
234
+ segmentDB.tilesLayout || '');
233
235
  }
234
236
 
235
237
  /**
@@ -484,25 +484,23 @@ shaka.offline.Storage = class {
484
484
  const maxHwRes = {width: Infinity, height: Infinity};
485
485
  StreamUtils.filterByRestrictions(manifest, config.restrictions, maxHwRes);
486
486
 
487
- // Filter the manifest based on what we know media source will be able to
488
- // play later (no point storing something we can't play).
489
- if (config.useMediaCapabilities) {
490
- StreamUtils.filterManifestByMediaCapabilities(
491
- manifest, config.offline.usePersistentLicense);
492
- } else {
493
- StreamUtils.filterManifestByMediaSource(manifest);
494
- // Filter the manifest based on what we know our drm system will support
495
- // playing later.
496
- StreamUtils.filterManifestByDrm(manifest, drmEngine);
497
- }
487
+ // Filter the manifest based on what we know MediaCapabilities will be able
488
+ // to play later (no point storing something we can't play).
489
+ StreamUtils.filterManifestByMediaCapabilities(
490
+ manifest, config.offline.usePersistentLicense);
498
491
 
499
492
  // Gather all tracks.
500
493
  const allTracks = [];
501
494
 
502
495
  // Choose the codec that has the lowest average bandwidth.
503
496
  const preferredAudioChannelCount = config.preferredAudioChannelCount;
497
+ const preferredDecodingAttributes = config.preferredDecodingAttributes;
498
+ const preferredVideoCodecs = config.preferredVideoCodecs;
499
+ const preferredAudioCodecs = config.preferredAudioCodecs;
500
+
504
501
  StreamUtils.chooseCodecsAndFilterManifest(
505
- manifest, preferredAudioChannelCount);
502
+ manifest, preferredVideoCodecs, preferredAudioCodecs,
503
+ preferredAudioChannelCount, preferredDecodingAttributes);
506
504
 
507
505
  for (const variant of manifest.variants) {
508
506
  goog.asserts.assert(
@@ -1001,8 +999,7 @@ shaka.offline.Storage = class {
1001
999
 
1002
1000
  drmEngine.configure(config.drm);
1003
1001
  await drmEngine.initForStorage(
1004
- manifest.variants, config.offline.usePersistentLicense,
1005
- config.useMediaCapabilities);
1002
+ manifest.variants, config.offline.usePersistentLicense);
1006
1003
  await drmEngine.setServerCertificate();
1007
1004
  await drmEngine.createOrLoad();
1008
1005
 
@@ -1204,6 +1201,7 @@ shaka.offline.Storage = class {
1204
1201
  appendWindowStart: segment.appendWindowStart,
1205
1202
  appendWindowEnd: segment.appendWindowEnd,
1206
1203
  timestampOffset: segment.timestampOffset,
1204
+ tilesLayout: segment.tilesLayout,
1207
1205
  dataKey,
1208
1206
  });
1209
1207
  });