shaka-player 3.1.2 → 3.1.6

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 (145) 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 +170 -1
  5. package/CONTRIBUTORS +3 -0
  6. package/build/checkversion.py +1 -1
  7. package/build/generateExterns.js +1 -1
  8. package/build/misspellings.txt +1 -0
  9. package/build/shakaBuildHelpers.py +6 -5
  10. package/build/subprocessWindowsPatch.py +103 -0
  11. package/build/test.py +6 -0
  12. package/demo/common/assets.js +1 -1
  13. package/dist/controls.css +2 -2
  14. package/dist/controls.css.map +1 -1
  15. package/dist/demo.compiled.debug.js +1 -1
  16. package/dist/demo.compiled.js +1 -1
  17. package/dist/deps.js +7 -7
  18. package/dist/locales.js +35 -35
  19. package/dist/receiver.compiled.debug.js +1 -1
  20. package/dist/receiver.compiled.js +1 -1
  21. package/dist/shaka-player.compiled.d.ts +172 -3
  22. package/dist/shaka-player.compiled.debug.d.ts +172 -3
  23. package/dist/shaka-player.compiled.debug.externs.js +184 -1
  24. package/dist/shaka-player.compiled.debug.js +390 -370
  25. package/dist/shaka-player.compiled.debug.map +3 -3
  26. package/dist/shaka-player.compiled.externs.js +184 -1
  27. package/dist/shaka-player.compiled.js +809 -805
  28. package/dist/shaka-player.compiled.map +3 -3
  29. package/dist/shaka-player.ui.d.ts +174 -14
  30. package/dist/shaka-player.ui.debug.d.ts +174 -14
  31. package/dist/shaka-player.ui.debug.externs.js +200 -26
  32. package/dist/shaka-player.ui.debug.js +431 -412
  33. package/dist/shaka-player.ui.debug.map +4 -4
  34. package/dist/shaka-player.ui.externs.js +200 -26
  35. package/dist/shaka-player.ui.js +934 -929
  36. package/dist/shaka-player.ui.map +4 -4
  37. package/docs/tutorials/fairplay.md +1 -1
  38. package/docs/tutorials/faq.md +14 -0
  39. package/externs/ima.js +4 -0
  40. package/externs/shaka/ads.js +2 -0
  41. package/externs/shaka/text.js +10 -0
  42. package/karma.conf.js +20 -15
  43. package/lib/ads/ad_manager.js +30 -11
  44. package/lib/ads/client_side_ad_manager.js +76 -86
  45. package/lib/ads/server_side_ad_manager.js +26 -11
  46. package/lib/cast/cast_proxy.js +6 -2
  47. package/lib/cast/cast_receiver.js +5 -1
  48. package/lib/cast/cast_sender.js +2 -2
  49. package/lib/cea/sei_processor.js +24 -17
  50. package/lib/dash/dash_parser.js +131 -24
  51. package/lib/dash/segment_list.js +1 -1
  52. package/lib/dash/segment_template.js +1 -1
  53. package/lib/hls/hls_parser.js +44 -17
  54. package/lib/hls/manifest_text_parser.js +1 -0
  55. package/lib/media/closed_caption_parser.js +3 -1
  56. package/lib/media/content_workarounds.js +12 -0
  57. package/lib/media/drm_engine.js +20 -1
  58. package/lib/media/gap_jumping_controller.js +8 -4
  59. package/lib/media/media_source_engine.js +1 -2
  60. package/lib/media/playhead.js +1 -1
  61. package/lib/media/region_observer.js +39 -33
  62. package/lib/media/region_timeline.js +17 -19
  63. package/lib/media/streaming_engine.js +8 -4
  64. package/lib/net/networking_engine.js +6 -1
  65. package/lib/offline/storage.js +10 -11
  66. package/lib/player.js +66 -30
  67. package/lib/polyfill/encryption_scheme.js +2 -0
  68. package/lib/polyfill/fullscreen.js +2 -0
  69. package/lib/polyfill/mathround.js +2 -0
  70. package/lib/polyfill/media_capabilities.js +73 -21
  71. package/lib/polyfill/mediasource.js +8 -0
  72. package/lib/polyfill/orientation.js +3 -1
  73. package/lib/polyfill/patchedmediakeys_apple.js +6 -4
  74. package/lib/polyfill/patchedmediakeys_ms.js +6 -4
  75. package/lib/polyfill/patchedmediakeys_nop.js +2 -0
  76. package/lib/polyfill/patchedmediakeys_webkit.js +6 -4
  77. package/lib/polyfill/pip_webkit.js +2 -0
  78. package/lib/polyfill/storage_estimate.js +2 -0
  79. package/lib/polyfill/video_play_promise.js +2 -0
  80. package/lib/polyfill/videoplaybackquality.js +2 -0
  81. package/lib/polyfill/vttcue.js +2 -0
  82. package/lib/text/cue.js +6 -0
  83. package/lib/text/mp4_ttml_parser.js +3 -0
  84. package/lib/text/text_engine.js +14 -2
  85. package/lib/text/ttml_text_parser.js +135 -87
  86. package/lib/text/ui_text_displayer.js +213 -80
  87. package/lib/text/vtt_text_parser.js +4 -2
  88. package/lib/util/fake_event.js +53 -7
  89. package/lib/util/fake_event_target.js +21 -1
  90. package/lib/util/mp4_box_parsers.js +1 -1
  91. package/lib/util/periods.js +4 -1
  92. package/lib/util/platform.js +13 -1
  93. package/lib/util/stream_utils.js +77 -10
  94. package/lib/util/xml_utils.js +19 -0
  95. package/package.json +3 -6
  96. package/test/cast/cast_proxy_unit.js +12 -6
  97. package/test/cast/cast_receiver_integration.js +1 -1
  98. package/test/cast/cast_utils_unit.js +1 -1
  99. package/test/cea/mp4_cea_parser_unit.js +26 -0
  100. package/test/dash/dash_parser_live_unit.js +43 -0
  101. package/test/dash/dash_parser_manifest_unit.js +222 -3
  102. package/test/hls/hls_parser_unit.js +79 -1
  103. package/test/media/closed_caption_parser_unit.js +20 -0
  104. package/test/media/drm_engine_unit.js +56 -0
  105. package/test/media/playhead_unit.js +27 -1
  106. package/test/media/region_observer_unit.js +40 -5
  107. package/test/media/region_timeline_unit.js +40 -22
  108. package/test/media/streaming_engine_integration.js +2 -1
  109. package/test/media/streaming_engine_unit.js +145 -0
  110. package/test/player_integration.js +38 -0
  111. package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
  112. package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
  113. package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
  114. package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
  115. package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
  116. package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
  117. package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
  118. package/test/test/assets/3675/dash_0.mpd +30 -0
  119. package/test/test/assets/3675/dash_1.mpd +30 -0
  120. package/test/test/assets/3675/dash_2.mpd +30 -0
  121. package/test/test/assets/3675/dash_3.mpd +30 -0
  122. package/test/test/assets/3675/dash_4.mpd +30 -0
  123. package/test/test/assets/3675/dash_5.mpd +26 -0
  124. package/test/test/assets/3675/init-stream0.m4s +0 -0
  125. package/test/test/assets/empty_caption_video_init.mp4 +0 -0
  126. package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
  127. package/test/test/util/fake_ad_manager.js +4 -1
  128. package/test/test/util/ttml_utils.js +81 -0
  129. package/test/test/util/util.js +10 -7
  130. package/test/text/mp4_ttml_parser_unit.js +11 -18
  131. package/test/text/ttml_text_parser_unit.js +542 -220
  132. package/test/text/ui_text_displayer_unit.js +93 -20
  133. package/test/text/vtt_text_parser_unit.js +17 -1
  134. package/test/ui/localization_unit.js +15 -14
  135. package/test/ui/text_displayer_layout_unit.js +21 -8
  136. package/test/util/mp4_box_parsers_unit.js +28 -0
  137. package/test/util/stream_utils_unit.js +59 -2
  138. package/ui/cast_button.js +2 -3
  139. package/ui/controls.js +11 -6
  140. package/ui/less/buttons.less +0 -4
  141. package/ui/less/containers.less +6 -7
  142. package/ui/locales/ru.json +6 -6
  143. package/ui/localization.js +40 -87
  144. package/ui/pip_button.js +2 -3
  145. package/ui/text_selection.js +1 -0
