shaka-player 3.3.4 → 4.0.0

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/workflows/build-and-test.yaml +0 -1
  2. package/.github/workflows/demo-version-index.yaml +8 -0
  3. package/.github/workflows/release-please.yaml +23 -2
  4. package/.github/workflows/selenium-lab-tests.yaml +0 -1
  5. package/.github/workflows/sync-labels.yaml +33 -0
  6. package/.github/workflows/update-issues.yaml +29 -0
  7. package/.github/workflows/validate-pr-title.yaml +35 -0
  8. package/AUTHORS +1 -0
  9. package/CHANGELOG.md +198 -32
  10. package/CONTRIBUTORS +1 -0
  11. package/README.md +10 -7
  12. package/app-engine/demo-version-index/README.md +3 -3
  13. package/app-engine/demo-version-index/app.yaml +27 -1
  14. package/app-engine/demo-version-index/generate.py +164 -0
  15. package/app-engine/demo-version-index/main.py +4 -155
  16. package/app-engine/demo-version-index/requirements.txt +0 -1
  17. package/build/README.md +2 -2
  18. package/build/compiler.py +1 -1
  19. package/build/generateTsDefs.py +0 -2
  20. package/build/shaka-lab.yaml +0 -2
  21. package/build/test.py +7 -1
  22. package/build/types/core +0 -1
  23. package/build/types/polyfill +0 -3
  24. package/demo/common/asset.js +17 -1
  25. package/demo/common/assets.js +29 -0
  26. package/demo/common/message_ids.js +6 -3
  27. package/demo/config.js +10 -11
  28. package/demo/custom.js +39 -0
  29. package/demo/demo_utils.js +0 -1
  30. package/demo/locales/en.json +6 -3
  31. package/demo/locales/source.json +22 -10
  32. package/demo/main.js +9 -6
  33. package/demo/search.js +2 -1
  34. package/dist/controls.css +1 -1
  35. package/dist/demo.compiled.debug.js +71 -64
  36. package/dist/demo.compiled.debug.map +3 -3
  37. package/dist/demo.compiled.js +71 -64
  38. package/dist/demo.compiled.map +3 -3
  39. package/dist/demo.css +1 -1
  40. package/dist/demo.css.map +1 -1
  41. package/dist/deps.js +16 -20
  42. package/dist/locales.js +31 -29
  43. package/dist/receiver.compiled.debug.js +32 -28
  44. package/dist/receiver.compiled.debug.map +3 -3
  45. package/dist/receiver.compiled.js +32 -28
  46. package/dist/receiver.compiled.map +3 -3
  47. package/dist/shaka-player.compiled.d.ts +78 -83
  48. package/dist/shaka-player.compiled.debug.d.ts +78 -83
  49. package/dist/shaka-player.compiled.debug.externs.js +126 -126
  50. package/dist/shaka-player.compiled.debug.js +426 -483
  51. package/dist/shaka-player.compiled.debug.map +4 -4
  52. package/dist/shaka-player.compiled.externs.js +126 -126
  53. package/dist/shaka-player.compiled.js +838 -856
  54. package/dist/shaka-player.compiled.map +4 -4
  55. package/dist/shaka-player.ui.d.ts +80 -83
  56. package/dist/shaka-player.ui.debug.d.ts +80 -83
  57. package/dist/shaka-player.ui.debug.externs.js +134 -126
  58. package/dist/shaka-player.ui.debug.js +488 -543
  59. package/dist/shaka-player.ui.debug.map +4 -4
  60. package/dist/shaka-player.ui.externs.js +134 -126
  61. package/dist/shaka-player.ui.js +980 -994
  62. package/dist/shaka-player.ui.map +4 -4
  63. package/docs/tutorials/config.md +0 -2
  64. package/docs/tutorials/drm-config.md +5 -0
  65. package/docs/tutorials/fairplay.md +7 -22
  66. package/docs/tutorials/faq.md +0 -11
  67. package/docs/tutorials/index.json +2 -8
  68. package/docs/tutorials/plugins.md +1 -3
  69. package/docs/tutorials/upgrade.md +83 -11
  70. package/externs/polyfill.js +15 -0
  71. package/externs/shaka/manifest.js +5 -1
  72. package/externs/shaka/net.js +12 -0
  73. package/externs/shaka/offline.js +5 -1
  74. package/externs/shaka/player.js +39 -32
  75. package/externs/shaka/text.js +12 -12
  76. package/externs/sourcebuffer.js +15 -0
  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 -1
  82. package/lib/hls/hls_parser.js +378 -743
  83. package/lib/hls/manifest_text_parser.js +2 -3
  84. package/lib/media/drm_engine.js +102 -53
  85. package/lib/media/gap_jumping_controller.js +10 -45
  86. package/lib/media/media_source_engine.js +87 -15
  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 +29 -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 +100 -132
  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 +24 -2
  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 +2 -0
  120. package/lib/util/platform.js +45 -0
  121. package/lib/util/player_configuration.js +12 -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 +1 -1
  127. package/roadmap.md +19 -19
  128. package/shaka-player.uncompiled.js +0 -3
  129. package/test/cast/cast_utils_unit.js +1 -0
  130. package/test/dash/dash_parser_content_protection_unit.js +44 -0
  131. package/test/dash/dash_parser_manifest_unit.js +0 -24
  132. package/test/dash/dash_parser_segment_template_unit.js +3 -4
  133. package/test/demo/demo_unit.js +2 -1
  134. package/test/hls/hls_live_unit.js +99 -220
  135. package/test/hls/hls_parser_unit.js +515 -432
  136. package/test/media/drm_engine_unit.js +86 -120
  137. package/test/media/media_source_engine_integration.js +26 -3
  138. package/test/media/media_source_engine_unit.js +7 -6
  139. package/test/media/playhead_unit.js +27 -191
  140. package/test/media/segment_index_unit.js +15 -25
  141. package/test/media/streaming_engine_integration.js +4 -39
  142. package/test/media/streaming_engine_unit.js +3 -2
  143. package/test/media/time_ranges_utils_unit.js +0 -5
  144. package/test/offline/manifest_convert_unit.js +34 -4
  145. package/test/offline/offline_manifest_parser_unit.js +1 -0
  146. package/test/offline/storage_integration.js +5 -4
  147. package/test/player_external.js +0 -6
  148. package/test/player_integration.js +16 -0
  149. package/test/player_unit.js +26 -0
  150. package/test/test/util/fake_media_source_engine.js +11 -4
  151. package/test/test/util/manifest_generator.js +3 -1
  152. package/test/test/util/manifest_parser_util.js +4 -1
  153. package/test/test/util/offline_utils.js +1 -0
  154. package/test/test/util/streaming_engine_util.js +1 -0
  155. package/test/test/util/test_scheme.js +24 -1
  156. package/test/test/util/util.js +4 -4
  157. package/test/text/cue_integration.js +2 -2
  158. package/test/text/lrc_text_parser_unit.js +6 -7
  159. package/test/text/mp4_ttml_parser_unit.js +6 -4
  160. package/test/text/mp4_vtt_parser_unit.js +6 -5
  161. package/test/text/sbv_text_parser_unit.js +5 -6
  162. package/test/text/srt_text_parser_unit.js +5 -6
  163. package/test/text/ssa_text_parser_unit.js +17 -29
  164. package/test/text/text_engine_unit.js +45 -5
  165. package/test/text/ttml_text_parser_unit.js +77 -77
  166. package/test/text/vtt_text_parser_unit.js +55 -57
  167. package/test/ui/ui_integration.js +0 -16
  168. package/test/ui/ui_unit.js +27 -0
  169. package/test/util/cmcd_manager_unit.js +3 -0
  170. package/test/util/stream_utils_unit.js +23 -7
  171. package/ui/controls.js +65 -40
  172. package/ui/fullscreen_button.js +26 -6
  173. package/ui/less/containers.less +3 -3
  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/docs/tutorials/upgrade-v2-5.md +0 -441
  179. package/docs/tutorials/upgrade-v3.md +0 -38
  180. package/lib/polyfill/mathround.js +0 -49
  181. package/lib/polyfill/patchedmediakeys_apple.js +0 -744
  182. package/lib/polyfill/patchedmediakeys_ms.js +0 -698
  183. package/lib/util/mutex.js +0 -52
  184. package/test/util/functional_unit.js +0 -82
