shaka-player 3.3.4 → 4.0.1

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 (201) hide show
  1. package/.github/config.yml +1 -0
  2. package/.github/workflows/build-and-test.yaml +0 -1
  3. package/.github/workflows/demo-version-index.yaml +8 -0
  4. package/.github/workflows/release-please.yaml +19 -3
  5. package/.github/workflows/selenium-lab-tests.yaml +0 -1
  6. package/.github/workflows/sync-labels.yaml +33 -0
  7. package/.github/workflows/update-issues.yaml +29 -0
  8. package/.github/workflows/validate-pr-title.yaml +35 -0
  9. package/AUTHORS +1 -0
  10. package/CHANGELOG.md +209 -28
  11. package/CONTRIBUTORS +1 -0
  12. package/README.md +10 -7
  13. package/app-engine/demo-version-index/README.md +3 -3
  14. package/app-engine/demo-version-index/app.yaml +27 -1
  15. package/app-engine/demo-version-index/generate.py +164 -0
  16. package/app-engine/demo-version-index/main.py +4 -155
  17. package/app-engine/demo-version-index/requirements.txt +0 -1
  18. package/build/README.md +2 -2
  19. package/build/compiler.py +1 -1
  20. package/build/generateTsDefs.py +0 -2
  21. package/build/misspellings.txt +1 -0
  22. package/build/shaka-lab.yaml +0 -2
  23. package/build/test.py +7 -1
  24. package/build/types/core +0 -1
  25. package/build/types/polyfill +0 -3
  26. package/demo/common/asset.js +17 -1
  27. package/demo/common/assets.js +29 -0
  28. package/demo/common/message_ids.js +6 -3
  29. package/demo/config.js +10 -11
  30. package/demo/custom.js +39 -0
  31. package/demo/demo_utils.js +0 -1
  32. package/demo/locales/en.json +6 -3
  33. package/demo/locales/source.json +22 -10
  34. package/demo/main.js +9 -6
  35. package/demo/search.js +2 -1
  36. package/dist/controls.css +1 -1
  37. package/dist/demo.compiled.debug.js +71 -64
  38. package/dist/demo.compiled.debug.map +3 -3
  39. package/dist/demo.compiled.js +71 -64
  40. package/dist/demo.compiled.map +3 -3
  41. package/dist/demo.css +1 -1
  42. package/dist/demo.css.map +1 -1
  43. package/dist/deps.js +16 -20
  44. package/dist/locales.js +33 -31
  45. package/dist/receiver.compiled.debug.js +32 -28
  46. package/dist/receiver.compiled.debug.map +3 -3
  47. package/dist/receiver.compiled.js +32 -28
  48. package/dist/receiver.compiled.map +3 -3
  49. package/dist/shaka-player.compiled.d.ts +78 -82
  50. package/dist/shaka-player.compiled.debug.d.ts +78 -82
  51. package/dist/shaka-player.compiled.debug.externs.js +127 -126
  52. package/dist/shaka-player.compiled.debug.js +471 -523
  53. package/dist/shaka-player.compiled.debug.map +4 -4
  54. package/dist/shaka-player.compiled.externs.js +127 -126
  55. package/dist/shaka-player.compiled.js +844 -858
  56. package/dist/shaka-player.compiled.map +4 -4
  57. package/dist/shaka-player.ui.d.ts +80 -82
  58. package/dist/shaka-player.ui.debug.d.ts +80 -82
  59. package/dist/shaka-player.ui.debug.externs.js +135 -126
  60. package/dist/shaka-player.ui.debug.js +531 -581
  61. package/dist/shaka-player.ui.debug.map +4 -4
  62. package/dist/shaka-player.ui.externs.js +135 -126
  63. package/dist/shaka-player.ui.js +991 -1001
  64. package/dist/shaka-player.ui.map +4 -4
  65. package/docs/tutorials/config.md +0 -2
  66. package/docs/tutorials/drm-config.md +5 -0
  67. package/docs/tutorials/fairplay.md +7 -22
  68. package/docs/tutorials/faq.md +0 -11
  69. package/docs/tutorials/index.json +2 -8
  70. package/docs/tutorials/plugins.md +1 -3
  71. package/docs/tutorials/upgrade.md +85 -11
  72. package/externs/polyfill.js +15 -0
  73. package/externs/shaka/manifest.js +5 -1
  74. package/externs/shaka/net.js +12 -0
  75. package/externs/shaka/offline.js +5 -1
  76. package/externs/shaka/player.js +39 -21
  77. package/externs/shaka/text.js +12 -12
  78. package/externs/sourcebuffer.js +15 -0
  79. package/karma.conf.js +4 -0
  80. package/lib/ads/client_side_ad.js +13 -2
  81. package/lib/ads/client_side_ad_manager.js +22 -4
  82. package/lib/cast/cast_utils.js +0 -1
  83. package/lib/dash/content_protection.js +85 -5
  84. package/lib/dash/dash_parser.js +3 -3
  85. package/lib/hls/hls_parser.js +391 -747
  86. package/lib/hls/manifest_text_parser.js +2 -3
  87. package/lib/media/drm_engine.js +102 -37
  88. package/lib/media/gap_jumping_controller.js +10 -45
  89. package/lib/media/media_source_engine.js +157 -31
  90. package/lib/media/playhead.js +2 -5
  91. package/lib/media/presentation_timeline.js +1 -2
  92. package/lib/media/segment_index.js +13 -46
  93. package/lib/media/segment_reference.js +47 -1
  94. package/lib/media/streaming_engine.js +28 -11
  95. package/lib/media/time_ranges_utils.js +4 -9
  96. package/lib/net/networking_engine.js +3 -0
  97. package/lib/offline/indexeddb/storage_mechanism.js +4 -2
  98. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  99. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  100. package/lib/offline/manifest_converter.js +1 -0
  101. package/lib/offline/storage.js +100 -132
  102. package/lib/player.js +181 -307
  103. package/lib/polyfill/media_capabilities.js +12 -6
  104. package/lib/polyfill/mediasource.js +0 -28
  105. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  106. package/lib/polyfill/patchedmediakeys_webkit.js +2 -0
  107. package/lib/text/cue.js +0 -6
  108. package/lib/text/lrc_text_parser.js +8 -0
  109. package/lib/text/mp4_ttml_parser.js +8 -0
  110. package/lib/text/mp4_vtt_parser.js +8 -0
  111. package/lib/text/sbv_text_parser.js +8 -0
  112. package/lib/text/simple_text_displayer.js +1 -7
  113. package/lib/text/srt_text_parser.js +8 -0
  114. package/lib/text/ssa_text_parser.js +8 -0
  115. package/lib/text/text_engine.js +19 -3
  116. package/lib/text/ttml_text_parser.js +8 -0
  117. package/lib/text/ui_text_displayer.js +1 -7
  118. package/lib/text/vtt_text_parser.js +27 -5
  119. package/lib/text/web_vtt_generator.js +1 -7
  120. package/lib/util/config_utils.js +25 -0
  121. package/lib/util/error.js +16 -13
  122. package/lib/util/fairplay_utils.js +109 -0
  123. package/lib/util/functional.js +0 -42
  124. package/lib/util/manifest_parser_utils.js +1 -1
  125. package/lib/util/mime_utils.js +50 -1
  126. package/lib/util/periods.js +5 -4
  127. package/lib/util/platform.js +45 -0
  128. package/lib/util/player_configuration.js +26 -20
  129. package/lib/util/pssh.js +23 -4
  130. package/lib/util/stream_utils.js +96 -24
  131. package/lib/util/uint8array_utils.js +0 -16
  132. package/lib/util/xml_utils.js +1 -1
  133. package/package.json +4 -1
  134. package/roadmap.md +19 -19
  135. package/shaka-player.uncompiled.js +0 -3
  136. package/test/cast/cast_utils_unit.js +1 -0
  137. package/test/dash/dash_parser_content_protection_unit.js +44 -0
  138. package/test/dash/dash_parser_manifest_unit.js +0 -24
  139. package/test/dash/dash_parser_segment_template_unit.js +3 -4
  140. package/test/demo/demo_unit.js +2 -1
  141. package/test/hls/hls_live_unit.js +121 -220
  142. package/test/hls/hls_parser_unit.js +515 -432
  143. package/test/hls/manifest_text_parser_unit.js +19 -0
  144. package/test/media/drm_engine_unit.js +86 -120
  145. package/test/media/media_source_engine_integration.js +26 -3
  146. package/test/media/media_source_engine_unit.js +7 -6
  147. package/test/media/playhead_unit.js +27 -191
  148. package/test/media/segment_index_unit.js +15 -25
  149. package/test/media/streaming_engine_integration.js +4 -39
  150. package/test/media/streaming_engine_unit.js +3 -2
  151. package/test/media/time_ranges_utils_unit.js +0 -5
  152. package/test/offline/indexeddb_storage_unit.js +1 -1
  153. package/test/offline/manifest_convert_unit.js +34 -4
  154. package/test/offline/offline_manifest_parser_unit.js +1 -0
  155. package/test/offline/storage_compatibility_unit.js +1 -1
  156. package/test/offline/storage_integration.js +5 -4
  157. package/test/player_external.js +7 -7
  158. package/test/player_integration.js +22 -10
  159. package/test/player_src_equals_integration.js +81 -83
  160. package/test/player_unit.js +124 -1
  161. package/test/test/boot.js +9 -0
  162. package/test/test/externs/filters.js +4 -0
  163. package/test/test/util/fake_media_source_engine.js +11 -4
  164. package/test/test/util/manifest_generator.js +3 -1
  165. package/test/test/util/manifest_parser_util.js +4 -1
  166. package/test/test/util/offline_utils.js +1 -0
  167. package/test/test/util/simple_fakes.js +31 -2
  168. package/test/test/util/streaming_engine_util.js +1 -0
  169. package/test/test/util/test_scheme.js +24 -1
  170. package/test/test/util/util.js +4 -4
  171. package/test/text/cue_integration.js +2 -2
  172. package/test/text/lrc_text_parser_unit.js +6 -7
  173. package/test/text/mp4_ttml_parser_unit.js +6 -4
  174. package/test/text/mp4_vtt_parser_unit.js +6 -5
  175. package/test/text/sbv_text_parser_unit.js +5 -6
  176. package/test/text/srt_text_parser_unit.js +5 -6
  177. package/test/text/ssa_text_parser_unit.js +17 -29
  178. package/test/text/text_engine_unit.js +45 -5
  179. package/test/text/ttml_text_parser_unit.js +77 -77
  180. package/test/text/vtt_text_parser_unit.js +116 -59
  181. package/test/ui/ui_integration.js +0 -16
  182. package/test/ui/ui_unit.js +27 -0
  183. package/test/util/cmcd_manager_unit.js +3 -0
  184. package/test/util/mime_utils_unit.js +54 -0
  185. package/test/util/periods_unit.js +79 -0
  186. package/test/util/stream_utils_unit.js +23 -7
  187. package/ui/controls.js +65 -40
  188. package/ui/fullscreen_button.js +26 -6
  189. package/ui/less/containers.less +3 -3
  190. package/ui/locales/en.json +1 -0
  191. package/ui/locales/source.json +5 -0
  192. package/ui/resolution_selection.js +31 -33
  193. package/ui/ui.js +0 -17
  194. package/docs/tutorials/gsoc-ideas-list.md +0 -3
  195. package/docs/tutorials/upgrade-v2-5.md +0 -441
  196. package/docs/tutorials/upgrade-v3.md +0 -38
  197. package/lib/polyfill/mathround.js +0 -49
  198. package/lib/polyfill/patchedmediakeys_apple.js +0 -744
  199. package/lib/polyfill/patchedmediakeys_ms.js +0 -698
  200. package/lib/util/mutex.js +0 -52
  201. package/test/util/functional_unit.js +0 -82