@@ -32,9 +32,9 @@ shaka.offline = {};
32
32
  /** @const */
33
33
  shaka.text = {};
34
34
  /** @const */
35
- shaka.util = {};
36
- /** @const */
37
35
  shaka.ui = {};
36
+ /** @const */
37
+ shaka.util = {};
38
38
 
39
39
  /**
40
40
  * @summary Create an Event work-alike object based on the provided dictionary.
@@ -44,15 +44,28 @@ shaka.ui = {};
44
44
  shaka.util.FakeEvent = class {
45
45
  /**
46
46
  * @param {string} type
47
- * @param {Object=} dict
47
+ * @param {Map.<string, Object>=} dict
48
48
  */
49
49
  constructor(type, dict) {}
50
50
  };
51
+ /**
52
+ * An interface to standardize how objects release internal references
53
+ * synchronously. If an object needs to asynchronously release references, then
54
+ * it should use 'shaka.util.IDestroyable'.
55
+ * @interface
56
+ */
57
+ shaka.util.IReleasable = class {
58
+ /**
59
+ * Request that this object release all internal references.
60
+ */
61
+ release() {}
62
+ };
51
63
  /**
52
64
  * @summary A work-alike for EventTarget. Only DOM elements may be true
53
65
  * EventTargets, but this can be used as a base class to provide event dispatch
54
66
  * to non-DOM classes. Only FakeEvents should be dispatched.
55
67
  * @implements {EventTarget}
68
+ * @implements {shaka.util.IReleasable}
56
69
  */
