shaka-player 3.3.5 → 4.0.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 (184) hide show
  1. package/.github/config.yml +1 -0
  2. package/.github/workflows/demo-version-index.yaml +8 -0
  3. package/.github/workflows/release-please.yaml +18 -2
  4. package/.github/workflows/sync-labels.yaml +33 -0
  5. package/.github/workflows/update-issues.yaml +29 -0
  6. package/.github/workflows/validate-pr-title.yaml +35 -0
  7. package/AUTHORS +1 -0
  8. package/CHANGELOG.md +215 -41
  9. package/CONTRIBUTORS +1 -0
  10. package/README.md +14 -11
  11. package/app-engine/demo-version-index/README.md +3 -3
  12. package/app-engine/demo-version-index/app.yaml +27 -1
  13. package/app-engine/demo-version-index/generate.py +164 -0
  14. package/app-engine/demo-version-index/main.py +4 -155
  15. package/app-engine/demo-version-index/requirements.txt +0 -1
  16. package/build/checkversion.py +1 -1
  17. package/build/compiler.py +1 -1
  18. package/build/misspellings.txt +1 -0
  19. package/build/shaka-lab.yaml +0 -2
  20. package/build/types/polyfill +0 -3
  21. package/demo/common/asset.js +17 -1
  22. package/demo/common/assets.js +29 -0
  23. package/demo/common/message_ids.js +6 -3
  24. package/demo/config.js +10 -11
  25. package/demo/custom.js +39 -0
  26. package/demo/demo.less +0 -1
  27. package/demo/demo_utils.js +0 -1
  28. package/demo/locales/en.json +6 -3
  29. package/demo/locales/source.json +22 -10
  30. package/demo/main.js +9 -6
  31. package/demo/search.js +2 -1
  32. package/dist/controls.css +3 -3
  33. package/dist/controls.css.map +1 -1
  34. package/dist/demo.compiled.debug.js +71 -64
  35. package/dist/demo.compiled.debug.map +3 -3
  36. package/dist/demo.compiled.js +71 -64
  37. package/dist/demo.compiled.map +3 -3
  38. package/dist/demo.css +1 -1
  39. package/dist/demo.css.map +1 -1
  40. package/dist/deps.js +17 -20
  41. package/dist/locales.js +33 -31
  42. package/dist/receiver.compiled.debug.js +32 -28
  43. package/dist/receiver.compiled.debug.map +3 -3
  44. package/dist/receiver.compiled.js +32 -28
  45. package/dist/receiver.compiled.map +3 -3
  46. package/dist/shaka-player.compiled.d.ts +311 -314
  47. package/dist/shaka-player.compiled.debug.d.ts +311 -314
  48. package/dist/shaka-player.compiled.debug.externs.js +126 -126
  49. package/dist/shaka-player.compiled.debug.js +430 -484
  50. package/dist/shaka-player.compiled.debug.map +4 -4
  51. package/dist/shaka-player.compiled.externs.js +126 -126
  52. package/dist/shaka-player.compiled.js +829 -845
  53. package/dist/shaka-player.compiled.map +4 -4
  54. package/dist/shaka-player.ui.d.ts +357 -358
  55. package/dist/shaka-player.ui.debug.d.ts +357 -358
  56. package/dist/shaka-player.ui.debug.externs.js +134 -126
  57. package/dist/shaka-player.ui.debug.js +489 -541
  58. package/dist/shaka-player.ui.debug.map +4 -4
  59. package/dist/shaka-player.ui.externs.js +134 -126
  60. package/dist/shaka-player.ui.js +988 -1000
  61. package/dist/shaka-player.ui.map +4 -4
  62. package/docs/tutorials/config.md +0 -2
  63. package/docs/tutorials/drm-config.md +5 -0
  64. package/docs/tutorials/fairplay.md +7 -22
  65. package/docs/tutorials/faq.md +0 -11
  66. package/docs/tutorials/index.json +2 -8
  67. package/docs/tutorials/plugins.md +1 -3
  68. package/docs/tutorials/upgrade.md +85 -11
  69. package/externs/polyfill.js +15 -0
  70. package/externs/shaka/manifest.js +5 -1
  71. package/externs/shaka/net.js +12 -0
  72. package/externs/shaka/offline.js +5 -1
  73. package/externs/shaka/player.js +39 -21
  74. package/externs/shaka/text.js +12 -12
  75. package/externs/sourcebuffer.js +15 -0
  76. package/lib/abr/simple_abr_manager.js +2 -1
  77. package/lib/ads/client_side_ad.js +13 -2
  78. package/lib/ads/client_side_ad_manager.js +22 -4
  79. package/lib/cast/cast_utils.js +0 -1
  80. package/lib/dash/content_protection.js +85 -5
  81. package/lib/dash/dash_parser.js +1 -0
  82. package/lib/hls/hls_parser.js +390 -747
  83. package/lib/hls/manifest_text_parser.js +2 -3
  84. package/lib/media/drm_engine.js +105 -37
  85. package/lib/media/gap_jumping_controller.js +10 -45
  86. package/lib/media/media_source_engine.js +150 -30
  87. package/lib/media/playhead.js +2 -5
  88. package/lib/media/presentation_timeline.js +1 -2
  89. package/lib/media/segment_index.js +13 -46
  90. package/lib/media/segment_reference.js +47 -1
  91. package/lib/media/streaming_engine.js +28 -11
  92. package/lib/media/time_ranges_utils.js +4 -9
  93. package/lib/net/networking_engine.js +3 -0
  94. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  95. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  96. package/lib/offline/manifest_converter.js +1 -0
  97. package/lib/offline/storage.js +8 -41
  98. package/lib/player.js +17 -201
  99. package/lib/polyfill/media_capabilities.js +12 -6
  100. package/lib/polyfill/mediasource.js +0 -28
  101. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  102. package/lib/polyfill/patchedmediakeys_webkit.js +2 -0
  103. package/lib/text/cue.js +0 -6
  104. package/lib/text/lrc_text_parser.js +8 -0
  105. package/lib/text/mp4_ttml_parser.js +8 -0
  106. package/lib/text/mp4_vtt_parser.js +8 -0
  107. package/lib/text/sbv_text_parser.js +8 -0
  108. package/lib/text/simple_text_displayer.js +1 -7
  109. package/lib/text/srt_text_parser.js +8 -0
  110. package/lib/text/ssa_text_parser.js +8 -0
  111. package/lib/text/text_engine.js +19 -3
  112. package/lib/text/ttml_text_parser.js +8 -0
  113. package/lib/text/ui_text_displayer.js +1 -7
  114. package/lib/text/vtt_text_parser.js +27 -5
  115. package/lib/text/web_vtt_generator.js +1 -7
  116. package/lib/util/error.js +9 -13
  117. package/lib/util/fairplay_utils.js +109 -0
  118. package/lib/util/functional.js +0 -42
  119. package/lib/util/mime_utils.js +16 -5
  120. package/lib/util/platform.js +45 -0
  121. package/lib/util/player_configuration.js +17 -6
  122. package/lib/util/pssh.js +23 -4
  123. package/lib/util/stream_utils.js +92 -22
  124. package/lib/util/uint8array_utils.js +0 -16
  125. package/lib/util/xml_utils.js +1 -1
  126. package/package.json +5 -2
  127. package/roadmap.md +19 -19
  128. package/shaka-player.uncompiled.js +0 -3
  129. package/test/dash/dash_parser_content_protection_unit.js +44 -0
  130. package/test/dash/dash_parser_segment_template_unit.js +3 -4
  131. package/test/demo/demo_unit.js +2 -1
  132. package/test/hls/hls_live_unit.js +155 -230
  133. package/test/hls/hls_parser_unit.js +515 -432
  134. package/test/media/drm_engine_unit.js +86 -120
  135. package/test/media/media_source_engine_integration.js +25 -3
  136. package/test/media/media_source_engine_unit.js +3 -2
  137. package/test/media/playhead_unit.js +27 -191
  138. package/test/media/segment_index_unit.js +15 -25
  139. package/test/media/streaming_engine_integration.js +2 -39
  140. package/test/media/streaming_engine_unit.js +3 -2
  141. package/test/media/time_ranges_utils_unit.js +0 -5
  142. package/test/offline/manifest_convert_unit.js +34 -4
  143. package/test/offline/offline_manifest_parser_unit.js +1 -0
  144. package/test/offline/storage_integration.js +5 -4
  145. package/test/player_external.js +0 -6
  146. package/test/player_integration.js +16 -0
  147. package/test/player_unit.js +26 -0
  148. package/test/test/util/fake_media_source_engine.js +11 -4
  149. package/test/test/util/manifest_generator.js +3 -1
  150. package/test/test/util/manifest_parser_util.js +4 -1
  151. package/test/test/util/offline_utils.js +1 -0
  152. package/test/test/util/streaming_engine_util.js +1 -0
  153. package/test/test/util/test_scheme.js +24 -1
  154. package/test/test/util/util.js +4 -4
  155. package/test/text/cue_integration.js +2 -2
  156. package/test/text/lrc_text_parser_unit.js +6 -7
  157. package/test/text/mp4_ttml_parser_unit.js +6 -4
  158. package/test/text/mp4_vtt_parser_unit.js +6 -5
  159. package/test/text/sbv_text_parser_unit.js +5 -6
  160. package/test/text/srt_text_parser_unit.js +5 -6
  161. package/test/text/ssa_text_parser_unit.js +17 -29
  162. package/test/text/text_engine_unit.js +45 -5
  163. package/test/text/ttml_text_parser_unit.js +77 -77
  164. package/test/text/vtt_text_parser_unit.js +116 -59
  165. package/test/ui/ui_integration.js +0 -16
  166. package/test/ui/ui_unit.js +27 -0
  167. package/test/util/cmcd_manager_unit.js +3 -0
  168. package/test/util/stream_utils_unit.js +23 -7
  169. package/ui/controls.js +65 -40
  170. package/ui/fullscreen_button.js +26 -6
  171. package/ui/less/containers.less +4 -4
  172. package/ui/less/general.less +1 -1
  173. package/ui/less/range_elements.less +1 -0
  174. package/ui/locales/en.json +1 -0
  175. package/ui/locales/source.json +5 -0
  176. package/ui/resolution_selection.js +31 -33
  177. package/ui/ui.js +0 -17
  178. package/.github/pull_request_template.md +0 -10
  179. package/docs/tutorials/upgrade-v2-5.md +0 -441
  180. package/docs/tutorials/upgrade-v3.md +0 -38
  181. package/lib/polyfill/mathround.js +0 -49
  182. package/lib/polyfill/patchedmediakeys_apple.js +0 -744
  183. package/lib/polyfill/patchedmediakeys_ms.js +0 -698
  184. package/test/util/functional_unit.js +0 -82
