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
@@ -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,89 @@
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` has been removed (no longer needed since the
46
+ minimum supported version of iOS is now 13)
47
+ - `streaming.smallGapLimit` and `streaming.jumpLargeGaps` have been removed;
48
+ all gaps will now be jumped
49
+
50
+ - Player API changes:
51
+ - `shaka.Player.prototype.addTextTrack()` has been replaced by
52
+ `addTextTrackAsync()`, which returns a `Promise` (deprecated in v3.1.0)
53
+
54
+ - UI API changes:
55
+ - `shaka.ui.TrackLabelFormat` has been renamed to
56
+ `shaka.ui.Overlay.TrackLabelFormat` (deprecated in v3.1.0)
57
+ - `shaka.ui.FailReasonCode` has been renamed to
58
+ `shaka.ui.Overlay.FailReasonCode` (deprecated in v3.1.0)
59
+
60
+ - Offline API changes:
61
+ - `shaka.offline.Storage.prototype.store()` returns `AbortableOperation`
62
+ instead of `Promise`; callers should change `.then()` to
63
+ `.promise.then()` and `await rv` to `await rv.promise` (deprecated in
64
+ v3.0.0)
65
+ - `shaka.offline.Storage.prototype.getStoreInProgress()` has been removed;
66
+ concurrent operations are supported since v3, so callers don't need to
67
+ check this (deprecated in v3.0.0)
68
+
69
+ - Utility API changes:
70
+ - `shaka.util.Uint8ArrayUtils.equal` has been replaced by
71
+ `shaka.util.BufferUtils.equal`, which can handle multiple types of
72
+ buffers (deprecated in v3.0.0)
73
+
74
+ - Manifest API changes:
75
+ - `shaka.media.SegmentIndex.prototype.destroy()` has been replaced by
76
+ `release()`, which is synchronous (deprecated in v3.0.0)
77
+ - `shaka.media.SegmentIterator.prototype.seek()`, which mutates the
78
+ iterator, has been replaced by
79
+ `shaka.media.SegmentIndex.getIteratorForTime()` (deprecated in v3.1.0)
80
+ - `shaka.media.SegmentIndex.prototype.merge()` has become private; use
81
+ `mergeAndEvict()` instead (deprecated in v3.2.0)
82
+
83
+ - Plugin changes:
84
+ - `AbrManager` plugins must implement the `playbackRateChanged()` method
85
+ (deprecated in v3.0.0)
86
+ - `shaka.extern.Cue.prototype.spacer` has been replaced by the more
87
+ clearly-named `lineBreak` (deprecated in v3.1.0)
88
+ - `IUIElement` plugins must have a `release()` method (not `destroy()`)
89
+ (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
@@ -612,9 +618,6 @@ shaka.extern.AdvancedDrmConfiguration;
612
618
  * clearKeys: !Object.<string, string>,
613
619
  * delayLicenseRequestUntilPlayed: boolean,
614
620
  * advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
615
- * initDataTransform:
616
- * ((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
617
- * undefined),
618
621
  * logLicenseExchange: boolean,
619
622
  * updateExpirationTime: number,
620
623
  * preferredKeySystems: !Array.<string>
@@ -638,14 +641,6 @@ shaka.extern.AdvancedDrmConfiguration;
638
641
  * <i>Optional.</i> <br>
639
642
  * A dictionary which maps key system IDs to advanced DRM configuration for
640
643
  * those key systems.
641
- * @property
642
- * {((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
643
- * undefined)}
644
- * initDataTransform
645
- * <i>Optional.</i><br>
646
- * If given, this function is called with the init data from the
647
- * manifest/media and should return the (possibly transformed) init data to
648
- * pass to the browser.
649
644
  * @property {boolean} logLicenseExchange
650
645
  * <i>Optional.</i><br>
651
646
  * If set to <code>true</code>, prints logs containing the license exchange.
@@ -740,9 +735,10 @@ shaka.extern.DashManifestConfiguration;
740
735
  * @typedef {{
741
736
  * ignoreTextStreamFailures: boolean,
742
737
  * ignoreImageStreamFailures: boolean,
743
- * useFullSegmentsForStartTime: boolean,
744
738
  * defaultAudioCodec: string,
745
- * defaultVideoCodec: string
739
+ * defaultVideoCodec: string,
740
+ * ignoreManifestProgramDateTime: boolean,
741
+ * mediaPlaylistFullMimeType: string
746
742
  * }}
747
743
  *
748
744
  * @property {boolean} ignoreTextStreamFailures
@@ -751,15 +747,26 @@ shaka.extern.DashManifestConfiguration;
751
747
  * @property {boolean} ignoreImageStreamFailures
752
748
  * If <code>true</code>, ignore any errors in a image stream and filter out
753
749
  * 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
750
  * @property {string} defaultAudioCodec
758
751
  * The default audio codec if it is not specified in the HLS playlist.
759
752
  * <i>Defaults to <code>'mp4a.40.2'</code>.</i>
760
753
  * @property {string} defaultVideoCodec
761
754
  * The default video codec if it is not specified in the HLS playlist.
762
755
  * <i>Defaults to <code>'avc1.42E01E'</code>.</i>
756
+ * @property {boolean} ignoreManifestProgramDateTime
757
+ * If <code>true</code>, the HLS parser will ignore the
758
+ * <code>EXT-X-PROGRAM-DATE-TIME</code> tags in the manifest.
759
+ * Meant for tags that are incorrect or malformed.
760
+ * <i>Defaults to <code>false</code>.</i>
761
+ * @property {string} mediaPlaylistFullMimeType
762
+ * A string containing a full mime type, including both the basic mime type
763
+ * and also the codecs. Used when the HLS parser parses a media playlist
764
+ * directly, required since all of the mime type and codecs information is
765
+ * contained within the master playlist.
766
+ * You can use the <code>shaka.util.MimeUtils.getFullType()</code> utility to
767
+ * format this value.
768
+ * <i>Defaults to
769
+ * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
763
770
  * @exportDoc
764
771
  */
765
772
  shaka.extern.HlsManifestConfiguration;
@@ -774,6 +781,7 @@ shaka.extern.HlsManifestConfiguration;
774
781
  * disableText: boolean,
775
782
  * disableThumbnails: boolean,
776
783
  * defaultPresentationDelay: number,
784
+ * segmentRelativeVttTiming: boolean,
777
785
  * dash: shaka.extern.DashManifestConfiguration,
778
786
  * hls: shaka.extern.HlsManifestConfiguration
779
787
  * }}
@@ -805,6 +813,10 @@ shaka.extern.HlsManifestConfiguration;
805
813
  * configured or set as 0.
806
814
  * For HLS, the default value is 3 segments duration if not configured or
807
815
  * set as 0.
816
+ * @property {boolean} segmentRelativeVttTiming
817
+ * Option to calculate VTT text timings relative to the segment start
818
+ * instead of relative to the period start (which is the default).
819
+ * Defaults to <code>false</code>.
808
820
  * @property {shaka.extern.DashManifestConfiguration} dash
809
821
  * Advanced parameters used by the DASH manifest parser.
810
822
  * @property {shaka.extern.HlsManifestConfiguration} hls
@@ -826,8 +838,6 @@ shaka.extern.ManifestConfiguration;
826
838
  * alwaysStreamText: boolean,
827
839
  * startAtSegmentBoundary: boolean,
828
840
  * gapDetectionThreshold: number,
829
- * smallGapLimit: number,
830
- * jumpLargeGaps: boolean,
831
841
  * durationBackoff: number,
832
842
  * forceTransmuxTS: boolean,
833
843
  * safeSeekOffset: number,
@@ -882,18 +892,8 @@ shaka.extern.ManifestConfiguration;
882
892
  * to <code>false</code>.
883
893
  * @property {number} gapDetectionThreshold
884
894
  * 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,
895
+ * jump. This value defaults to <code>0.1</code>, except in Edge Legacy,
886
896
  * 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
897
  * @property {number} durationBackoff
898
898
  * By default, we will not allow seeking to exactly the duration of a
899
899
  * presentation. This field is the number of seconds before duration we will
@@ -928,8 +928,9 @@ shaka.extern.ManifestConfiguration;
928
928
  * @property {boolean} useNativeHlsOnSafari
929
929
  * Desktop Safari has both MediaSource and their native HLS implementation.
930
930
  * 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.
931
+ * Warning when disabled: Where single-key DRM streams work fine, multi-keys
932
+ * streams is showing unexpected behaviours (stall, audio playing with video
933
+ * freezes, ...). Use with care.
933
934
  * @property {number} inaccurateManifestTolerance
934
935
  * The maximum difference, in seconds, between the times in the manifest and
935
936
  * the times in the segments. Larger values allow us to compensate for more
@@ -1074,7 +1075,8 @@ shaka.extern.CmcdConfiguration;
1074
1075
  * function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>,
1075
1076
  * downloadSizeCallback: function(number):!Promise<boolean>,
1076
1077
  * progressCallback: function(shaka.extern.StoredContent,number),
1077
- * usePersistentLicense: boolean
1078
+ * usePersistentLicense: boolean,
1079
+ * numberOfParallelDownloads: number
1078
1080
  * }}
1079
1081
  *
1080
1082
  * @property {function(shaka.extern.TrackList):!Promise<shaka.extern.TrackList>}
@@ -1097,6 +1099,11 @@ shaka.extern.CmcdConfiguration;
1097
1099
  * license. A network will be required to retrieve a temporary license to
1098
1100
  * view.
1099
1101
  * Defaults to <code>true</code>.
1102
+ * @property {number} numberOfParallelDownloads
1103
+ * Number of parallel downloads.
1104
+ * Note: normally browsers limit to 5 request in parallel, so putting a
1105
+ * number higher than this will not help it download faster.
1106
+ * Defaults to <code>5</code>.
1100
1107
  * @exportDoc
1101
1108
  */
1102
1109
  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;
@@ -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',