57
70
  shaka.util.FakeEventTarget = class {
58
71
  /** */
@@ -90,6 +103,10 @@ shaka.util.FakeEventTarget = class {
90
103
  * @override
91
104
  */
92
105
  dispatchEvent(event) {}
106
+ /**
107
+ * @override
108
+ */
109
+ release() {}
93
110
  };
94
111
  /**
95
112
  * These are the listener types defined in the closure extern for EventTarget.
@@ -298,10 +315,9 @@ shaka.util.Error.Code = {
298
315
  * strings that are expected to be displayed to the user.
299
316
  * If a string is not available, it will return the localized
300
317
  * form in the closest related locale.
301
- * @implements {EventTarget}
302
318
  * @final
303
319
  */
304
- shaka.ui.Localization = class {
320
+ shaka.ui.Localization = class extends shaka.util.FakeEventTarget {
305
321
  /**
306
322
  * @param {string} fallbackLocale
307
323
  * The fallback locale that should be used. It will be assumed that this
@@ -311,15 +327,7 @@ shaka.ui.Localization = class {
311
327
  /**
312
328
  * @override
313
329
  */
314
- addEventListener(type, listener, options) {}
315
- /**
316
- * @override
317
- */
318
- removeEventListener(type, listener, options) {}
319
- /**
320
- * @override
321
- */
322
- dispatchEvent(event) {}
330
+ release() {}
323
331
  /**
324
332
  * Request the localization system to change which locale it serves. If any of
325
333
  * of the preferred locales cannot be found, the localization system will fire
@@ -891,6 +899,10 @@ shaka.text.Cue.prototype.id;
891
899
  * @override
892
900
  */
893
901
  shaka.text.Cue.prototype.nestedCues;
902
+ /**
903
+ * @override
904
+ */
905
+ shaka.text.Cue.prototype.isContainer;
894
906
  /**
895
907
  * @override
896
908
  */
@@ -1146,18 +1158,6 @@ shaka.text.TextEngine = class {
1146
1158
  */
1147
1159
  destroy() {}
1148
1160
  };
1149
- /**
1150
- * An interface to standardize how objects release internal references
1151
- * synchronously. If an object needs to asynchronously release references, then
1152
- * it should use 'shaka.util.IDestroyable'.
1153
- * @interface
1154
- */
1155
- shaka.util.IReleasable = class {
1156
- /**
1157
- * Request that this object release all internal references.
1158
- */
1159
- release() {}
1160
- };
1161
1161
  /**
1162
1162
  * @summary
1163
1163
  * An EventManager maintains a collection of "event
@@ -2823,6 +2823,7 @@ shaka.ads.ServerSideAd = class {
2823
2823
  /**
2824
2824
  * A class responsible for ad-related interactions.
2825
2825
  * @implements {shaka.extern.IAdManager}
2826
+ * @implements {shaka.util.IReleasable}
2826
2827
  */
2827
2828
  shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2828
2829
  /** */
@@ -2835,6 +2836,10 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2835
2836
  * @override
2836
2837
  */
2837
2838
  initClientSide(adContainer, video) {}
2839
+ /**
2840
+ * @override
2841
+ */
2842
+ release() {}
2838
2843
  /**
2839
2844
  * @override
2840
2845
  */
@@ -3473,6 +3478,175 @@ shaka.polyfill = class {
3473
3478
  */
3474
3479
  static register(polyfill, priority) {}
3475
3480
  };
3481
+ /**
3482
+ * @summary A polyfill to add support for EncryptionScheme queries in EME.
3483
+ * @see https://wicg.github.io/encrypted-media-encryption-scheme/
3484
+ * @see https://github.com/w3c/encrypted-media/pull/457
3485
+ * @see https://github.com/google/eme-encryption-scheme-polyfill
3486
+ */
3487
+ shaka.polyfill.EncryptionScheme = class {
3488
+ /**
3489
+ * Install the polyfill if needed.
3490
+ * @suppress {missingRequire}
3491
+ */
3492
+ static install() {}
3493
+ };
3494
+ /**
3495
+ * @summary A polyfill to unify fullscreen APIs across browsers.
3496
+ * Many browsers have prefixed fullscreen methods on Element and document.
3497
+ * See {@link https://mzl.la/2K0xcHo Using fullscreen mode} on MDN for more
3498
+ * information.
3499
+ */
3500
+ shaka.polyfill.Fullscreen = class {
3501
+ /**
3502
+ * Install the polyfill if needed.
3503
+ */
3504
+ static install() {}
3505
+ };
3506
+ /**
3507
+ * @summary A polyfill to patch math round bug on some browsers.
3508
+ * @see https://stackoverflow.com/q/12830742
3509
+ */
3510
+ shaka.polyfill.MathRound = class {
3511
+ /**
3512
+ * Install the polyfill if needed.
3513
+ */
3514
+ static install() {}
3515
+ };
3516
+ /**
3517
+ * @summary A polyfill to provide navigator.mediaCapabilities on all browsers.
3518
+ * This is necessary for Tizen 3, Xbox One and possibly others we have yet to
3519
+ * discover.
3520
+ */
3521
+ shaka.polyfill.MediaCapabilities = class {
3522
+ /**
3523
+ * Install the polyfill if needed.
3524
+ * @suppress {const}
3525
+ */
3526
+ static install() {}
3527
+ };
3528
+ /**
3529
+ * A copy of the MediaCapabilities instance, to prevent Safari from
3530
+ * garbage-collecting the polyfilled method on it. We make it public and export
3531
+ * it to ensure that it is not stripped out by the compiler.
3532
+ * @type {MediaCapabilities}
3533
+ */
3534
+ shaka.polyfill.MediaCapabilities.originalMcap;
3535
+ /**
3536
+ * @summary A polyfill to patch MSE bugs.
3537
+ */
3538
+ shaka.polyfill.MediaSource = class {
3539
+ /**
3540
+ * Install the polyfill if needed.
3541
+ */
3542
+ static install() {}
3543
+ };
3544
+ /**
3545
+ * @summary A polyfill for systems that do not implement screen.orientation.
3546
+ * For now, this only handles systems that implement the deprecated
3547
+ * window.orientation feature... e.g. iPad.
3548
+ */
3549
+ shaka.polyfill.Orientation = class {
3550
+ /**
3551
+ * Install the polyfill if needed.
3552
+ */
3553
+ static install() {}
3554
+ };
3555
+ /**
3556
+ * @summary A polyfill to implement modern, standardized EME on top of Apple's
3557
+ * prefixed EME in Safari.
3558
+ */
3559
+ shaka.polyfill.PatchedMediaKeysApple = class {
3560
+ /**
3561
+ * Installs the polyfill if needed.
3562
+ */
3563
+ static install() {}
3564
+ };
3565
+ /**
3566
+ * @summary A polyfill to implement
3567
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015}
3568
+ * on top of ms-prefixed
3569
+ * {@link https://www.w3.org/TR/2014/WD-encrypted-media-20140218/ EME v20140218}
3570
+ */
3571
+ shaka.polyfill.PatchedMediaKeysMs = class {
3572
+ /**
3573
+ * Installs the polyfill if needed.
3574
+ */
3575
+ static install() {}
3576
+ };
3577
+ /**
3578
+ * @summary A polyfill to stub out
3579
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015} on browsers without
3580
+ * EME.
3581
+ * All methods will fail.
3582
+ */
3583
+ shaka.polyfill.PatchedMediaKeysNop = class {
3584
+ /**
3585
+ * Installs the polyfill if needed.
3586
+ */
3587
+ static install() {}
3588
+ };
3589
+ /**
3590
+ * @summary A polyfill to implement
3591
+ * {@link https://bit.ly/EmeMar15 EME draft 12 March 2015} on top of
3592
+ * webkit-prefixed {@link https://bit.ly/Eme01b EME v0.1b}.
3593
+ */
3594
+ shaka.polyfill.PatchedMediaKeysWebkit = class {
3595
+ /**
3596
+ * Installs the polyfill if needed.
3597
+ */
3598
+ static install() {}
3599
+ };
3600
+ /**
3601
+ * @summary A polyfill to provide PiP support in Safari.
3602
+ * Note that Safari only supports PiP on video elements, not audio.
3603
+ */
3604
+ shaka.polyfill.PiPWebkit = class {
3605
+ /**
3606
+ * Install the polyfill if needed.
3607
+ */
3608
+ static install() {}
3609
+ };
3610
+ /**
3611
+ * @summary A polyfill to provide navigator.storage.estimate in old
3612
+ * webkit browsers.
3613
+ * See: https://developers.google.com/web/updates/2017/08/estimating-available-storage-space#the-present
3614
+ */
3615
+ shaka.polyfill.StorageEstimate = class {
3616
+ /**
3617
+ * Install the polyfill if needed.
3618
+ */
3619
+ static install() {}
3620
+ };
3621
+ /**
3622
+ * @summary A polyfill to silence the play() Promise in HTML5 video.
3623
+ */
3624
+ shaka.polyfill.VideoPlayPromise = class {
3625
+ /**
3626
+ * Install the polyfill if needed.
3627
+ */
3628
+ static install() {}
3629
+ };
3630
+ /**
3631
+ * @summary A polyfill to provide MSE VideoPlaybackQuality metrics.
3632
+ * Many browsers do not yet provide this API, and Chrome currently provides
3633
+ * similar data through individual prefixed attributes on HTMLVideoElement.
3634
+ */
3635
+ shaka.polyfill.VideoPlaybackQuality = class {
3636
+ /**
3637
+ * Install the polyfill if needed.
3638
+ */
3639
+ static install() {}
3640
+ };
3641
+ /**
3642
+ * @summary A polyfill to provide VTTCue.
3643
+ */
3644
+ shaka.polyfill.VTTCue = class {
3645
+ /**
3646
+ * Install the polyfill if needed.
3647
+ */
3648
+ static install() {}
3649
+ };
3476
3650
  /**
3477
3651
  * LRC file format: https://en.wikipedia.org/wiki/LRC_(file_format)
3478
3652
  * @implements {shaka.extern.TextParser}