@@ -73,10 +73,8 @@ player.getConfiguration();
73
73
  failureCallback: Function
74
74
  ignoreTextStreamFailures: false
75
75
  alwaysStreamText: false
76
- jumpLargeGaps: false
77
76
  rebufferingGoal: 2
78
77
  retryParameters: Object
79
- smallGapLimit: 0.5
80
78
  startAtSegmentBoundary: false
81
79
  safeSeekOffset: 5
82
80
  textDisplayFactory: Function
@@ -184,6 +184,11 @@ Microsoft Documentation: https://docs.microsoft.com/en-us/playready/overview/sec
184
184
 
185
185
  NB: Audio Hardware DRM is not supported (PlayReady limitation)
186
186
 
187
+ ##### FairPlay
188
+
189
+ Based on [Apple's Documentation](https://developer.apple.com/streaming/fps/),
190
+ you should provide an empty string as robustness
191
+
187
192
  ##### Other key-systems
188
193
 
189
194
  Values for other key systems are not known to us at this time.
@@ -1,40 +1,25 @@
1
1
  # FairPlay Support
2
2
 
3
- When using native `src=` playback, we support using FairPlay on Safari.
3
+ We support FairPlay with EME on compatible environments or native `src=`.
4
4
  Adding FairPlay support involves a bit more work than other key systems.
5
5
 
6
-
7
6
  ## Server certificate
8
7
 
9
- All FairPlay content requires setting a server certificate. This is set in the
10
- Player configuration:
8
+ All FairPlay content requires setting a server certificate. You can either
9
+ provide it directly or set a serverCertificateUri for Shaka to fetch it for
10
+ you.
11
11
 
12
12
  ```js
13
13
  const req = await fetch('https://example.com/cert.der');
14
14
  const cert = await req.arrayBuffer();
15
15
 
16
- player.configure('drm.advanced.com\\.apple\\.fps\\.1_0.serverCertificate',
16
+ player.configure('drm.advanced.com\\.apple\\.fps\\.serverCertificate',
17
17
  new Uint8Array(cert));
18
18
  ```
19
19
 
20
-
21
- ## Content ID
22
-
23
- Some FairPlay content use custom signaling for the content ID. The content ID
24
- is used by the browser to generate the license request. If you don't use the
25
- default content ID derivation, you need to specify a custom init data transform:
26
-
27
20
  ```js
28
- player.configure('drm.initDataTransform', (initData, initDataType) => {
29
- if (initDataType != 'skd')
30
- return initData;
31
-
32
- // 'initData' is a buffer containing an 'skd://' URL as a UTF-8 string.
33
- const skdUri = shaka.util.StringUtils.fromBytesAutoDetect(initData);
34
- const contentId = getMyContentId(skdUri);
35
- const cert = player.drmInfo().serverCertificate;
36
- return shaka.util.FairPlayUtils.initDataTransform(initData, contentId, cert);
37
- });
21
+ player.configure('drm.advanced.com\\.apple\\.fps\\.serverCertificateUri',
22
+ 'https://example.com/cert.der');
38
23
  ```
39
24
 
40
25
  ## License wrapping
@@ -43,17 +43,6 @@ headers in the response. Additionally, with some manifests, we will send a
43
43
  This can also happen with mixed-content restrictions. If the site is using
44
44
  `https:`, then your manifest and segments must also.
45
45
 
46
- *Sending `Range` header at the start of HLS playback can be disabled using this config:*
47
- ```
48
- player.configure({
49
- manifest: {
50
- hls: {
51
- useFullSegmentsForStartTime: true,
52
- },
53
- },
54
- })
55
- ```
56
-
57
46
  <hr>
58
47
 
59
48
  **Q:** I am getting `REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE` or error code
@@ -21,12 +21,6 @@
21
21
  { "blob-url": { "title": "Blob URL" } },
22
22
  { "selenium-grid-config": { "title": "Selenium Grid Config" } },
23
23
  { "faq": { "title": "Frequently Asked Questions" } },
24
- { "upgrade": {
25
- "title": "Upgrade Guide",
26
- "children": {
27
- "upgrade-v2-5": { "title": "Upgrade Guide, v2.5 => v3" },
28
- "upgrade-v3": { "title": "Upgrade Guide, v3" },
29
- "upgrade-manifest": { "title": "Shaka Player Manifest Upgrade Guide" }
30
- }
31
- } }
24
+ { "upgrade": { "title": "Upgrade Guide" } },
25
+ { "upgrade-manifest": { "title": "ManifestParser Upgrade Guide" } }
32
26
  ]
