shaka-player 3.1.0 → 3.1.4

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 (181) hide show
  1. package/AUTHORS +8 -2
  2. package/CHANGELOG.md +209 -0
  3. package/CONTRIBUTORS +10 -3
  4. package/README.md +3 -0
  5. package/build/apps.py +2 -2
  6. package/build/check.py +2 -2
  7. package/build/conformance.textproto +0 -9
  8. package/build/generateExterns.js +1 -1
  9. package/build/misspellings.txt +1 -0
  10. package/build/shakaBuildHelpers.py +6 -5
  11. package/build/subprocessWindowsPatch.py +103 -0
  12. package/demo/common/asset.js +11 -0
  13. package/demo/common/assets.js +1 -1
  14. package/demo/common/message_ids.js +5 -0
  15. package/demo/config.js +2 -1
  16. package/demo/custom.js +84 -3
  17. package/demo/demo.less +13 -1
  18. package/demo/demo_utils.js +1 -0
  19. package/demo/input.js +31 -12
  20. package/demo/input_container.js +24 -1
  21. package/demo/locales/en.json +6 -1
  22. package/demo/locales/source.json +20 -0
  23. package/demo/main.js +5 -1
  24. package/dist/controls.css +2 -2
  25. package/dist/controls.css.map +1 -1
  26. package/dist/demo.compiled.debug.js +99 -91
  27. package/dist/demo.compiled.debug.map +3 -3
  28. package/dist/demo.compiled.js +99 -91
  29. package/dist/demo.compiled.map +3 -3
  30. package/dist/demo.css +1 -1
  31. package/dist/demo.css.map +1 -1
  32. package/dist/deps.js +9 -9
  33. package/dist/locales.js +36 -34
  34. package/dist/receiver.compiled.debug.js +74 -70
  35. package/dist/receiver.compiled.debug.map +3 -3
  36. package/dist/receiver.compiled.js +74 -70
  37. package/dist/receiver.compiled.map +3 -3
  38. package/dist/shaka-player.compiled.d.ts +165 -9
  39. package/dist/shaka-player.compiled.debug.d.ts +165 -9
  40. package/dist/shaka-player.compiled.debug.externs.js +179 -11
  41. package/dist/shaka-player.compiled.debug.js +367 -339
  42. package/dist/shaka-player.compiled.debug.map +4 -4
  43. package/dist/shaka-player.compiled.externs.js +179 -11
  44. package/dist/shaka-player.compiled.js +818 -807
  45. package/dist/shaka-player.compiled.map +4 -4
  46. package/dist/shaka-player.ui.d.ts +165 -9
  47. package/dist/shaka-player.ui.debug.d.ts +165 -9
  48. package/dist/shaka-player.ui.debug.externs.js +181 -13
  49. package/dist/shaka-player.ui.debug.js +459 -429
  50. package/dist/shaka-player.ui.debug.map +4 -4
  51. package/dist/shaka-player.ui.externs.js +181 -13
  52. package/dist/shaka-player.ui.js +973 -961
  53. package/dist/shaka-player.ui.map +4 -4
  54. package/docs/tutorials/fairplay.md +1 -1
  55. package/docs/tutorials/faq.md +25 -0
  56. package/docs/tutorials/index.json +2 -2
  57. package/docs/tutorials/upgrade-v3.md +38 -0
  58. package/docs/tutorials/upgrade.md +3 -3
  59. package/externs/ima.js +4 -0
  60. package/externs/media_capabilities.js +16 -0
  61. package/externs/shaka/ads.js +2 -0
  62. package/externs/shaka/net.js +2 -2
  63. package/externs/shaka/player.js +6 -0
  64. package/karma.conf.js +1 -0
  65. package/lib/abr/simple_abr_manager.js +1 -1
  66. package/lib/ads/ad_manager.js +29 -11
  67. package/lib/ads/client_side_ad_manager.js +76 -86
  68. package/lib/ads/server_side_ad_manager.js +26 -11
  69. package/lib/cast/cast_proxy.js +3 -2
  70. package/lib/cast/cast_receiver.js +2 -1
  71. package/lib/cast/cast_sender.js +2 -2
  72. package/lib/cea/sei_processor.js +24 -17
  73. package/lib/dash/dash_parser.js +107 -4
  74. package/lib/dash/segment_list.js +1 -1
  75. package/lib/dash/segment_template.js +45 -15
  76. package/lib/dependencies/all.js +15 -15
  77. package/lib/hls/hls_parser.js +46 -18
  78. package/lib/media/closed_caption_parser.js +3 -1
  79. package/lib/media/content_workarounds.js +18 -0
  80. package/lib/media/drm_engine.js +20 -1
  81. package/lib/media/gap_jumping_controller.js +8 -4
  82. package/lib/media/media_source_engine.js +1 -2
  83. package/lib/media/playhead.js +1 -1
  84. package/lib/media/presentation_timeline.js +3 -1
  85. package/lib/media/segment_index.js +38 -12
  86. package/lib/media/segment_reference.js +8 -0
  87. package/lib/media/streaming_engine.js +30 -21
  88. package/lib/net/http_fetch_plugin.js +2 -2
  89. package/lib/net/networking_engine.js +3 -2
  90. package/lib/offline/storage.js +4 -0
  91. package/lib/player.js +113 -56
  92. package/lib/polyfill/encryption_scheme.js +2 -0
  93. package/lib/polyfill/fullscreen.js +2 -0
  94. package/lib/polyfill/mathround.js +2 -0
  95. package/lib/polyfill/media_capabilities.js +62 -23
  96. package/lib/polyfill/mediasource.js +8 -0
  97. package/lib/polyfill/orientation.js +3 -1
  98. package/lib/polyfill/patchedmediakeys_apple.js +6 -4
  99. package/lib/polyfill/patchedmediakeys_ms.js +6 -4
  100. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  101. package/lib/polyfill/patchedmediakeys_webkit.js +6 -4
  102. package/lib/polyfill/pip_webkit.js +2 -0
  103. package/lib/polyfill/storage_estimate.js +2 -0
  104. package/lib/polyfill/video_play_promise.js +2 -0
  105. package/lib/polyfill/videoplaybackquality.js +2 -0
  106. package/lib/polyfill/vttcue.js +2 -0
  107. package/lib/text/cue.js +11 -0
  108. package/lib/text/mp4_ttml_parser.js +3 -0
  109. package/lib/text/text_engine.js +14 -2
  110. package/lib/text/ttml_text_parser.js +52 -30
  111. package/lib/text/ui_text_displayer.js +255 -82
  112. package/lib/text/vtt_text_parser.js +4 -2
  113. package/lib/util/error.js +1 -4
  114. package/lib/util/fake_event.js +53 -7
  115. package/lib/util/mime_utils.js +33 -0
  116. package/lib/util/mp4_box_parsers.js +1 -1
  117. package/lib/util/mp4_parser.js +14 -0
  118. package/lib/util/networking.js +1 -1
  119. package/lib/util/periods.js +132 -37
  120. package/lib/util/platform.js +13 -1
  121. package/lib/util/stream_utils.js +46 -7
  122. package/package.json +3 -3
  123. package/test/cast/cast_proxy_unit.js +12 -6
  124. package/test/cast/cast_receiver_integration.js +1 -1
  125. package/test/cast/cast_utils_unit.js +1 -1
  126. package/test/cea/mp4_cea_parser_unit.js +26 -0
  127. package/test/dash/dash_parser_live_unit.js +1 -0
  128. package/test/dash/dash_parser_manifest_unit.js +187 -1
  129. package/test/dash/dash_parser_segment_template_unit.js +3 -3
  130. package/test/demo/demo_unit.js +0 -1
  131. package/test/hls/hls_parser_unit.js +45 -1
  132. package/test/media/closed_caption_parser_unit.js +20 -0
  133. package/test/media/drm_engine_unit.js +59 -3
  134. package/test/media/playhead_unit.js +27 -1
  135. package/test/media/presentation_timeline_unit.js +19 -0
  136. package/test/media/segment_index_unit.js +76 -3
  137. package/test/media/streaming_engine_unit.js +3 -3
  138. package/test/player_integration.js +38 -0
  139. package/test/player_unit.js +125 -6
  140. package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
  141. package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
  142. package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
  143. package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
  144. package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
  145. package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
  146. package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
  147. package/test/test/assets/3675/dash_0.mpd +30 -0
  148. package/test/test/assets/3675/dash_1.mpd +30 -0
  149. package/test/test/assets/3675/dash_2.mpd +30 -0
  150. package/test/test/assets/3675/dash_3.mpd +30 -0
  151. package/test/test/assets/3675/dash_4.mpd +30 -0
  152. package/test/test/assets/3675/dash_5.mpd +26 -0
  153. package/test/test/assets/3675/init-stream0.m4s +0 -0
  154. package/test/test/assets/empty_caption_video_init.mp4 +0 -0
  155. package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
  156. package/test/test/util/fake_ad_manager.js +4 -1
  157. package/test/test/util/simple_fakes.js +5 -3
  158. package/test/test/util/waiter.js +36 -2
  159. package/test/text/ttml_text_parser_unit.js +55 -0
  160. package/test/text/ui_text_displayer_unit.js +95 -18
  161. package/test/text/vtt_text_parser_unit.js +17 -1
  162. package/test/ui/localization_unit.js +15 -14
  163. package/test/ui/text_displayer_layout_unit.js +52 -1
  164. package/test/ui/ui_unit.js +4 -0
  165. package/test/util/mp4_box_parsers_unit.js +28 -0
  166. package/test/util/periods_unit.js +190 -2
  167. package/test/util/stream_utils_unit.js +56 -5
  168. package/ui/airplay_button.js +5 -0
  169. package/ui/big_play_button.js +10 -0
  170. package/ui/cast_button.js +2 -3
  171. package/ui/controls.js +9 -7
  172. package/ui/less/containers.less +10 -5
  173. package/ui/locales/en.json +1 -0
  174. package/ui/locales/ru.json +6 -6
  175. package/ui/locales/source.json +4 -0
  176. package/ui/localization.js +28 -51
  177. package/ui/pip_button.js +2 -3
  178. package/ui/play_button.js +10 -10
  179. package/ui/small_play_button.js +12 -0
  180. package/ui/ui.js +1 -1
  181. package/docs/tutorials/upgrade-v2-4.md +0 -481
