shaka-player 3.2.0 → 3.2.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 (162) hide show
  1. package/.github/workflows/build_and_test.yaml +73 -0
  2. package/.github/workflows/release.yaml +53 -0
  3. package/AUTHORS +3 -0
  4. package/CHANGELOG.md +182 -1
  5. package/CONTRIBUTORS +3 -0
  6. package/README.md +4 -4
  7. package/build/checkversion.py +1 -1
  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/build/test.py +6 -0
  13. package/demo/common/assets.js +1 -1
  14. package/demo/index.html +1 -1
  15. package/dist/controls.css +2 -2
  16. package/dist/controls.css.map +1 -1
  17. package/dist/demo.compiled.debug.js +1 -1
  18. package/dist/demo.compiled.js +1 -1
  19. package/dist/deps.js +8 -8
  20. package/dist/locales.js +37 -37
  21. package/dist/receiver.compiled.debug.js +1 -1
  22. package/dist/receiver.compiled.js +1 -1
  23. package/dist/shaka-player.compiled.d.ts +195 -5
  24. package/dist/shaka-player.compiled.debug.d.ts +195 -5
  25. package/dist/shaka-player.compiled.debug.externs.js +226 -14
  26. package/dist/shaka-player.compiled.debug.js +424 -399
  27. package/dist/shaka-player.compiled.debug.map +4 -4
  28. package/dist/shaka-player.compiled.externs.js +226 -14
  29. package/dist/shaka-player.compiled.js +826 -812
  30. package/dist/shaka-player.compiled.map +4 -4
  31. package/dist/shaka-player.ui.d.ts +197 -16
  32. package/dist/shaka-player.ui.debug.d.ts +197 -16
  33. package/dist/shaka-player.ui.debug.externs.js +230 -27
  34. package/dist/shaka-player.ui.debug.js +466 -442
  35. package/dist/shaka-player.ui.debug.map +4 -4
  36. package/dist/shaka-player.ui.externs.js +230 -27
  37. package/dist/shaka-player.ui.js +946 -932
  38. package/dist/shaka-player.ui.map +4 -4
  39. package/docs/tutorials/fairplay.md +1 -1
  40. package/docs/tutorials/faq.md +14 -0
  41. package/docs/tutorials/ui.md +5 -5
  42. package/externs/ima.js +4 -0
  43. package/externs/shaka/ads.js +25 -0
  44. package/externs/shaka/player.js +8 -0
  45. package/externs/shaka/text.js +10 -0
  46. package/karma.conf.js +20 -15
  47. package/lib/ads/ad_manager.js +46 -26
  48. package/lib/ads/client_side_ad_manager.js +82 -88
  49. package/lib/ads/server_side_ad_manager.js +45 -13
  50. package/lib/cast/cast_proxy.js +6 -2
  51. package/lib/cast/cast_receiver.js +5 -1
  52. package/lib/cast/cast_sender.js +2 -2
  53. package/lib/cea/sei_processor.js +24 -17
  54. package/lib/dash/dash_parser.js +131 -24
  55. package/lib/dash/segment_list.js +1 -1
  56. package/lib/dash/segment_template.js +1 -1
  57. package/lib/hls/hls_parser.js +74 -17
  58. package/lib/hls/manifest_text_parser.js +1 -0
  59. package/lib/media/closed_caption_parser.js +3 -1
  60. package/lib/media/content_workarounds.js +12 -0
  61. package/lib/media/drm_engine.js +20 -1
  62. package/lib/media/gap_jumping_controller.js +8 -4
  63. package/lib/media/media_source_engine.js +1 -2
  64. package/lib/media/playhead.js +1 -1
  65. package/lib/media/region_observer.js +39 -33
  66. package/lib/media/region_timeline.js +17 -19
  67. package/lib/media/segment_index.js +2 -1
  68. package/lib/media/segment_reference.js +19 -1
  69. package/lib/media/streaming_engine.js +8 -4
  70. package/lib/net/networking_engine.js +6 -1
  71. package/lib/offline/download_manager.js +1 -2
  72. package/lib/offline/storage.js +8 -9
  73. package/lib/player.js +129 -59
  74. package/lib/polyfill/aria.js +12 -2
  75. package/lib/polyfill/encryption_scheme.js +2 -0
  76. package/lib/polyfill/fullscreen.js +2 -0
  77. package/lib/polyfill/mathround.js +2 -0
  78. package/lib/polyfill/media_capabilities.js +73 -21
  79. package/lib/polyfill/mediasource.js +8 -0
  80. package/lib/polyfill/orientation.js +3 -1
  81. package/lib/polyfill/patchedmediakeys_apple.js +6 -4
  82. package/lib/polyfill/patchedmediakeys_ms.js +6 -4
  83. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  84. package/lib/polyfill/patchedmediakeys_webkit.js +6 -4
  85. package/lib/polyfill/pip_webkit.js +2 -0
  86. package/lib/polyfill/storage_estimate.js +2 -0
  87. package/lib/polyfill/video_play_promise.js +2 -0
  88. package/lib/polyfill/videoplaybackquality.js +2 -0
  89. package/lib/polyfill/vttcue.js +2 -0
  90. package/lib/text/cue.js +6 -0
  91. package/lib/text/mp4_ttml_parser.js +3 -0
  92. package/lib/text/text_engine.js +14 -2
  93. package/lib/text/ttml_text_parser.js +135 -87
  94. package/lib/text/ui_text_displayer.js +213 -80
  95. package/lib/text/vtt_text_parser.js +4 -2
  96. package/lib/text/web_vtt_generator.js +21 -12
  97. package/lib/util/fake_event.js +53 -7
  98. package/lib/util/fake_event_target.js +21 -1
  99. package/lib/util/mp4_box_parsers.js +1 -1
  100. package/lib/util/periods.js +4 -1
  101. package/lib/util/platform.js +13 -1
  102. package/lib/util/stream_utils.js +105 -13
  103. package/lib/util/xml_utils.js +50 -12
  104. package/package.json +3 -6
  105. package/roadmap.md +24 -22
  106. package/test/cast/cast_proxy_unit.js +12 -6
  107. package/test/cast/cast_receiver_integration.js +1 -1
  108. package/test/cast/cast_utils_unit.js +1 -1
  109. package/test/cea/mp4_cea_parser_unit.js +26 -0
  110. package/test/dash/dash_parser_live_unit.js +43 -0
  111. package/test/dash/dash_parser_manifest_unit.js +222 -3
  112. package/test/hls/hls_parser_unit.js +79 -1
  113. package/test/media/closed_caption_parser_unit.js +20 -0
  114. package/test/media/drm_engine_integration.js +86 -2
  115. package/test/media/drm_engine_unit.js +57 -0
  116. package/test/media/playhead_unit.js +27 -1
  117. package/test/media/region_observer_unit.js +40 -5
  118. package/test/media/region_timeline_unit.js +40 -22
  119. package/test/media/streaming_engine_integration.js +2 -1
  120. package/test/media/streaming_engine_unit.js +145 -0
  121. package/test/player_integration.js +79 -8
  122. package/test/player_src_equals_integration.js +41 -8
  123. package/test/player_unit.js +14 -4
  124. package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
  125. package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
  126. package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
  127. package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
  128. package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
  129. package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
  130. package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
  131. package/test/test/assets/3675/dash_0.mpd +30 -0
  132. package/test/test/assets/3675/dash_1.mpd +30 -0
  133. package/test/test/assets/3675/dash_2.mpd +30 -0
  134. package/test/test/assets/3675/dash_3.mpd +30 -0
  135. package/test/test/assets/3675/dash_4.mpd +30 -0
  136. package/test/test/assets/3675/dash_5.mpd +26 -0
  137. package/test/test/assets/3675/init-stream0.m4s +0 -0
  138. package/test/test/assets/chapters.vtt +2 -2
  139. package/test/test/assets/chapters2.vtt +10 -0
  140. package/test/test/assets/empty_caption_video_init.mp4 +0 -0
  141. package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
  142. package/test/test/util/fake_ad_manager.js +11 -1
  143. package/test/test/util/ttml_utils.js +81 -0
  144. package/test/test/util/util.js +10 -7
  145. package/test/text/mp4_ttml_parser_unit.js +11 -18
  146. package/test/text/ttml_text_parser_unit.js +542 -220
  147. package/test/text/ui_text_displayer_unit.js +93 -20
  148. package/test/text/vtt_text_parser_unit.js +17 -1
  149. package/test/text/web_vtt_generator_unit.js +58 -3
  150. package/test/ui/localization_unit.js +15 -14
  151. package/test/ui/text_displayer_layout_unit.js +21 -8
  152. package/test/util/mp4_box_parsers_unit.js +28 -0
  153. package/test/util/stream_utils_unit.js +60 -3
  154. package/ui/cast_button.js +2 -3
  155. package/ui/controls.js +11 -6
  156. package/ui/less/buttons.less +0 -4
  157. package/ui/less/containers.less +6 -7
  158. package/ui/locales/ru.json +6 -6
  159. package/ui/localization.js +40 -87
  160. package/ui/pip_button.js +2 -3
  161. package/ui/seek_bar.js +1 -2
  162. package/ui/text_selection.js +1 -0