@@ -69,9 +69,7 @@ __Polyfills__
69
69
  {@linksource shaka.polyfill.Fullscreen}
70
70
  - prefixed video QoE metrics:
71
71
  {@linksource shaka.polyfill.VideoPlaybackQuality}
72
- - prefixed EME implementations for IE 11 and very old versions of embedded
73
- Chrome/Chromium:
74
- - {@linksource shaka.polyfill.PatchedMediaKeysMs}
72
+ - prefixed EME implementations:
75
73
  - {@linksource shaka.polyfill.PatchedMediaKeysWebkit}
76
74
  - {@linksource shaka.polyfill.PatchedMediaKeysNop}
77
75
  - variants of VTTCue and TextTrackCue constructors:
@@ -1,17 +1,91 @@
1
1
  # Shaka Player Upgrade Guide
2
2
 
3
- If you are upgrading from **v1 - v2.2**, please see
4
- {@link https://v2-4-7-dot-shaka-player-demo.appspot.com/docs/api/tutorial-upgrade.html
5
- the upgrade guides from the v2.4 releases}, then return to this guide.
3
+ If you are upgrading from **v1 or v2**, these releases are no longer supported,
4
+ and upgrade guides are no longer maintained. You can use these old upgrades
5
+ guides to upgrade in stages:
6
6
 