@@ -89,10 +89,7 @@ shaka.util.BufferUtils = class {
89
89
  * <ul>
90
90
  * <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaError">MediaError</a>
91
91
  * <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">HTTP Codes</a>
92
- * <li>
93
- * <a href="https://docs.microsoft.com/en-us/windows/win32/wmdm/error-codes">PlayReady errors</a>
94
- * or
95
- * <a href="https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/winrt/Windows.Media.Protection.PlayReadyErrors.h">more PlayReady errors</a>
92
+ * <li><a href="https://hresult.info">Edge/PlayReady errors</a>
96
93
  * </ul>
97
94
  * @implements {shaka.extern.Error}
98
95
  * @extends {Error}
@@ -931,12 +928,12 @@ shaka.dependencies = class {
931
928
  /**
932
929
  * Registers a new dependency.
933
930
  * @param {shaka.dependencies.Allowed} key which is used for retrieving a
934
- * dependency
931
+ * dependency
935
932
  * @param {?} dep a dependency
936
933
  */
937
934
  static add(key, dep) {}
938
935
  /**
939
- * Check if we have a dependency for the key
936
+ * Check if we have a dependency for the key.
940
937
  * @param {shaka.dependencies.Allowed} key key
941
938
  * @return {boolean}
942
939
  */
@@ -1195,7 +1192,7 @@ shaka.util.AbortableOperation.prototype.promise;
1195
1192
  shaka.util.FakeEvent = class {
1196
1193
  /**
1197
1194
  * @param {string} type
1198
- * @param {Object=} dict
1195
+ * @param {Map.<string, Object>=} dict
1199
1196
  */
1200
1197
  constructor(type, dict) {}
1201
1198
  };
@@ -1322,7 +1319,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
1322
1319
  * Makes a simple network request for the given URIs.
1323
1320
  * @param {!Array.<string>} uris
1324
1321
  * @param {shaka.extern.RetryParameters} retryParams
1325
- * @param {?function(BufferSource)=} streamDataCallback
1322
+ * @param {?function(BufferSource):!Promise=} streamDataCallback
1326
1323
  * @return {shaka.extern.Request}
1327
1324
  */
1328
1325
  static makeRequest(uris, retryParams, streamDataCallback) {}
@@ -1768,13 +1765,16 @@ shaka.media.SegmentIndex = class {
1768
1765
  offset(offset) {}
1769
1766
  /**
1770
1767
  * Merges the given SegmentReferences. Supports extending the original
1771
- * references only. Will not replace old references or interleave new ones.
1768
+ * references only. Will replace old references with equivalent new ones, and
1769
+ * keep any unique old ones.
1772
1770
  * Used, for example, by the DASH and HLS parser, where manifests may not list
1773
1771
  * all available references, so we must keep available references in memory to
1774
1772
  * fill the availability window.
1775
1773
  * @param {!Array.<!shaka.media.SegmentReference>} references The list of
1776
1774
  * SegmentReferences, which must be sorted first by their start times
1777
1775
  * (ascending) and second by their end times (ascending).
1776
+ * @deprecated Not used directly by our own parsers, so will become private in
1777
+ * v4. Use mergeAndEvict() instead.
1778
1778
  */
1779
1779
  merge(references) {}
1780
1780
  /**
@@ -1818,9 +1818,10 @@ shaka.media.SegmentIndex = class {
1818
1818
  /**
1819
1819
  * Returns a new iterator that initially points to the segment that contains
1820
1820
  * the given time. Like the normal iterator, next() must be called first to
1821
- * get to the first element.
1821
+ * get to the first element. Returns null if we do not find a segment at the
1822
+ * requested time.
1822
1823
  * @param {number} time
1823
- * @return {!shaka.media.SegmentIterator}
1824
+ * @return {?shaka.media.SegmentIterator}
1824
1825
  */
1825
1826
  getIteratorForTime(time) {}
1826
1827
  /**
@@ -2706,6 +2707,7 @@ shaka.ads.ServerSideAd = class {
2706
2707
  /**
2707
2708
  * A class responsible for ad-related interactions.
2708
2709
  * @implements {shaka.extern.IAdManager}
2710
+ * @implements {shaka.util.IReleasable}
2709
2711
  */
2710
2712
  shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2711
2713
  /** */
@@ -2718,6 +2720,10 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2718
2720
  * @override
2719
2721
  */
2720
2722
  initClientSide(adContainer, video) {}
2723
+ /**
2724
+ * @override
2725
+ */
2726
+ release() {}
2721
2727
  /**
2722
2728
  * @override
2723
2729
  */
@@ -3356,6 +3362,168 @@ shaka.polyfill = class {
3356
3362
  */
3357
3363
  static register(polyfill, priority) {}
3358
3364
  };
3365
+ /**
3366
+ * @summary A polyfill to add support for EncryptionScheme queries in EME.
3367
+ * @see https://wicg.github.io/encrypted-media-encryption-scheme/
3368
+ * @see https://github.com/w3c/encrypted-media/pull/457
3369
+ * @see https://github.com/google/eme-encryption-scheme-polyfill
3370
+ */
3371
+ shaka.polyfill.EncryptionScheme = class {
3372
+ /**
3373
+ * Install the polyfill if needed.
3374
+ * @suppress {missingRequire}
3375
+ */
3376
+ static install() {}
3377
+ };
3378
+ /**
3379
+ * @summary A polyfill to unify fullscreen APIs across browsers.
3380
+ * Many browsers have prefixed fullscreen methods on Element and document.
3381
+ * See {@link https://mzl.la/2K0xcHo Using fullscreen mode} on MDN for more
3382
+ * information.
3383
+ */
3384
+ shaka.polyfill.Fullscreen = class {
3385
+ /**
3386
+ * Install the polyfill if needed.
3387
+ */
3388
+ static install() {}
3389
+ };
3390
+ /**
3391
+ * @summary A polyfill to patch math round bug on some browsers.
3392
+ * @see https://stackoverflow.com/q/12830742
3393
+ */
3394
+ shaka.polyfill.MathRound = class {
3395
+ /**
3396
+ * Install the polyfill if needed.
3397
+ */
3398
+ static install() {}
3399
+ };
3400
+ /**
3401
+ * @summary A polyfill to provide navigator.mediaCapabilities on all browsers.
3402
+ * This is necessary for Tizen 3, Xbox One and possibly others we have yet to
3403
+ * discover.
3404
+ */
3405
+ shaka.polyfill.MediaCapabilities = class {
3406
+ /**
3407
+ * Install the polyfill if needed.
3408
+ * @suppress {const}
3409
+ */
3410
+ static install() {}
3411
+ };
3412
+ /**
3413
+ * @summary A polyfill to patch MSE bugs.
3414
+ */
3415
+ shaka.polyfill.MediaSource = class {
3416
+ /**
3417
+ * Install the polyfill if needed.
3418
+ */
3419
+ static install() {}
3420
+ };
3421
+ /**
3422
+ * @summary A polyfill for systems that do not implement screen.orientation.
3423
+ * For now, this only handles systems that implement the deprecated
3424
+ * window.orientation feature... e.g. iPad.
3425
+ */
3426
+ shaka.polyfill.Orientation = class {
3427
+ /**
3428
+ * Install the polyfill if needed.
3429
+ */
3430
+ static install() {}
3431
+ };
3432
+ /**
3433
+ * @summary A polyfill to implement modern, standardized EME on top of Apple's
3434
+ * prefixed EME in Safari.
3435
+ */
3436
+ shaka.polyfill.PatchedMediaKeysApple = class {
3437
+ /**
3438
+ * Installs the polyfill if needed.
3439
+ */
3440
+ static install() {}
3441
+ };
3442
+ /**
3443
+ * @summary A polyfill to implement
3444
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015}
3445
+ * on top of ms-prefixed
3446
+ * {@link https://www.w3.org/TR/2014/WD-encrypted-media-20140218/ EME v20140218}
3447
+ */
3448
+ shaka.polyfill.PatchedMediaKeysMs = class {
3449
+ /**
3450
+ * Installs the polyfill if needed.
3451
+ */
3452
+ static install() {}
3453
+ };
3454
+ /**
3455
+ * @summary A polyfill to stub out
3456
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015} on browsers without
3457
+ * EME.
3458
+ * All methods will fail.
3459
+ */
3460
+ shaka.polyfill.PatchedMediaKeysNop = class {
3461
+ /**
3462
+ * Installs the polyfill if needed.
3463
+ */
3464
+ static install() {}
3465
+ };
3466
+ /**
3467
+ * @summary A polyfill to implement
3468
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015} on top of
3469
+ * webkit-prefixed {@link https://bit.ly/Eme01b EME v0.1b}.
3470
+ */
3471
+ shaka.polyfill.PatchedMediaKeysWebkit = class {
3472
+ /**
3473
+ * Installs the polyfill if needed.
3474
+ */
3475
+ static install() {}
3476
+ };
3477
+ /**
3478
+ * @summary A polyfill to provide PiP support in Safari.
3479
+ * Note that Safari only supports PiP on video elements, not audio.
3480
+ */
3481
+ shaka.polyfill.PiPWebkit = class {
3482
+ /**
3483
+ * Install the polyfill if needed.
3484
+ */
3485
+ static install() {}
3486
+ };
3487
+ /**
3488
+ * @summary A polyfill to provide navigator.storage.estimate in old
3489
+ * webkit browsers.
3490
+ * See: https://developers.google.com/web/updates/2017/08/estimating-available-storage-space#the-present
3491
+ */
3492
+ shaka.polyfill.StorageEstimate = class {
3493
+ /**
3494
+ * Install the polyfill if needed.
3495
+ */
3496
+ static install() {}
3497
+ };
3498
+ /**
3499
+ * @summary A polyfill to silence the play() Promise in HTML5 video.
3500
+ */
3501
+ shaka.polyfill.VideoPlayPromise = class {
3502
+ /**
3503
+ * Install the polyfill if needed.
3504
+ */
3505
+ static install() {}
3506
+ };
3507
+ /**
3508
+ * @summary A polyfill to provide MSE VideoPlaybackQuality metrics.
3509
+ * Many browsers do not yet provide this API, and Chrome currently provides
3510
+ * similar data through individual prefixed attributes on HTMLVideoElement.
3511
+ */
3512
+ shaka.polyfill.VideoPlaybackQuality = class {
3513
+ /**
3514
+ * Install the polyfill if needed.
3515
+ */
3516
+ static install() {}
3517
+ };
3518
+ /**
3519
+ * @summary A polyfill to provide VTTCue.
3520
+ */
3521
+ shaka.polyfill.VTTCue = class {
3522
+ /**
3523
+ * Install the polyfill if needed.
3524
+ */
3525
+ static install() {}
3526
+ };
3359
3527
  /**
3360
3528
  * LRC file format: https://en.wikipedia.org/wiki/LRC_(file_format)
3361
3529
  * @implements {shaka.extern.TextParser}