@@ -168,6 +168,10 @@ shaka.text.Cue.prototype.id;
168
168
  * @override
169
169
  */
170
170
  shaka.text.Cue.prototype.nestedCues;
171
+ /**
172
+ * @override
173
+ */
174
+ shaka.text.Cue.prototype.isContainer;
171
175
  /**
172
176
  * @override
173
177
  */
@@ -958,15 +962,28 @@ shaka.util.AbortableOperation.prototype.promise;
958
962
  shaka.util.FakeEvent = class {
959
963
  /**
960
964
  * @param {string} type
961
- * @param {Object=} dict
965
+ * @param {Map.<string, Object>=} dict
962
966
  */
963
967
  constructor(type, dict) {}
964
968
  };
969
+ /**
970
+ * An interface to standardize how objects release internal references
971
+ * synchronously. If an object needs to asynchronously release references, then
972
+ * it should use 'shaka.util.IDestroyable'.
973
+ * @interface
974
+ */
975
+ shaka.util.IReleasable = class {
976
+ /**
977
+ * Request that this object release all internal references.
978
+ */
979
+ release() {}
980
+ };
965
981
  /**
966
982
  * @summary A work-alike for EventTarget. Only DOM elements may be true
967
983
  * EventTargets, but this can be used as a base class to provide event dispatch
968
984
  * to non-DOM classes. Only FakeEvents should be dispatched.
969
985
  * @implements {EventTarget}
986
+ * @implements {shaka.util.IReleasable}
970
987
  */