7
- If you are upgrading from **v2.3 - v2.4**, please see
8
- {@link https://v2-5-10-dot-shaka-player-demo.appspot.com/docs/api/tutorial-upgrade.html
9
- the upgrade guides from the v2.5 releases}, then return to this guide.
7
+ - {@link https://v2-4-7-dot-shaka-player-demo.appspot.com/docs/api/tutorial-upgrade.html Upgrade to v2.4}
8
+ - {@link https://v2-5-23-dot-shaka-player-demo.appspot.com/docs/api/tutorial-upgrade-v2-4.html Upgrade v2.4 => v2.5}
9
+ - {@link https://v3-0-15-dot-shaka-player-demo.appspot.com/docs/api/tutorial-upgrade-v2-5.html Upgrade v2.5 => v3.0}
10
10
 
11
- From these older release branches, you will have to use our upgrade guides in
12
- phases. This is necessary to keep our guides maintainable. Thanks for your
13
- understanding!
11
+ Since v3.0, Shaka Player has been following semantic versioning. (The
12
+ IE11 deprecation announced before v3.0 happened in v3.1, which technically
13
+ breaks semantic versioning guarantees. It is the only intentional exception.)
14
14
 
15
- If you are upgrading from **v2.5**, please see {@tutorial upgrade-v2-5}.
15
+ Upgrading from any v3 release to a newer v3 release should be backward
16
+ compatible. The same is true of all major version numbers (v4 => v4, etc).
16
17
 
17
- If you are upgrading from another **v3** release, please see {@tutorial upgrade-v3}.
18
+ Here is a summary of breaking changes that might require upgrades to your
19
+ application:
20
+
21
+
22
+ ## v3.1
23
+
24
+ - New dependencies:
25
+ - TextDecoder/TextEncoder platform support or polyfill required (affects
26
+ Xbox One, but not evergreen browsers); we suggest the polyfill
27
+ [https://github.com/anonyco/FastestSmallestTextEncoderDecoder](fastestsmallesttextencoderdecoder/EncoderDecoderTogether.min.js)
28
+
29
+ - Support removed:
30
+ - IE11 support removed
31
+
32
+
33
+ ## v4.0
34
+
35
+ - Support removed:
36
+ - Older TVs and set-top boxes that do not support MediaSource sequence mode
37
+ can no longer play HLS content (since we now use sequence mode for that)
38
+ - Support for iOS 12 and Safari 12 has been removed
39
+
40
+ - Configuration changes:
41
+ - `manifest.dash.defaultPresentationDelay` has been replaced by
42
+ `manifest.defaultPresentationDelay` (deprecated in v3.0.0)
43
+ - Configuration of factories should be plain factory functions, not
44
+ constructors; these will not be invoked with `new` (deprecated in v3.1.0)
45
+ - `drm.initDataTransform` now defaults to a no-op
46
+ - `streaming.smallGapLimit` and `streaming.jumpLargeGaps` have been removed;
47
+ all gaps will now be jumped
48
+ - `manifest.hls.useFullSegmentsForStartTime` has been removed; this setting
49
+ is no longer necessary, as we no longer fetch segments for start times in
50
+ the HLS parser
51
+
52
+ - Player API changes:
53
+ - `shaka.Player.prototype.addTextTrack()` has been replaced by
54
+ `addTextTrackAsync()`, which returns a `Promise` (deprecated in v3.1.0)
55
+
56
+ - UI API changes:
57
+ - `shaka.ui.TrackLabelFormat` has been renamed to
58
+ `shaka.ui.Overlay.TrackLabelFormat` (deprecated in v3.1.0)
59
+ - `shaka.ui.FailReasonCode` has been renamed to
60
+ `shaka.ui.Overlay.FailReasonCode` (deprecated in v3.1.0)
61
+
62
+ - Offline API changes:
63
+ - `shaka.offline.Storage.prototype.store()` returns `AbortableOperation`
64
+ instead of `Promise`; callers should change `.then()` to
65
+ `.promise.then()` and `await rv` to `await rv.promise` (deprecated in
66
+ v3.0.0)
67
+ - `shaka.offline.Storage.prototype.getStoreInProgress()` has been removed;
68
+ concurrent operations are supported since v3, so callers don't need to
69
+ check this (deprecated in v3.0.0)
70
+
71
+ - Utility API changes:
72
+ - `shaka.util.Uint8ArrayUtils.equal` has been replaced by
73
+ `shaka.util.BufferUtils.equal`, which can handle multiple types of
74
+ buffers (deprecated in v3.0.0)
75
+
76
+ - Manifest API changes:
77
+ - `shaka.media.SegmentIndex.prototype.destroy()` has been replaced by
78
+ `release()`, which is synchronous (deprecated in v3.0.0)
79
+ - `shaka.media.SegmentIterator.prototype.seek()`, which mutates the
80
+ iterator, has been replaced by
81
+ `shaka.media.SegmentIndex.getIteratorForTime()` (deprecated in v3.1.0)
82
+ - `shaka.media.SegmentIndex.prototype.merge()` has become private; use
83
+ `mergeAndEvict()` instead (deprecated in v3.2.0)
84
+
85
+ - Plugin changes:
86
+ - `AbrManager` plugins must implement the `playbackRateChanged()` method
87
+ (deprecated in v3.0.0)
88
+ - `shaka.extern.Cue.prototype.spacer` has been replaced by the more
89
+ clearly-named `lineBreak` (deprecated in v3.1.0)
90
+ - `IUIElement` plugins must have a `release()` method (not `destroy()`)
91
+ (deprecated in v3.0.0)
@@ -0,0 +1,15 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for Shaka polyfills
9
+ *
10
+ * @externs
11
+ */
12
+
13
+
14
+ /** @type {boolean} */
15
+ window.shakaMediaKeysPolyfill;
@@ -17,7 +17,8 @@
17
17
  * textStreams: !Array.<shaka.extern.Stream>,
18
18
  * imageStreams: !Array.<shaka.extern.Stream>,
19
19
  * offlineSessionIds: !Array.<string>,
20
- * minBufferTime: number
20
+ * minBufferTime: number,
21
+ * sequenceMode: boolean
21
22
  * }}
22
23
  *
23
24
  * @description
@@ -72,6 +73,9 @@
72
73
  * The minimum number of seconds of content that must be buffered before
73
74
  * playback can begin. Can be overridden by a higher value from the Player
74
75
  * configuration.
76
+ * @property {boolean} sequenceMode
77
+ * If true, we will append the media segments using sequence mode; that is to
78
+ * say, ignoring any timestamps inside the media files.
75
79
  *
76
80
  * @exportDoc
77
81
  */
@@ -60,6 +60,9 @@ shaka.extern.RetryParameters;
60
60
  * retryParameters: !shaka.extern.RetryParameters,
61
61
  * licenseRequestType: ?string,
62
62
  * sessionId: ?string,
63
+ * drmInfo: ?shaka.extern.DrmInfo,
64
+ * initData: ?Uint8Array,
65
+ * initDataType: ?string,
63
66
  * streamDataCallback: ?function(BufferSource):!Promise
64
67
  * }}