@@ -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.4",
4
+ "version": "4.0.0",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
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');
@@ -189,6 +189,7 @@ describe('CastUtils', () => {
189
189
  const fakeVideoStream = {
190
190
  mimeType: 'video/mp4',
191
191
  codecs: 'avc1.42c01e',
192
+ drmInfos: [],
192
193
  };
193
194
  const initSegmentUrl = '/base/test/test/assets/sintel-video-init.mp4';
194
195
  const videoSegmentUrl =
@@ -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 = [
@@ -447,30 +447,6 @@ describe('DashParser Manifest', () => {
447
447
  expect(stream.closedCaptions).toEqual(expectedClosedCaptions);
448
448
  });
449
449
 
450
- it('Detects E-AC3 JOC content by SupplementalProperty', async () => {
451
- const idUri = 'tag:dolby.com,2018:dash:EC3_ExtensionType:2018';
452
- const source = [
453
- '<MPD>',
454
- ' <Period duration="PT30M">',
455
- ' <AdaptationSet mimeType="audio/mp4" lang="\u2603">',
456
- ' <Representation bandwidth="500">',
457
- ' <SupplementalProperty schemeIdUri="' + idUri + '" value="JOC"/>',
458
- ' <BaseURL>http://example.com</BaseURL>',
459
- ' <SegmentTemplate media="2.mp4" duration="1" />',
460
- ' </Representation>',
461
- ' </AdaptationSet>',
462
- ' </Period>',
463
- '</MPD>',
464
- ].join('\n');
465
-
466
- fakeNetEngine.setResponseText('dummy://foo', source);
467
-
468
- /** @type {shaka.extern.Manifest} */
469
- const manifest = await parser.start('dummy://foo', playerInterface);
470
- const stream = manifest.variants[0].audio;
471
- expect(stream.mimeType).toBe('audio/eac3-joc');
472
- });
473
-
474
450
  it('Detects spatial audio', async () => {
475
451
  const idUri = 'tag:dolby.com,2018:dash:EC3_ExtensionType:2018';
476
452
  const source = [
@@ -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