971
988
  shaka.util.FakeEventTarget = class {
972
989
  /** */
@@ -1004,6 +1021,10 @@ shaka.util.FakeEventTarget = class {
1004
1021
  * @override
1005
1022
  */
1006
1023
  dispatchEvent(event) {}
1024
+ /**
1025
+ * @override
1026
+ */
1027
+ release() {}
1007
1028
  };
1008
1029
  /**
1009
1030
  * These are the listener types defined in the closure extern for EventTarget.
@@ -1161,18 +1182,6 @@ shaka.net.NetworkingEngine.PluginPriority = {
1161
1182
  'PREFERRED': 2,
1162
1183
  'APPLICATION': 3
1163
1184
  };
1164
- /**
1165
- * An interface to standardize how objects release internal references
1166
- * synchronously. If an object needs to asynchronously release references, then
1167
- * it should use 'shaka.util.IDestroyable'.
1168
- * @interface
1169
- */
1170
- shaka.util.IReleasable = class {
1171
- /**
1172
- * Request that this object release all internal references.
1173
- */
1174
- release() {}
1175
- };
1176
1185
  /**
1177
1186
  * @summary
1178
1187
  * An EventManager maintains a collection of "event
@@ -1524,8 +1533,12 @@ shaka.media.SegmentReference = class {
1524
1533
  * The value is a grid-item-dimension consisting of two positive decimal
1525
1534
  * integers in the format: column-x-row ('4x3'). It describes the
1526
1535
  * arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
1536
+ * @param {?number=} tileDuration
1537
+ * The explicit duration of an individual tile within the tiles grid.
1538
+ * If not provided, the duration should be automatically calculated based on
1539
+ * the duration of the reference.
1527
1540
  */
1528
- constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences, tilesLayout) {}
1541
+ constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences, tilesLayout, tileDuration) {}
1529
1542
  /**
1530
1543
  * Creates and returns the URIs of the resource containing the segment.
1531
1544
  * @return {!Array.<string>}
@@ -1559,6 +1572,12 @@ shaka.media.SegmentReference = class {
1559
1572
  * @return {?string}
1560
1573
  */
1561
1574
  getTilesLayout() {}
1575
+ /**
1576
+ * Returns the segment's explicit tile duration.
1577
+ * Only defined in image segments.
1578
+ * @return {?number}
1579
+ */
1580
+ getTileDuration() {}
1562
1581
  };