65
68
  *
@@ -90,6 +93,15 @@ shaka.extern.RetryParameters;
90
93
  * @property {?string} sessionId
91
94
  * If this is a LICENSE request, this field contains the session ID of the
92
95
  * EME session that made the request.
96
+ * @property {?shaka.extern.DrmInfo} drmInfo
97
+ * If this is a LICENSE request, this field contains the DRM info used to
98
+ * initialize EME.
99
+ * @property {?Uint8Array} initData
100
+ * If this is a LICENSE request, this field contains the initData info used
101
+ * to initialize EME.
102
+ * @property {?string} initDataType
103
+ * If this is a LICENSE request, this field contains the initDataType info
104
+ * used to initialize EME.
93
105
  * @property {?function(BufferSource):!Promise} streamDataCallback
94
106
  * A callback function to handle the chunked data of the ReadableStream.
95
107
  * @exportDoc
@@ -73,7 +73,8 @@ shaka.extern.StoredContent;
73
73
  * sessionIds: !Array.<string>,
74
74
  * drmInfo: ?shaka.extern.DrmInfo,
75
75
  * appMetadata: Object,
76
- * isIncomplete: (boolean|undefined)
76
+ * isIncomplete: (boolean|undefined),
77
+ * sequenceMode: (boolean|undefined)
77
78
  * }}
78
79
  *
79
80
  * @property {number} creationTime
@@ -98,6 +99,9 @@ shaka.extern.StoredContent;
98
99
  * A metadata object passed from the application.
99
100
  * @property {(boolean|undefined)} isIncomplete
100
101
  * If true, the content is still downloading.
102
+ * @property {(boolean|undefined)} sequenceMode
103
+ * If true, we will append the media segments using sequence mode; that is to
104
+ * say, ignoring any timestamps inside the media files.
101
105
  */
102
106
  shaka.extern.ManifestDB;
103
107
 
@@ -208,6 +208,8 @@ shaka.extern.BufferedInfo;
208
208
  * pixelAspectRatio: ?string,
209
209
  * hdr: ?string,
210
210
  * mimeType: ?string,
