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
@@ -1,441 +0,0 @@
1
- # Shaka Upgrade Guide, v2.5 => v3.0
2
-
3
- This is a detailed guide for upgrading from Shaka Player v2.5 to v3.0.
4
- Feel free to skim or to search for the class and method names you are using in
5
- your application.
6
-
7
-
8
- #### What's New in v3.0?
9
-
10
- Shaka v3.0 introduces several improvements over v2.5, including:
11
- - Ad-insertion APIs (integrated with the Google IMA SDK)
12
- - Ad-related UI elements
13
- - Offline storage operations can be aborted
14
- - Support for concurrent operations in a single shaka.offline.Storage instance
15
- - Config field `manifest.dash.defaultPresentationDelay` has been moved to
16
- `manifest.defaultPresentationDelay` and now applies to both DASH & HLS
17
- - New config field `streaming.inaccurateManifestTolerance` to control
18
- assumptions about manifest accuracy
19
- - New fields in getStats()
20
- - Stable Track objects across DASH Periods
21
- - New loop button available in UI overflow menu (`'loop'`, hidden by default)
22
- - New playback rate submenu in UI overflow menu (`'playback_rate'`, shown by
23
- default)
24
-
25
-
26
- #### Player Factory parameter change
27
-
28
- The optional `Factory` parameter in `Player.load()` and `Storage.store()` has
29
- been changed to a MIME type string. The `Factory` parameter was deprecated in
30
- v2.5 and removed in v3.0. Applications MUST update to use MIME types instead of
31
- explicit factories. Any registered factory can be referenced by its registered
32
- MIME type.
33
-
34
- ```js
35
- // v2.4:
36
- player.load('foo.mpd', /* startTime= */ 0,
37
- /* factory= */ shaka.dash.DashParser);
38
-
39
- // v3.0:
40
- player.load('foo.mpd', /* startTime= */ 0,
41
- /* mimeType= */ 'application/dash+xml');
42
- ```
43
-
44
- See {@link shaka.Player#load} for details.
45
-
46
-
47
- #### Manifest URI API change
48
-
49
- The method `Player.getManifestUri()` has been renamed to `Player.getAssetUri()`.
50
- The older method was deprecated in v2.5 and was removed in v3.0. Applications
51
- MUST update to the new method, whose name more accurately reflects our support
52
- for non-manifest content.
53
-
54
- ```js
55
- // v2.4:
56
- const uri = player.getManifestUri();
57
-
58
- // v3.0:
59
- const uri = player.getAssetUri();
60
- ```
61
-
62
-
63
- #### UI API change
64
-
65
- In v2.5.1, the method `shaka.ui.Overlay.getPlayer()` was deprecated and moved
66
- to `ui.getControls().getPlayer()`. In v3.0, the old location was removed.
67
- Applications that use this method MUST update to the new location.
68
-
69
- ```js
70
- // v2.5:
71
- const player = ui.getPlayer();
72
-
73
- // v3.0:
74
- const player = ui.getControls().getPlayer();
75
- ```
76
-
77
-
78
- #### Embedded text (CEA 608/708) API change
79
-
80
- The CEA-specific methods `Player.selectEmbeddedTextTrack()` and
81
- `Player.usingEmbeddedTextTrack()` were deprecated in v2.5 and were removed in
82
- v3.0. CEA captions now show up in the standard text track APIs:
83
- `getTextTracks()`, `selectTextTrack()`, `getTextLanguages()`,
84
- `getTextLanguagesAndRoles()`, and `selectTextLanguage()`. Applications MUST
85
- update to using the track APIs. If you have content with VTT or TTML subtitles,
86
- you should already be using these APIs.
87
-
88
- ```js
89
- // v2.4:
90
- player.selectEmbeddedTextTrack();
91
-
92
- // v3.0:
93
- const tracks = player.getTextTracks();
94
- const desiredTrack = someProcessToChooseOne(tracks);
95
- player.selectTextTrack(desiredTrack);
96
- ```
97
-
98
-
99
- #### Utility method changes
100
-
101
- In v3.0, the method `shaka.util.Uint8ArrayUtils.equal` has been moved to
102
- `shaka.util.BufferUtils.equal`. The new method supports both `ArrayBuffer` and
103
- subclasses of `ArrayBufferView` like `Uint8Array`.
104
-
105
- Backward compatibility will be provided until v4.0. Applications SHOULD update
106
- to use the new location.
107
-
108
- ```js
109
- // v2.5:
110
- if (shaka.util.Uint8ArrayUtils.equal(array1, array2) { ...
111
-
112
- // v3.0:
113
- if (shaka.util.BufferUtils.equal(array1, array2) { ...
114
- ```
115
-
116
-
117
- #### Configurable factory changes
118
-
119
- All configuration fields and plugin registration interfaces that accept
120
- factories have been changed in v3.0. These factories SHOULD now be functions
121
- that return an object and MAY be arrow functions. This makes our configuration
122
- and plugin registration interfaces consistent and improves usability in some
123
- cases.
124
-
125
- Backward compatibility is provided until v4.0. If we detect that a factory
126
- needs to be called with `new`, we will do so and log a deprecation warning.
127
- Applications SHOULD update their factories.
128
-
129
- This change affects the following types:
130
-
131
- - {@link shaka.extern.AbrManager.Factory}
132
- - {@link shaka.extern.ManifestParser.Factory}
133
- - {@link shaka.extern.TextDisplayer.Factory}
134
- - {@link shaka.extern.TextParserPlugin}
135
-
136
- ```js
137
- // v2.5:
138
- class MyAbrManager {
139
- // ...
140
- }
141
- player.configure('abrFactory', MyAbrManager);
142
-
143
- class MyManifestParser {
144
- // ...
145
- }
146
- shaka.media.ManifestParser.registerParserByMime('text/foo', MyManifestParser);
147
-
148
- // v3.0:
149
- player.configure('abrFactory', () => new MyAbrManager());
150
- shaka.media.ManifestParser.registerParserByMime(
151
- 'text/foo', () => new MyManifestParser());
152
- ```
153
-
154
-
155
- #### FairPlay configuration changes
156
-
157
- The init data format in our Safari EME polyfill has been updated to match the
158
- init data format of Safari's unprefixed EME implementation. This means init
159
- data will arrive in the "skd" format, which is different from what was provided
160
- by the polyfill in v2.5. This format is a buffer containing a UTF-8 string,
161
- which is a URL that begins with `skd://`. Init data processing done by the
162
- `drm.initDataTransform` callback MUST be updated.
163
-
164
- The signature of the configurable callback `drm.initDataTransform` has changed.
165
- Applications using this for FairPlay content MUST update their callbacks. A
166
- new parameter has been added to the callback signature.
167
-
168
- ```js
169
- // v2.5:
170
- function initDataTransform(/** Uint8Array */ initData,
171
- /** shaka.extern.DrmInfo */ drmInfo) {}
172
-
173
- // v3.0:
174
- function initDataTransform(/** Uint8Array */ initData,
175
- /** string */ initDataType,
176
- /** shaka.extern.DrmInfo */ drmInfo) {}
177
- ```
178
-
179
- The new default for `drm.initDataTransform` should work for most content.
180
- Please try the default first (without configuring your own callback). If init
181
- data transformation is still needed, please use the utilities provided in
182
- {@link shaka.util.FairPlayUtils}, {@link shaka.util.StringUtils} to make this
183
- processing easier. You can refer to {@tutorial fairplay} as well.
184
-
185
-
186
- #### Misc configuration changes
187
-
188
- The configurable callback `manifest.dash.customScheme` has been removed in v3.0
189
- and is no longer supported.
190
-
191
- The config field `manifest.dash.defaultPresentationDelay` has been moved to
192
- `manifest.defaultPresentationDelay`. Backward compatibility is provided until
193
- v4.0. Applications using this field SHOULD update to use the new location.
194
-
195
- The `manifest.defaultPresentationDelay` field now affects both DASH and HLS
196
- content. The default value is `0`, which is interpreted differently for DASH
197
- and HLS:
198
-
199
- - In DASH, `0` means a default of `1.5 * minBufferTime`.
200
- - In HLS, `0` means a default of `3 * segment duration`.
201
-
202
- The config field `manifest.dash.initialSegmentLimit` has been added to control
203
- memory usage during DASH `<SegmentTemplate>` parsing.
204
-
205
- The config field `streaming.inaccurateManifestTolerance` (in seconds) has been
206
- added to control off-by-one behavior in streaming. Compared with v2.5.x
207
- behavior, the default for this field should reduce the frequency with which we
208
- have to fetch an additional segment before a seek target. For less accurate
209
- manifests, the tolerance can be increased. For completely accurate manifests,
210
- applications may set this to `0`.
211
-
212
- See {@link shaka.extern.ManifestConfiguration} and
213
- {@link shaka.extern.StreamingConfiguration} for details.
214
-
215
-
216
- #### Offline API changes
217
-
218
- In v3.0, the offline storage method `Storage.getStoreInProgress()` is now
219
- deprecated and always returns `false`. There is no longer any restriction on
220
- concurrent operations. This method will be removed in v4.0. Applications
221
- SHOULD stop using it.
222
-
223
- The method `Storage.store()` now returns an instance of `IAbortableOperation`
224
- instead of `Promise`. This allows applications to call `op.abort()` to stop an
225
- operation in progress. The operation `Promise` can now be found on
226
- `op.promise`. Backward compatibility is provided until v4.0; these operations
227
- will work like `Promise`s in v3.0. (Applications MAY `await` them or call
228
- `.then()` on them.) In v4.0, these returned operations will no longer be
229
- `Promise`-like, so applications SHOULD update at this time to use `op.promise`.
230
-
231
- ```js
232
- // v2.5:
233
- try {
234
- const result = await storage.store();
235
- } catch (error) {
236
- // Store failed!
237
- }
238
-
239
- // v3.0:
240
- const op = storage.store();
241
- cancelButton.onclick = async () => {
242
- await op.abort();
243
- };
244
-
245
- try {
246
- const result = await op.promise;
247
- } catch (error) {
248
- if (error.code == shaka.util.Error.Code.OPERATION_ABORTED) {
249
- // Store aborted by the user!
250
- } else {
251
- // Store failed!
252
- }
253
- }
254
- ```
255
-
256
- In v3.0, `shaka.offline.Storage.configure()` now takes a complete `Player`
257
- configuration object instead of a separate one. The fields that were previously
258
- part of the `Storage` config (`trackSelectionCallback`, `progressCallback`, and
259
- `usePersistentLicense`) have been moved inside the `offline` field. The old
260
- field locations were deprecated in v2.5 and removed in v3.0. Applications MUST
261
- update to use the new field locations.
262
-
263
- ```js
264
- // v2.4:
265
- storage.configure({
266
- trackSelectionCallback: myTrackSelectionCallback,
267
- });
268
-
269
- // v3.0:
270
- const storage = new shaka.offline.Storage();
271
- storage.configure({
272
- offline: {
273
- trackSelectionCallback: myTrackSelectionCallback,
274
- },
275
- });
276
-
277
- // OR use shared Player configuration:
278
- const storage = new shaka.offline.Storage(player);
279
- player.configure({
280
- offline: {
281
- trackSelectionCallback: myTrackSelectionCallback,
282
- },
283
- });
284
-
285
- // OR use shared Player configuration and two-argument configure():
286
- const storage = new shaka.offline.Storage(player);
287
- player.configure('offline.trackSelectionCallback', myTrackSelectionCallback);
288
- ```
289
-
290
- See {@link shaka.offline.Storage} for details.
291
-
292
-
293
- #### NetworkingEngine API changes
294
-
295
- The fields `Request.body` and `Response.data` can now be either `ArrayBuffer` or
296
- an `ArrayBufferView` (e.g. `Uint8Array`). This means your request and response
297
- filters no longer have to convert a `Uint8Array` to `ArrayBuffer` to assign to
298
- `Request.body` or `Response.data`. However, this also means such filters MUST
299
- not assume one type or the other if they read those fields.
300
-
301
- Applications SHOULD use these provided utilities to simplify common conversions:
302
-
303
- - {@link shaka.util.BufferUtils}
304
- - {@link shaka.util.StringUtils}
305
- - {@link shaka.util.Uint8ArrayUtils}
306
-
307
-
308
- #### Track API changes
309
-
310
- The track APIs on `Player` have changed. Tracks now represent the entire
311
- presentation across DASH Periods, and will no longer change at Period
312
- boundaries. The `originalId` field is now a combination of the original IDs of
313
- the DASH Representations that make up the track.
314
-
315
-
316
- #### Stats changes
317
-
318
- The stats returned by `Player.getStats()` have changed.
319
-
320
- The `streamBandwidth` field now accounts for the current playback rate when
321
- reporting the bandwidth requirements of a stream. For example, if the content
322
- is playing at 2x, the bandwidth requirement to play it is also doubled.
323
-
324
- The following new fields have been added:
325
-
326
- - `manifestTimeSeconds`
327
- - `drmTimeSeconds`
328
- - `liveLatency`
329
-
330
- See {@link shaka.extern.Stats stats} for details.
331
-
332
-
333
- #### New UI elements
334
-
335
- The following new UI elements have been added:
336
-
337
- - Ad-related elements (shown automatically during an ad, not currently
338
- configurable)
339
- - Overflow menu toggle for looping video (`'loop'`, not shown by default)
340
- - Overflow menu item and submenu for playback rate (`'playback_rate'`, shown
341
- by default)
342
-
343
- See {@tutorial ui-customization}.
344
-
345
-
346
- #### AbrManager plugin changes
347
-
348
- In v3.0, we added a method to the `shaka.extern.AbrManager` interface called
349
- `playbackRateChanged(rate)`. This allows implementations to consider the
350
- current playback rate in their ABR decisions.
351
-
352
- Backward compatibility will be provided until v4.0. Applications with custom
353
- `AbrManager` plugins SHOULD update to add this method to their implementations.
354
-
355
- See {@link shaka.extern.AbrManager} for details.
356
-
357
-
358
- #### TextDisplayer plugin changes
359
-
360
- The `Cue` objects consumed by `TextDisplayer` have changed in v3.0.
361
-
362
- - `Cue.size` now defaults to `0`, which should be interpreted as "auto" (fit
363
- to text).
364
-
365
- All application-specific TextDisplayer plugins MUST be updated.
366
- v3.0 does not have backward compatibility for this!
367
-
368
- In addition, the following new fields have been added and MAY be used by
369
- `TextDisplayer` plugins:
370
-
371
- - `Cue.backgroundImage`
372
- - `Cue.border`
373
- - `Cue.cellResolution`
374
- - `Cue.letterSpacing`
375
- - `Cue.linePadding`
376
- - `Cue.opacity`
377
-
378
- See {@link shaka.extern.Cue} for details.
379
-
380
-
381
- #### UI element plugin changes
382
-
383
- The interface {@link shaka.extern.IUIElement} now has a synchronous `release()`
384
- method instead of an asynchronous `destroy()` method. Backward compatibility
385
- will be provided until v4.0. Applications with UI element plugins SHOULD
386
- update their plugins to replace `destroy()` with `release()`.
387
-
388
- ```js
389
- // v2.5:
390
- class MyUIElement {
391
- async destroy() {
392
- // Release resources asynchronously.
393
- }
394
- }
395
-
396
- // v3.0:
397
- class MyUIElement {
398
- release() {
399
- // Release resources synchronously.
400
- }
401
- }
402
- ```
403
-
404
-
405
- #### Built-in network scheme plugin changes
406
-
407
- Some of the built-in network scheme plugins have changed their API. Instead of
408
- registering the class itself, they now register a static `parse()` method on
409
- the class. Any applications with scheme plugins that delegate to these
410
- built-in plugins MUST update to call the new methods.
411
-
412
- This affects the following classes:
413
-
414
- - {@link shaka.net.DataUriPlugin}
415
- - {@link shaka.net.HttpFetchPlugin}
416
- - {@link shaka.net.HttpXHRPlugin}
417
-
418
- ```js
419
- // v2.5:
420
- function MySchemePlugin(uri, request, requestType, progressUpdated) {
421
- return shaka.net.DataUriPlugin(
422
- uri, request, requestType, progressUpdated);
423
- }
424
- shaka.net.NetworkingEngine.registerScheme('data', MySchemePlugin);
425
-
426
- // v3.0:
427
- function MySchemePlugin(uri, request, requestType, progressUpdated) {
428
- return shaka.net.DataUriPlugin.parse(
429
- uri, request, requestType, progressUpdated);
430
- }
431
- ```
432
-
433
-
434
- #### Manifest parser plugin API changes
435
-
436
- v3.0 introduced many changes to the {@link shaka.extern.Manifest} structure.
437
- Any application with a custom {@link shaka.extern.ManifestParser} or which uses
438
- {@link shaka.Player#getManifest} MUST be upgraded for compatibility with v3.0.
439
-
440
- If your application meets either of these criteria, please refer to
441
- {@tutorial upgrade-manifest} for detailed instructions on upgrading.
@@ -1,38 +0,0 @@
1
- # Shaka Upgrade Guide, v3
2
-
3
- This is a detailed guide for upgrading from any older version of Shaka Player v3
4
- to the current version.
5
-
6
- Shaka Player has been keeping strictly with semantic versioning since v3.0.0, so
7
- upgrades from any older v3 to the current v3 release should be backward
8
- compatible. Any minor exceptions or nuances will be noted here.
9
-
10
-
11
- #### What's New?
12
-
13
- v3.1:
14
- - Ads APIs and UI leveraging Google IMA SDK (included separately by app)
15
- - Low-latency HLS support
16
- - Built-in CEA 608/708 decoder (mux.js no longer needed for this)
17
- - Thumbnail track support
18
- - UI overflow menu items now available as control panel buttons
19
- - Network stall detection
20
- - HDR & spatial audio metadata
21
- - PlayReady support in HLS
22
- - WebVTT styling and embedded tag support
23
- - SubViewer (SBV), SubStation Alpha (SSA), LyRiCs (LRC), and SubRip (SRT)
24
- subtitle format support
25
- - Forced subtitles
26
- - Side-loaded subtitles in src= playback mode
27
- - Custom seekbar UI plugin
28
- - AirPlay support in UI
29
-
30
-
31
- #### New Requirements
32
-
33
- v3.1:
34
- - TextDecoder/TextEncoder platform support or polyfill required
35
- - Affects Xbox One
36
- - We suggest [https://github.com/anonyco/FastestSmallestTextEncoderDecoder](fastestsmallesttextencoderdecoder/EncoderDecoderTogether.min.js)
37
- - IE11 support dropped (announced before v3.0)
38
-
@@ -1,49 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- goog.provide('shaka.polyfill.MathRound');
7
-
8
- goog.require('shaka.log');
9
- goog.require('shaka.polyfill');
10
-
11
- /**
12
- * @summary A polyfill to patch math round bug on some browsers.
13
- * @see https://stackoverflow.com/q/12830742
14
- * @export
15
- */
16
- shaka.polyfill.MathRound = class {
17
- /**
18
- * Install the polyfill if needed.
19
- * @export
20
- */
21
- static install() {
22
- shaka.log.debug('mathRound.install');
23
-
24
- const testNumber = shaka.polyfill.MathRound.MAX_ACCURATE_INPUT_ + 1;
25
- if (Math.round(testNumber) != testNumber) {
26
- shaka.log.debug('polyfill Math.round');
27
- const originalMathRound = Math.round;
28
- Math.round = (number) => {
29
- let result = number;
30
- // Due to the precision of JavaScript numbers, the number must be
31
- // integer.
32
- if (number <= shaka.polyfill.MathRound.MAX_ACCURATE_INPUT_) {
33
- result = originalMathRound(number);
34
- }
35
- return result;
36
- };
37
- }
38
- }
39
- };
40
-
41
-
42
- /**
43
- @const {number}
44
- @private
45
- */
46
- shaka.polyfill.MathRound.MAX_ACCURATE_INPUT_ = 0x10000000000000;
47
-
48
-
49
- shaka.polyfill.register(shaka.polyfill.MathRound.install);