1563
1582
  /**
1564
1583
  * PresentationTimeline.
@@ -2748,6 +2767,7 @@ shaka.ads.ServerSideAd = class {
2748
2767
  /**
2749
2768
  * A class responsible for ad-related interactions.
2750
2769
  * @implements {shaka.extern.IAdManager}
2770
+ * @implements {shaka.util.IReleasable}
2751
2771
  */
2752
2772
  shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2753
2773
  /** */
@@ -2760,6 +2780,10 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2760
2780
  * @override
2761
2781
  */
2762
2782
  initClientSide(adContainer, video) {}
2783
+ /**
2784
+ * @override
2785
+ */
2786
+ release() {}
2763
2787
  /**
2764
2788
  * @override
2765
2789
  */
@@ -2783,6 +2807,11 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2783
2807
  * @override
2784
2808
  */
2785
2809
  replaceServerSideAdTagParameters(adTagParameters) {}
2810
+ /**
2811
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
2812
+ * @override
2813
+ */
2814
+ getServerSideCuePoints() {}
2786
2815
  /**
2787
2816
  * @return {shaka.extern.AdsStats}
2788
2817
  * @override
@@ -3398,6 +3427,189 @@ shaka.polyfill = class {
3398
3427
  */
3399
3428
  static register(polyfill, priority) {}
3400
3429
  };