211
+ * audioMimeType: ?string,
212
+ * videoMimeType: ?string,
211
213
  * codecs: ?string,
212
214
  * audioCodec: ?string,
213
215
  * videoCodec: ?string,
@@ -267,6 +269,10 @@ shaka.extern.BufferedInfo;
267
269
  * The video HDR provided in the manifest, if present.
268
270
  * @property {?string} mimeType
269
271
  * The MIME type of the content provided in the manifest.
272
+ * @property {?string} audioMimeType
273
+ * The audio MIME type of the content provided in the manifest.
274
+ * @property {?string} videoMimeType
275
+ * The video MIME type of the content provided in the manifest.
270
276
  * @property {?string} codecs
271
277
  * The audio/video codecs string provided in the manifest, if present.
272
278
  * @property {?string} audioCodec
@@ -740,9 +746,10 @@ shaka.extern.DashManifestConfiguration;
740
746
  * @typedef {{
741
747
  * ignoreTextStreamFailures: boolean,
742
748
  * ignoreImageStreamFailures: boolean,
743
- * useFullSegmentsForStartTime: boolean,
744
749
  * defaultAudioCodec: string,
745
- * defaultVideoCodec: string
750
+ * defaultVideoCodec: string,
751
+ * ignoreManifestProgramDateTime: boolean,
752
+ * mediaPlaylistFullMimeType: string
746
753
  * }}
747
754
  *
748
755
  * @property {boolean} ignoreTextStreamFailures
@@ -751,15 +758,26 @@ shaka.extern.DashManifestConfiguration;
751
758
  * @property {boolean} ignoreImageStreamFailures
752
759
  * If <code>true</code>, ignore any errors in a image stream and filter out
753
760
  * those streams.
754
- * @property {boolean} useFullSegmentsForStartTime
755
- * If <code>true</code>, force HlsParser to use a full segment request for
756
- * determining start time in case the server does not support partial requests
757
761
  * @property {string} defaultAudioCodec
758
762
  * The default audio codec if it is not specified in the HLS playlist.
759
763
  * <i>Defaults to <code>'mp4a.40.2'</code>.</i>
760
764
  * @property {string} defaultVideoCodec
761
765
  * The default video codec if it is not specified in the HLS playlist.
762
766
  * <i>Defaults to <code>'avc1.42E01E'</code>.</i>
767
+ * @property {boolean} ignoreManifestProgramDateTime
768
+ * If <code>true</code>, the HLS parser will ignore the
769
+ * <code>EXT-X-PROGRAM-DATE-TIME</code> tags in the manifest.
770
+ * Meant for tags that are incorrect or malformed.
771
+ * <i>Defaults to <code>false</code>.</i>
772
+ * @property {string} mediaPlaylistFullMimeType
773
+ * A string containing a full mime type, including both the basic mime type
774
+ * and also the codecs. Used when the HLS parser parses a media playlist
775
+ * directly, required since all of the mime type and codecs information is
776
+ * contained within the master playlist.
777
+ * You can use the <code>shaka.util.MimeUtils.getFullType()</code> utility to
778
+ * format this value.
779
+ * <i>Defaults to
780
+ * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
763
781
  * @exportDoc
764
782
  */
765
783
  shaka.extern.HlsManifestConfiguration;
@@ -774,6 +792,7 @@ shaka.extern.HlsManifestConfiguration;
774
792
  * disableText: boolean,
775
793
  * disableThumbnails: boolean,
776
794
  * defaultPresentationDelay: number,
795
+ * segmentRelativeVttTiming: boolean,
777
796
  * dash: shaka.extern.DashManifestConfiguration,
778
797
  * hls: shaka.extern.HlsManifestConfiguration
779
798
  * }}
@@ -805,6 +824,10 @@ shaka.extern.HlsManifestConfiguration;
805
824
  * configured or set as 0.
806
825
  * For HLS, the default value is 3 segments duration if not configured or
807
826
  * set as 0.
827
+ * @property {boolean} segmentRelativeVttTiming
828
+ * Option to calculate VTT text timings relative to the segment start
829
+ * instead of relative to the period start (which is the default).
830
+ * Defaults to <code>false</code>.
808
831
  * @property {shaka.extern.DashManifestConfiguration} dash
809
832
  * Advanced parameters used by the DASH manifest parser.
810
833
  * @property {shaka.extern.HlsManifestConfiguration} hls
@@ -826,8 +849,6 @@ shaka.extern.ManifestConfiguration;
826
849
  * alwaysStreamText: boolean,
827
850
  * startAtSegmentBoundary: boolean,
828
851
  * gapDetectionThreshold: number,
829
- * smallGapLimit: number,
830
- * jumpLargeGaps: boolean,
831
852
  * durationBackoff: number,
832
853
  * forceTransmuxTS: boolean,
833
854
  * safeSeekOffset: number,
@@ -882,18 +903,8 @@ shaka.extern.ManifestConfiguration;
882
903
  * to <code>false</code>.
883
904
  * @property {number} gapDetectionThreshold
884
905
  * TThe maximum distance (in seconds) before a gap when we'll automatically
885
- * jump. This value defaults to <code>0.1</code>, except in Edge Legacy, IE,
906
+ * jump. This value defaults to <code>0.1</code>, except in Edge Legacy,
886
907
  * Tizen, Chromecast that value defaults value is <code>0.5</code>