@@ -408,7 +408,7 @@ shaka.util.StreamUtils = class {
408
408
  shaka.util.StreamUtils.filterManifestByCurrentVariant(
409
409
  currentVariant, manifest);
410
410
  shaka.util.StreamUtils.filterTextStreams_(manifest);
411
- shaka.util.StreamUtils.filterImageStreams_(manifest);
411
+ await shaka.util.StreamUtils.filterImageStreams_(manifest);
412
412
  }
413
413
 
414
414
 
@@ -815,37 +815,57 @@ shaka.util.StreamUtils = class {
815
815
  * @param {shaka.extern.Manifest} manifest
816
816
  * @private
817
817
  */
818
- static filterImageStreams_(manifest) {
819
- // Filter image streams.
820
- manifest.imageStreams = manifest.imageStreams.filter((stream) => {
821
- // TODO: re-examine this and avoid allow-listing the MIME types we can
822
- // accept.
823
- const validMimeTypes = [
824
- 'image/svg+xml',
825
- 'image/png',
826
- 'image/jpeg',
827
- ];
828
- const Platform = shaka.util.Platform;
829
- // Add webp support to popular platforms that support it.
830
- const webpSupport = Platform.isWebOS() ||
831
- Platform.isTizen() ||
832
- Platform.isChromecast();
833
- if (webpSupport) {
834
- validMimeTypes.push('image/webp');
818
+ static async filterImageStreams_(manifest) {
819
+ const imageStreams = [];
820
+ for (const stream of manifest.imageStreams) {
821
+ const mimeType = stream.mimeType;
822
+ if (!shaka.util.StreamUtils.supportedImageMimeTypes_.has(mimeType)) {
823
+ const minImage = shaka.util.StreamUtils.minImage_.get(mimeType);
824
+ if (minImage) {
825
+ // eslint-disable-next-line no-await-in-loop
826
+ const res = await shaka.util.StreamUtils.isImageSupported_(minImage);
827
+ shaka.util.StreamUtils.supportedImageMimeTypes_.set(mimeType, res);
828
+ } else {
829
+ shaka.util.StreamUtils.supportedImageMimeTypes_.set(mimeType, false);
830
+ }
835
831
  }
836
- // TODO: add support to image/webp and image/avif
837
- const keep = validMimeTypes.includes(stream.mimeType);
832
+
833
+ const keep =
834
+ shaka.util.StreamUtils.supportedImageMimeTypes_.get(mimeType);
838
835
 
839
836
  if (!keep) {
840
837
  shaka.log.debug('Dropping image stream. Is not supported by the ' +
841
838
  'platform.', stream);
839
+ } else {
840
+ imageStreams.push(stream);
842
841
  }
842
+ }
843
+ manifest.imageStreams = imageStreams;
844
+ }
843
845
 
844
- return keep;
846
+ /**
847
+ * @param {string} minImage
848
+ * @return {!Promise.<boolean>}
849
+ * @private
850
+ */
851
+ static isImageSupported_(minImage) {
852
+ return new Promise((resolve) => {
853
+ const imageElement = /** @type {HTMLImageElement} */(new Image());
854
+ imageElement.src = minImage;
855
+ if ('decode' in imageElement) {
856
+ imageElement.decode().then(() => {
857
+ resolve(true);
858
+ }).catch(() => {
859
+ resolve(false);
860
+ });
861
+ } else {
862
+ imageElement.onload = imageElement.onerror = () => {
863
+ resolve(imageElement.height === 2);
864
+ };
865
+ }
845
866
  });
846
867
  }
847
868
 
848
-
849
869
  /**
850
870
  * @param {shaka.extern.Stream} s0
851
871
  * @param {shaka.extern.Stream} s1
@@ -880,6 +900,11 @@ shaka.util.StreamUtils = class {
880
900
  /** @type {?shaka.extern.Stream} */
881
901
  const video = variant.video;
882
902
 
903
+ /** @type {?string} */
904
+ const audioMimeType = audio ? audio.mimeType : null;
905
+ /** @type {?string} */
906
+ const videoMimeType = video ? video.mimeType : null;
907
+
883
908
  /** @type {?string} */
884
909
  const audioCodec = audio ? audio.codecs : null;
885
910
  /** @type {?string} */
@@ -944,6 +969,8 @@ shaka.util.StreamUtils = class {
944
969
  pixelAspectRatio: null,
945
970
  hdr: null,
946
971
  mimeType: mimeType,
972
+ audioMimeType: audioMimeType,
973
+ videoMimeType: videoMimeType,
947
974
  codecs: codecs.join(', '),
948
975
  audioCodec: audioCodec,
949
976
  videoCodec: videoCodec,
@@ -1011,6 +1038,8 @@ shaka.util.StreamUtils = class {
1011
1038
  pixelAspectRatio: null,
1012
1039
  hdr: null,
1013
1040
  mimeType: stream.mimeType,
1041
+ audioMimeType: null,
1042
+ videoMimeType: null,
1014
1043
  codecs: stream.codecs || null,
1015
1044
  audioCodec: null,
1016
1045
  videoCodec: null,
@@ -1083,6 +1112,8 @@ shaka.util.StreamUtils = class {
1083
1112
  pixelAspectRatio: null,
1084
1113
  hdr: null,
1085
1114
  mimeType: stream.mimeType,
1115
+ audioMimeType: null,
1116
+ videoMimeType: null,
1086
1117
  codecs: null,
1087
1118
  audioCodec: null,
1088
1119
  videoCodec: null,
@@ -1201,6 +1232,8 @@ shaka.util.StreamUtils = class {
1201
1232
  pixelAspectRatio: null,
1202
1233
  hdr: null,
1203
1234
  mimeType: null,
1235
+ audioMimeType: null,
1236
+ videoMimeType: null,
1204
1237
  codecs: null,
1205
1238
  audioCodec: null,
1206
1239
  videoCodec: null,
@@ -1505,3 +1538,40 @@ shaka.util.StreamUtils.DecodingAttributes = {
1505
1538
  POWER: 'powerEfficient',
1506
1539
  BANDWIDTH: 'bandwidth',
1507
1540
  };
1541
+
1542
+ /**
1543
+ * @private {!Map.<string, boolean>}
1544
+ */
1545
+ shaka.util.StreamUtils.supportedImageMimeTypes_ = new Map()
1546
+ .set('image/svg+xml', true)
1547
+ .set('image/png', true)
1548
+ .set('image/jpeg', true)
1549
+ .set('image/jpg', true);
1550
+
1551
+ /**
1552
+ * @const {string}
1553
+ * @private
1554
+ */
1555
+ shaka.util.StreamUtils.minWebPImage_ = 'data:image/webp;base64,UklGRjoAAABXRU' +
1556
+ 'JQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwY' +
1557
+ 'AAA';
1558
+
1559
+ /**
1560
+ * @const {string}
1561
+ * @private
1562
+ */
1563
+ shaka.util.StreamUtils.minAvifImage_ = 'data:image/avif;base64,AAAAIGZ0eXBhdm' +
1564
+ 'lmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljd' +
1565
+ 'AAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEA' +
1566
+ 'AAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAA' +
1567
+ 'AamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAA' +
1568
+ 'xhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAA' +
1569
+ 'CVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
1570
+
1571
+ /**
1572
+ * @const {!Map.<string, string>}
1573
+ * @private
1574
+ */
1575
+ shaka.util.StreamUtils.minImage_ = new Map()
1576
+ .set('image/webp', shaka.util.StreamUtils.minWebPImage_)
1577
+ .set('image/avif', shaka.util.StreamUtils.minAvifImage_);
@@ -6,7 +6,6 @@
6
6
 
7
7
  goog.provide('shaka.util.Uint8ArrayUtils');
8
8
 
9
- goog.require('shaka.Deprecate');
10
9
  goog.require('shaka.util.BufferUtils');
11
10
  goog.require('shaka.util.StringUtils');
12
11
 
@@ -17,21 +16,6 @@ goog.require('shaka.util.StringUtils');
17
16
  * @export
18
17
  */
19
18
  shaka.util.Uint8ArrayUtils = class {
20
- /**
21
- * Compare two Uint8Arrays for equality.
22
- * @param {Uint8Array} arr1
23
- * @param {Uint8Array} arr2
24
- * @return {boolean}
25
- * @deprecated
26
- * @export
27
- */
28
- static equal(arr1, arr2) {
29
- shaka.Deprecate.deprecateFeature(4,
30
- 'shaka.util.Uint8ArrayUtils.equal',
31
- 'Please use shaka.util.BufferUtils.equal instead.');
32
- return shaka.util.BufferUtils.equal(arr1, arr2);
33
- }
34
-
35
19
  /**
36
20
  * Convert a buffer to a base64 string. The output will be standard
37
21
  * alphabet as opposed to base64url safe alphabet.
@@ -199,7 +199,7 @@ shaka.util.XmlUtils = class {
199
199
  }
200
200
 
201
201
  const result = Date.parse(dateString);
202
- return (!isNaN(result) ? Math.floor(result / 1000.0) : null);
202
+ return isNaN(result) ? null : (result / 1000.0);
203
203
  }
204
204
 
205
205
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shaka-player",
3
3
  "description": "DASH/EME video player library",
4
- "version": "3.3.5",
4
+ "version": "4.0.2",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -50,7 +50,7 @@
50
50
  "less": "https://gitpkg.now.sh/joeyparrish/less.js/packages/less?28c63a43",
51
51
  "less-plugin-clean-css": "github:austingardner/less-plugin-clean-css#4e9e77bf",
52
52
  "material-design-lite": "^1.3.0",
53
- "mux.js": "^5.14.1",
53
+ "mux.js": "^6.1.0",
54
54
  "open-sans-fonts": "^1.6.2",
55
55
  "postcss-less": "^6.0.0",
56
56
  "pwacompat": "^2.0.17",
@@ -97,5 +97,8 @@
97
97
  },
98
98
  "dependencies": {
99
99
  "eme-encryption-scheme-polyfill": "^2.0.3"
100
+ },
101
+ "engines": {
102
+ "node": ">=14"
100
103
  }
101
104
  }
package/roadmap.md CHANGED
@@ -9,41 +9,41 @@ The goals of future milestones are fluid until we begin that development cycle,
9
9
  so the exact milestone for future features is not pre-determined.
10
10
 
11
11
  Priority features up next:
12
- - Support containerless formats
13
- https://github.com/shaka-project/shaka-player/issues/2337
14
12
  - Preload API
15
13
  https://github.com/shaka-project/shaka-player/issues/880
16
- - Codec-switching and order preference
17
- https://github.com/shaka-project/shaka-player/issues/1528
18
- https://github.com/shaka-project/shaka-player/issues/2179
19
14
 
20
15
  Candidate features for future release cycles:
21
- - HLS interstitial support
22
- https://github.com/shaka-project/shaka-player/issues/3364
23
- - Support ID3 tags in mp4
24
- https://github.com/shaka-project/shaka-player/issues/3351
25
- - MSE support for FairPlay
26
- https://github.com/shaka-project/shaka-player/issues/3346
27
- - Smaller, more modular binary
28
16
  - Official TypeScript defs, generated from source
29
17
  https://github.com/shaka-project/shaka-player/issues/1030
30
- - Shaka Analytics Component and an integration with BigQuery Analytics
31
- https://github.com/shaka-project/shaka-player/issues/3359
32
- - Integration with Google Video ML/Cloud AI
33
-
34
- v3.3 - 2021 Q3 or Q4
18
+ - Codec-switching
19
+ https://github.com/shaka-project/shaka-player/issues/1528
35
20
  - Background fetch for offline storage
36
21
  https://github.com/shaka-project/shaka-player/issues/879
37
- - HLS performance improvements
38
- https://github.com/shaka-project/shaka-player/issues/3363
22
+ - Support ID3 tags in mp4
23
+ https://github.com/shaka-project/shaka-player/issues/3351
24
+ - Smaller, more modular binary
25
+
26
+ v3.4 - 2022 Q1 or Q2
27
+ - MSE support for FairPlay
28
+ https://github.com/shaka-project/shaka-player/issues/3346
29
+ - Support containerless formats
30
+ https://github.com/shaka-project/shaka-player/issues/2337
39
31
 
40
32
  =====
41
33
 
34
+ v3.3 - 2022 Q1
35
+ - Common Media Client Data (CMCD) logging support
36
+ https://github.com/shaka-project/shaka-player/issues/3619
37
+ - Non-linear IMA CS ads
38
+ https://github.com/shaka-project/shaka-player/pull/3639
39
+
42
40
  v3.2 - 2021 Q3
43
41
  - MediaCapabilities to make performance-based decisions
44
42
  https://github.com/shaka-project/shaka-player/issues/1391
45
43
  - Configurable key-system priority
46
44
  https://github.com/shaka-project/shaka-player/issues/3002
45
+ - Codec order preferences
46
+ https://github.com/shaka-project/shaka-player/issues/2179
47
47
 
48
48
  v3.1 - 2021 Q2
49
49
  - Low-latency live (LL-HLS, LL-DASH)
@@ -35,12 +35,9 @@ goog.require('shaka.offline.indexeddb.StorageMechanism');
35
35
  goog.require('shaka.polyfill.Aria');
36
36
  goog.require('shaka.polyfill.EncryptionScheme');
37
37
  goog.require('shaka.polyfill.Fullscreen');
38
- goog.require('shaka.polyfill.MathRound');
39
38
  goog.require('shaka.polyfill.MediaSource');
40
39
  goog.require('shaka.polyfill.MediaCapabilities');
41
40
  goog.require('shaka.polyfill.Orientation');
42
- goog.require('shaka.polyfill.PatchedMediaKeysApple');
43
- goog.require('shaka.polyfill.PatchedMediaKeysMs');
44
41
  goog.require('shaka.polyfill.PatchedMediaKeysNop');
45
42
  goog.require('shaka.polyfill.PatchedMediaKeysWebkit');
46
43
  goog.require('shaka.polyfill.PiPWebkit');
@@ -805,6 +805,50 @@ describe('DashParser ContentProtection', () => {
805
805
  });
806
806
  });
807
807
 
808
+ describe('getClearKeyLicenseUrl', () => {
809
+ it('valid clearkey:Laurl node', () => {
810
+ const input = {
811
+ init: null,
812
+ keyId: null,
813
+ schemeUri: '',
814
+ node: strToXml([
815
+ '<test xmlns:clearkey="http://dashif.org/guidelines/clearKey">',
816
+ ' <clearkey:Laurl ',
817
+ ' Lic_type="EME-1.0">www.example.com</clearkey:Laurl>',
818
+ '</test>',
819
+ ].join('\n')),
820
+ };
821
+ const actual = ContentProtection.getClearKeyLicenseUrl(input);
822
+ expect(actual).toBe('www.example.com');
823
+ });
824
+
825
+ it('clearkey:Laurl without license url', () => {
826
+ const input = {
827
+ init: null,
828
+ keyId: null,
829
+ schemeUri: '',
830
+ node: strToXml([
831
+ '<test xmlns:clearkey="http://dashif.org/guidelines/clearKey">',
832
+ ' <clearkey:Laurl Lic_type="EME-1.0"></clearkey:Laurl>',
833
+ '</test>',
834
+ ].join('\n')),
835
+ };
836
+ const actual = ContentProtection.getClearKeyLicenseUrl(input);
837
+ expect(actual).toBe('');
838
+ });
839
+
840
+ it('no clearkey:Laurl node', () => {
841
+ const input = {
842
+ init: null,
843
+ keyId: null,
844
+ schemeUri: '',
845
+ node: strToXml('<test></test>'),
846
+ };
847
+ const actual = ContentProtection.getClearKeyLicenseUrl(input);
848
+ expect(actual).toBe('');
849
+ });
850
+ });
851
+
808
852
  describe('getPlayReadyLicenseURL', () => {
809
853
  it('mspro', () => {
810
854
  const laurl = [
@@ -106,9 +106,8 @@ describe('DashParser SegmentTemplate', () => {
106
106
  's2.mp4', 50, 60, baseUri);
107
107
  expectedRef2.timestampOffset = -10;
108
108
 
109
- const iterator = stream.segmentIndex[Symbol.iterator]();
110
- const ref1 = iterator.seek(45);
111
- const ref2 = iterator.seek(55);
109
+ const ref1 = stream.segmentIndex.getIteratorForTime(45).next().value;
110
+ const ref2 = stream.segmentIndex.getIteratorForTime(55).next().value;
112
111
  expect(ref1).toEqual(expectedRef1);
113
112
  expect(ref2).toEqual(expectedRef2);
114
113
  });
@@ -445,7 +444,7 @@ describe('DashParser SegmentTemplate', () => {
445
444
  await variants[2].video.createSegmentIndex();
446
445
 
447
446
  const getRefAt = (stream, time) => {
448
- return stream.segmentIndex[Symbol.iterator]().seek(time);
447
+ return stream.segmentIndex.getIteratorForTime(time).next().value;
449
448
  };
450
449
 
451
450
  expect(getRefAt(variants[0].video, 0)).toEqual(
@@ -93,7 +93,8 @@ describe('Demo', () => {
93
93
  .add('preferredVariantRole')
94
94
  .add('playRangeStart')
95
95
  .add('playRangeEnd')
96
- .add('manifest.dash.keySystemsByURI');
96
+ .add('manifest.dash.keySystemsByURI')
97
+ .add('manifest.hls.mediaPlaylistFullMimeType');
97
98
 
98
99
  /**
99
100
  * @param {!Object} section