3430
+ /**
3431
+ * @summary A polyfill to add support for the ARIAMixin interface mixin, for
3432
+ * browsers that do not implement it (e.g. Firefox).
3433
+ * Note that IE also does not support ARIAMixin, but this polyfill does not work
3434
+ * for that platform, as it relies on getters and setters.
3435
+ * @see https://w3c.github.io/aria/#ARIAMixin
3436
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element
3437
+ */
3438
+ shaka.polyfill.Aria = class {
3439
+ /**
3440
+ * Install the polyfill if needed.
3441
+ */
3442
+ static install() {}
3443
+ };
3444
+ /**
3445
+ * @summary A polyfill to add support for EncryptionScheme queries in EME.
3446
+ * @see https://wicg.github.io/encrypted-media-encryption-scheme/
3447
+ * @see https://github.com/w3c/encrypted-media/pull/457
3448
+ * @see https://github.com/google/eme-encryption-scheme-polyfill
3449
+ */
3450
+ shaka.polyfill.EncryptionScheme = class {
3451
+ /**
3452
+ * Install the polyfill if needed.
3453
+ * @suppress {missingRequire}
3454
+ */
3455
+ static install() {}
3456
+ };
3457
+ /**
3458
+ * @summary A polyfill to unify fullscreen APIs across browsers.
3459
+ * Many browsers have prefixed fullscreen methods on Element and document.
3460
+ * See {@link https://mzl.la/2K0xcHo Using fullscreen mode} on MDN for more
3461
+ * information.
3462
+ */
3463
+ shaka.polyfill.Fullscreen = class {
3464
+ /**
3465
+ * Install the polyfill if needed.
3466
+ */
3467
+ static install() {}
3468
+ };
3469
+ /**
3470
+ * @summary A polyfill to patch math round bug on some browsers.
3471
+ * @see https://stackoverflow.com/q/12830742
3472
+ */
3473
+ shaka.polyfill.MathRound = class {
3474
+ /**
3475
+ * Install the polyfill if needed.
3476
+ */
3477
+ static install() {}
3478
+ };
3479
+ /**
3480
+ * @summary A polyfill to provide navigator.mediaCapabilities on all browsers.
3481
+ * This is necessary for Tizen 3, Xbox One and possibly others we have yet to
3482
+ * discover.
3483
+ */
3484
+ shaka.polyfill.MediaCapabilities = class {
3485
+ /**
3486
+ * Install the polyfill if needed.
3487
+ * @suppress {const}
3488
+ */
3489
+ static install() {}
3490
+ };
3491
+ /**
3492
+ * A copy of the MediaCapabilities instance, to prevent Safari from
3493
+ * garbage-collecting the polyfilled method on it. We make it public and export
3494
+ * it to ensure that it is not stripped out by the compiler.
3495
+ * @type {MediaCapabilities}
3496
+ */
3497
+ shaka.polyfill.MediaCapabilities.originalMcap;
3498
+ /**
3499
+ * @summary A polyfill to patch MSE bugs.
3500
+ */
3501
+ shaka.polyfill.MediaSource = class {
3502
+ /**
3503
+ * Install the polyfill if needed.
3504
+ */
3505
+ static install() {}
3506
+ };
3507
+ /**
3508
+ * @summary A polyfill for systems that do not implement screen.orientation.
3509
+ * For now, this only handles systems that implement the deprecated
3510
+ * window.orientation feature... e.g. iPad.
3511
+ */
3512
+ shaka.polyfill.Orientation = class {
3513
+ /**
3514
+ * Install the polyfill if needed.
3515
+ */
3516
+ static install() {}
3517
+ };
3518
+ /**
3519
+ * @summary A polyfill to implement modern, standardized EME on top of Apple's
3520
+ * prefixed EME in Safari.
3521
+ */
3522
+ shaka.polyfill.PatchedMediaKeysApple = class {
3523
+ /**
3524
+ * Installs the polyfill if needed.
3525
+ */
3526
+ static install() {}
3527
+ };
3528
+ /**
3529
+ * @summary A polyfill to implement
3530
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015}
3531
+ * on top of ms-prefixed
3532
+ * {@link https://www.w3.org/TR/2014/WD-encrypted-media-20140218/ EME v20140218}
3533
+ */
3534
+ shaka.polyfill.PatchedMediaKeysMs = class {
3535
+ /**
3536
+ * Installs the polyfill if needed.
3537
+ */
3538
+ static install() {}
3539
+ };
3540
+ /**
3541
+ * @summary A polyfill to stub out
3542
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015} on browsers without
3543
+ * EME.
3544
+ * All methods will fail.
3545
+ */
3546
+ shaka.polyfill.PatchedMediaKeysNop = class {
3547
+ /**
3548
+ * Installs the polyfill if needed.
3549
+ */
3550
+ static install() {}
3551
+ };
3552
+ /**
3553
+ * @summary A polyfill to implement
3554
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015} on top of
3555
+ * webkit-prefixed {@link https://bit.ly/Eme01b EME v0.1b}.
3556
+ */
3557
+ shaka.polyfill.PatchedMediaKeysWebkit = class {
3558
+ /**
3559
+ * Installs the polyfill if needed.
3560
+ */
3561
+ static install() {}
3562
+ };
3563
+ /**
3564
+ * @summary A polyfill to provide PiP support in Safari.
3565
+ * Note that Safari only supports PiP on video elements, not audio.
3566
+ */
3567
+ shaka.polyfill.PiPWebkit = class {
3568
+ /**
3569
+ * Install the polyfill if needed.
3570
+ */
3571
+ static install() {}
3572
+ };
3573
+ /**
3574
+ * @summary A polyfill to provide navigator.storage.estimate in old
3575
+ * webkit browsers.
3576
+ * See: https://developers.google.com/web/updates/2017/08/estimating-available-storage-space#the-present
3577
+ */
3578
+ shaka.polyfill.StorageEstimate = class {
3579
+ /**
3580
+ * Install the polyfill if needed.
3581
+ */
3582
+ static install() {}
3583
+ };
3584
+ /**
3585
+ * @summary A polyfill to silence the play() Promise in HTML5 video.
3586
+ */
3587
+ shaka.polyfill.VideoPlayPromise = class {
3588
+ /**
3589
+ * Install the polyfill if needed.
3590
+ */
3591
+ static install() {}
3592
+ };
3593
+ /**
3594
+ * @summary A polyfill to provide MSE VideoPlaybackQuality metrics.
3595
+ * Many browsers do not yet provide this API, and Chrome currently provides
3596
+ * similar data through individual prefixed attributes on HTMLVideoElement.
3597
+ */
3598
+ shaka.polyfill.VideoPlaybackQuality = class {
3599
+ /**
3600
+ * Install the polyfill if needed.
3601
+ */
3602
+ static install() {}
3603
+ };
3604
+ /**
3605
+ * @summary A polyfill to provide VTTCue.
3606
+ */
3607
+ shaka.polyfill.VTTCue = class {
3608
+ /**
3609
+ * Install the polyfill if needed.
3610
+ */
3611
+ static install() {}
3612
+ };
3401
3613
  /**
3402
3614
  * LRC file format: https://en.wikipedia.org/wiki/LRC_(file_format)
3403
3615
  * @implements {shaka.extern.TextParser}