887
- * @property {number} smallGapLimit
888
- * The limit (in seconds) for a gap in the media to be considered "small".
889
- * Small gaps are jumped automatically without events. Large gaps result
890
- * in a Player event and can be jumped.
891
- * @property {boolean} jumpLargeGaps
892
- * If <code>true</code>, jump large gaps in addition to small gaps. A
893
- * <code>largegap</code> event will be raised first. Then, if the app doesn't
894
- * call <code>preventDefault()</code> on the event, the Player will jump the
895
- * gap. If <code>false</code>, then the event will be raised, but the gap
896
- * will not be jumped.
897
908
  * @property {number} durationBackoff
898
909
  * By default, we will not allow seeking to exactly the duration of a
899
910
  * presentation. This field is the number of seconds before duration we will
@@ -928,8 +939,9 @@ shaka.extern.ManifestConfiguration;
928
939
  * @property {boolean} useNativeHlsOnSafari
929
940
  * Desktop Safari has both MediaSource and their native HLS implementation.
930
941
  * Depending on the application's needs, it may prefer one over the other.
931
- * Examples: FairPlay is only supported via Safari's native HLS, but it
932
- * doesn't have an API for selecting specific tracks.
942
+ * Warning when disabled: Where single-key DRM streams work fine, multi-keys
943
+ * streams is showing unexpected behaviours (stall, audio playing with video
944
+ * freezes, ...). Use with care.
933
945
  * @property {number} inaccurateManifestTolerance
934
946
  * The maximum difference, in seconds, between the times in the manifest and
935
947
  * the times in the segments. Larger values allow us to compensate for more
@@ -1074,7 +1086,8 @@ shaka.extern.CmcdConfiguration;
1074
1086
  * function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>,
1075
1087
  * downloadSizeCallback: function(number):!Promise<boolean>,
1076
1088
  * progressCallback: function(shaka.extern.StoredContent,number),
1077
- * usePersistentLicense: boolean
1089
+ * usePersistentLicense: boolean,
1090
+ * numberOfParallelDownloads: number
1078
1091
  * }}
1079
1092
  *
1080
1093
  * @property {function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>}
@@ -1097,6 +1110,11 @@ shaka.extern.CmcdConfiguration;
1097
1110
  * license. A network will be required to retrieve a temporary license to
1098
1111
  * view.
1099
1112
  * Defaults to <code>true</code>.
1113
+ * @property {number} numberOfParallelDownloads
1114
+ * Number of parallel downloads.
1115
+ * Note: normally browsers limit to 5 request in parallel, so putting a
1116
+ * number higher than this will not help it download faster.
1117
+ * Defaults to <code>5</code>.
1100
1118
  * @exportDoc
1101
1119
  */
1102
1120
  shaka.extern.OfflineConfiguration;
@@ -380,17 +380,6 @@ shaka.extern.Cue = class {
380
380
  * @exportDoc
381
381
  */
382
382
  this.lineBreak;
383
-
384
- /**
385
- * @deprecated
386
- * "spacer" is deprecated and will be removed in v4. Use "lineBreak"
387
- * instead.
388
- * Whether or not the cue only acts as a line break between two nested cues.
389
- * Should only appear in nested cues.
390
- * @type {boolean}
391
- * @exportDoc
392
- */
393
- this.spacer;
394
383
  }
395
384
  };
396
385
 
@@ -426,6 +415,13 @@ shaka.extern.TextParser = class {
426
415
  * @exportDoc
427
416
  */
428
417
  parseMedia(data, timeContext) {}
418
+
419
+ /**
420
+ * Notifies the stream if the manifest is in sequence mode or not.
421
+ *
422
+ * @param {boolean} sequenceMode
423
+ */
424
+ setSequenceMode(sequenceMode) {}
429
425
  };
430
426
 
431
427
 
@@ -435,7 +431,8 @@ shaka.extern.TextParser = class {
435
431
  * @typedef {{
436
432
  * periodStart: number,
437
433
  * segmentStart: number,
438
- * segmentEnd: number
434
+ * segmentEnd: number,
435
+ * vttOffset: number
439
436
  * }}
440
437
  *
441
438
  * @property {number} periodStart
@@ -444,6 +441,9 @@ shaka.extern.TextParser = class {
444
441
  * The absolute start time of the segment in seconds.
445
442
  * @property {number} segmentEnd
446
443
  * The absolute end time of the segment in seconds.
444
+ * @property {number} vttOffset
445
+ * The start time relative to either segment or period start depending
446
+ * on <code>segmentRelativeVttTiming</code> configuration.
447
447
  *
448
448
  * @exportDoc
449
449
  */
@@ -0,0 +1,15 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for SourceBuffer which are missing from the Closure
9
+ * compiler.
10
+ *
11
+ * @externs
12
+ */
13
+
14
+ /** @type {string} */
15
+ SourceBuffer.prototype.mode;
package/karma.conf.js CHANGED
@@ -363,6 +363,8 @@ module.exports = (config) => {
363
363
  // If testing custom assets, we don't serve other unit or integration tests.
364
364
  // External asset tests are the basis for custom asset testing, so this file
365
365
  // is automatically included.
366
+ clientArgs.testFiles.push('demo/common/asset.js');
367
+ clientArgs.testFiles.push('demo/common/assets.js');
366
368
  clientArgs.testFiles.push('test/player_external.js');
367
369
  } else {
368
370
  // In a normal test run, we serve unit tests.
@@ -374,6 +376,8 @@ module.exports = (config) => {
374
376
  }
375
377
  if (settings.external) {
376
378
  // If --external is present, we serve external asset tests.
379
+ clientArgs.testFiles.push('demo/common/asset.js');
380
+ clientArgs.testFiles.push('demo/common/assets.js');
377
381
  clientArgs.testFiles.push('test/**/*_external.js');
378
382
  }
379
383
  }
@@ -18,14 +18,18 @@ shaka.ads.ClientSideAd = class {
18
18
  /**
19
19
  * @param {!google.ima.Ad} imaAd
20
20
  * @param {!google.ima.AdsManager} imaAdManager
21
+ * @param {HTMLMediaElement} video
21
22
  */
22
- constructor(imaAd, imaAdManager) {
23
+ constructor(imaAd, imaAdManager, video) {
23
24
  /** @private {google.ima.Ad} */
24
25
  this.ad_ = imaAd;
25
26
 
26
27
  /** @private {google.ima.AdsManager} */
27
28
  this.manager_ = imaAdManager;
28
29
 
30
+ /** @private {HTMLMediaElement} */
31
+ this.video_ = video;
32
+
29
33
  /** @private {boolean} */
30
34
  this.isPaused_ = false;
31
35
 
@@ -176,7 +180,14 @@ shaka.ads.ClientSideAd = class {
176
180
  * @export
177
181
  */
178
182
  resize(width, height) {
179
- const viewMode = document.fullscreenElement ?
183
+ let isInFullscreen = false;
184
+ const video = /** @type {HTMLVideoElement} */(this.video_);
185
+ if (document.fullscreenEnabled) {
186
+ isInFullscreen = !!document.fullscreenElement;
187
+ } else if (video.webkitSupportsFullscreen) {
188
+ isInFullscreen = video.webkitDisplayingFullscreen;
189
+ }
190
+ const viewMode = isInFullscreen ?
180
191
  google.ima.ViewMode.FULLSCREEN : google.ima.ViewMode.NORMAL;
181
192
  this.manager_.resize(width, height, viewMode);
182
193
  }
@@ -181,7 +181,7 @@ shaka.ads.ClientSideAdManager = class {
181
181
  this.addImaEventListeners_();
182
182
 
183
183
  try {
184
- const viewMode = document.fullscreenElement ?
184
+ const viewMode = this.isFullScreenEnabled_() ?
185
185
  google.ima.ViewMode.FULLSCREEN : google.ima.ViewMode.NORMAL;
186
186
 
187
187
  this.imaAdsManager_.init(this.video_.offsetWidth,
@@ -191,7 +191,7 @@ shaka.ads.ClientSideAdManager = class {
191
191
  // because 'loadedmetadata' is sometimes called before the video resizes
192
192
  // on some platforms (e.g. Safari).
193
193
  this.eventManager_.listen(this.video_, 'loadeddata', () => {
194
- const viewMode = document.fullscreenElement ?
194
+ const viewMode = this.isFullScreenEnabled_() ?
195
195
  google.ima.ViewMode.FULLSCREEN : google.ima.ViewMode.NORMAL;
196
196
  this.imaAdsManager_.resize(this.video_.offsetWidth,
197
197
  this.video_.offsetHeight, viewMode);
@@ -199,7 +199,7 @@ shaka.ads.ClientSideAdManager = class {
199
199
 
200
200
  if ('ResizeObserver' in window) {
201
201
  this.resizeObserver_ = new ResizeObserver(() => {
202
- const viewMode = document.fullscreenElement ?
202
+ const viewMode = this.isFullScreenEnabled_() ?
203
203
  google.ima.ViewMode.FULLSCREEN : google.ima.ViewMode.NORMAL;
204
204
  this.imaAdsManager_.resize(this.video_.offsetWidth,
205
205
  this.video_.offsetHeight, viewMode);
@@ -221,6 +221,23 @@ shaka.ads.ClientSideAdManager = class {
221
221
  }
222
222
 
223
223
 
224
+ /**
225
+ * @return {boolean}
226
+ * @private
227
+ */
228
+ isFullScreenEnabled_() {
229
+ if (document.fullscreenEnabled) {
230
+ return !!document.fullscreenElement;
231
+ } else {
232
+ const video = /** @type {HTMLVideoElement} */(this.video_);
233
+ if (video.webkitSupportsFullscreen) {
234
+ return video.webkitDisplayingFullscreen;
235
+ }
236
+ }
237
+ return false;
238
+ }
239
+
240
+
224
241
  /**
225
242
  * @private
226
243
  */
@@ -389,7 +406,8 @@ shaka.ads.ClientSideAdManager = class {
389
406
  'Should have an ads manager at this point!');
390
407
 
391
408
  const imaAd = e.getAd();
392
- this.ad_ = new shaka.ads.ClientSideAd(imaAd, this.imaAdsManager_);
409
+ this.ad_ = new shaka.ads.ClientSideAd(imaAd,
410
+ this.imaAdsManager_, this.video_);
393
411
  const data = new Map()
394
412
  .set('ad', this.ad_)
395
413
  .set('sdkAdObject', imaAd)
@@ -373,7 +373,6 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
373
373
  */
374
374
  shaka.cast.CastUtils.PlayerVoidMethods = [
375
375
  'addChaptersTrack',
376
- 'addTextTrack',
377
376
  'addTextTrackAsync',
378
377
  'cancelTrickPlay',
379
378
  'configure',