shaka-player 4.10.13 → 4.11.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 (91) hide show
  1. package/README.md +5 -1
  2. package/dist/controls.css +3 -3
  3. package/dist/controls.css.map +1 -1
  4. package/dist/deps.js +11 -11
  5. package/dist/locales.js +38 -34
  6. package/dist/shaka-player.compiled.d.ts +68 -33
  7. package/dist/shaka-player.compiled.debug.d.ts +68 -33
  8. package/dist/shaka-player.compiled.debug.externs.js +584 -544
  9. package/dist/shaka-player.compiled.debug.js +715 -676
  10. package/dist/shaka-player.compiled.debug.map +4 -4
  11. package/dist/shaka-player.compiled.externs.js +584 -544
  12. package/dist/shaka-player.compiled.js +1394 -1371
  13. package/dist/shaka-player.compiled.map +4 -4
  14. package/dist/shaka-player.ui.d.ts +76 -34
  15. package/dist/shaka-player.ui.debug.d.ts +76 -34
  16. package/dist/shaka-player.ui.debug.externs.js +77 -26
  17. package/dist/shaka-player.ui.debug.js +774 -720
  18. package/dist/shaka-player.ui.debug.map +4 -4
  19. package/dist/shaka-player.ui.externs.js +77 -26
  20. package/dist/shaka-player.ui.js +1649 -1617
  21. package/dist/shaka-player.ui.map +4 -4
  22. package/externs/mediasession.js +10 -1
  23. package/externs/shaka/ads.js +79 -2
  24. package/externs/shaka/manifest.js +6 -1
  25. package/externs/shaka/manifest_parser.js +6 -2
  26. package/externs/shaka/net.js +23 -2
  27. package/externs/shaka/player.js +414 -103
  28. package/externs/shaka/text.js +2 -1
  29. package/lib/abr/simple_abr_manager.js +5 -0
  30. package/lib/ads/ad_manager.js +45 -1
  31. package/lib/ads/ad_utils.js +124 -1
  32. package/lib/ads/interstitial_ad.js +9 -2
  33. package/lib/ads/interstitial_ad_manager.js +216 -101
  34. package/lib/ads/media_tailor_ad.js +1 -39
  35. package/lib/ads/media_tailor_ad_manager.js +32 -16
  36. package/lib/cea/cea608_data_channel.js +40 -8
  37. package/lib/cea/cea608_memory.js +28 -0
  38. package/lib/dash/dash_parser.js +162 -25
  39. package/lib/dash/segment_base.js +3 -2
  40. package/lib/dash/segment_list.js +6 -3
  41. package/lib/dash/segment_template.js +104 -20
  42. package/lib/hls/hls_parser.js +319 -215
  43. package/lib/media/drm_engine.js +11 -3
  44. package/lib/media/media_source_engine.js +0 -8
  45. package/lib/media/preload_manager.js +16 -4
  46. package/lib/media/segment_reference.js +3 -0
  47. package/lib/media/segment_utils.js +8 -1
  48. package/lib/media/streaming_engine.js +10 -6
  49. package/lib/mss/mss_parser.js +14 -2
  50. package/lib/net/http_fetch_plugin.js +12 -5
  51. package/lib/net/http_xhr_plugin.js +7 -3
  52. package/lib/net/networking_engine.js +21 -1
  53. package/lib/offline/manifest_converter.js +1 -0
  54. package/lib/offline/storage.js +1 -0
  55. package/lib/player.js +336 -121
  56. package/lib/text/cue.js +373 -0
  57. package/lib/text/mp4_ttml_parser.js +51 -1
  58. package/lib/text/mp4_vtt_parser.js +2 -5
  59. package/lib/text/sbv_text_parser.js +2 -31
  60. package/lib/text/srt_text_parser.js +1 -1
  61. package/lib/text/text_engine.js +1 -1
  62. package/lib/text/text_utils.js +1 -0
  63. package/lib/text/ttml_text_parser.js +14 -4
  64. package/lib/text/ui_text_displayer.js +0 -4
  65. package/lib/text/vtt_text_parser.js +10 -415
  66. package/lib/util/abortable_operation.js +8 -0
  67. package/lib/util/cmcd_manager.js +38 -0
  68. package/lib/util/error.js +16 -0
  69. package/lib/util/fake_event.js +1 -0
  70. package/lib/util/manifest_parser_utils.js +12 -3
  71. package/lib/util/player_configuration.js +4 -2
  72. package/lib/util/stream_utils.js +57 -2
  73. package/lib/util/tXml.js +2 -1
  74. package/lib/util/text_parser.js +46 -0
  75. package/lib/util/ts_parser.js +32 -3
  76. package/package.json +1 -1
  77. package/shaka-player.uncompiled.js +1 -1
  78. package/ui/chapter_selection.js +179 -0
  79. package/ui/controls.js +151 -0
  80. package/ui/enums.js +1 -0
  81. package/ui/externs/ui.js +7 -1
  82. package/ui/less/containers.less +3 -4
  83. package/ui/less/overflow_menu.less +5 -0
  84. package/ui/less/tooltip.less +1 -1
  85. package/ui/locales/en.json +1 -0
  86. package/ui/locales/es.json +1 -0
  87. package/ui/locales/fr.json +1 -0
  88. package/ui/locales/source.json +4 -0
  89. package/ui/seek_bar.js +3 -2
  90. package/ui/ui.js +2 -0
  91. package/lib/polyfill/abort_controller.js +0 -158
@@ -118,6 +118,11 @@
118
118
  /* TODO(b/116651454): eliminate hard-coded offsets */
119
119
  margin-left: 54px;
120
120
  }
121
+
122
+ .shaka-chapter {
123
+ /* TODO(b/116651454): eliminate hard-coded offsets */
124
+ margin-left: 10px;
125
+ }
121
126
  }
122
127
 
123
128
  /* This is a button within each submenu that takes you back to the main overflow
@@ -47,7 +47,7 @@
47
47
  content: attr(aria-label);
48
48
 
49
49
  /* Override .material-icons-round text styling */
50
- font-family: Roboto-Regular, Roboto, sans-serif;
50
+ font-family: Roboto, sans-serif;
51
51
  line-height: calc(@material-icons-width / 2);
52
52
  white-space: nowrap;
53
53
  font-size: 13px;
@@ -8,6 +8,7 @@
8
8
  "BACK": "Back",
9
9
  "CAPTIONS": "Captions",
10
10
  "CAST": "Cast...",
11
+ "CHAPTERS": "Chapters",
11
12
  "DOWNLOAD_VIDEO_FRAME": "Save video frame",
12
13
  "ENTER_LOOP_MODE": "Loop the current video",
13
14
  "ENTER_PICTURE_IN_PICTURE": "Enter Picture-in-Picture",
@@ -8,6 +8,7 @@
8
8
  "BACK": "Atrás",
9
9
  "CAPTIONS": "Subtítulos",
10
10
  "CAST": "Enviar...",
11
+ "CHAPTERS": "Capítulos",
11
12
  "DOWNLOAD_VIDEO_FRAME": "Guardar fotograma",
12
13
  "ENTER_LOOP_MODE": "Reproducir en bucle el vídeo actual",
13
14
  "ENTER_PICTURE_IN_PICTURE": "Activar el modo imagen en imagen",
@@ -8,6 +8,7 @@
8
8
  "BACK": "Retour",
9
9
  "CAPTIONS": "Sous-titres",
10
10
  "CAST": "Caster…",
11
+ "CHAPTERS": "Chapitres",
11
12
  "DOWNLOAD_VIDEO_FRAME": "Enregistrer l'image vidéo",
12
13
  "ENTER_LOOP_MODE": "Lire en boucle la vidéo en cours",
13
14
  "ENTER_PICTURE_IN_PICTURE": "Utiliser le mode Picture-in-Picture",
@@ -37,6 +37,10 @@
37
37
  "description": "Label for a button used to open the native Cast dialog in the browser and select a destination to Cast to.",
38
38
  "message": "Cast..."
39
39
  },
40
+ "CHAPTERS": {
41
+ "description": "Label for a button used to open a submenu to choose a chapter.",
42
+ "message": "Chapters"
43
+ },
40
44
  "DOWNLOAD_VIDEO_FRAME": {
41
45
  "description": "Label for a button used to download the current video frame.",
42
46
  "message": "Save video frame"
package/ui/seek_bar.js CHANGED
@@ -514,8 +514,8 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
514
514
  Math.max(0, pixelPosition - (width / 2)));
515
515
  this.timeContainer_.style.left = leftPosition + 'px';
516
516
  this.timeContainer_.style.visibility = 'visible';
517
+ const seekRange = this.player.seekRange();
517
518
  if (this.player.isLive()) {
518
- const seekRange = this.player.seekRange();
519
519
  const totalSeconds = seekRange.end - value;
520
520
  if (totalSeconds < 1) {
521
521
  this.timeContainer_.textContent =
@@ -525,7 +525,8 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
525
525
  '-' + this.timeFormatter_(totalSeconds);
526
526
  }
527
527
  } else {
528
- this.timeContainer_.textContent = this.timeFormatter_(value);
528
+ const totalSeconds = value - seekRange.start;
529
+ this.timeContainer_.textContent = this.timeFormatter_(totalSeconds);
529
530
  }
530
531
  }
531
532
 
package/ui/ui.js CHANGED
@@ -187,6 +187,7 @@ shaka.ui.Overlay = class {
187
187
  'captions',
188
188
  'quality',
189
189
  'language',
190
+ 'chapter',
190
191
  'picture_in_picture',
191
192
  'cast',
192
193
  'playback_rate',
@@ -272,6 +273,7 @@ shaka.ui.Overlay = class {
272
273
  refreshTickInSeconds: 0.125,
273
274
  displayInVrMode: false,
274
275
  defaultVrProjectionMode: 'equirectangular',
276
+ setupMediaSession: true,
275
277
  };
276
278
 
277
279
  // eslint-disable-next-line no-restricted-syntax
@@ -1,158 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- goog.provide('shaka.polyfill.AbortController');
8
-
9
- goog.require('shaka.polyfill');
10
- goog.require('shaka.util.FakeEvent');
11
- goog.require('shaka.util.FakeEventTarget');
12
-
13
- /**
14
- * @summary A polyfill for systems that do not implement AbortController.
15
- * This is used both with the fetch API for HTTP requests and inside the HLS
16
- * parser.
17
- * @export
18
- * @extends AbortController
19
- */
20
- shaka.polyfill.AbortController = class {
21
- /**
22
- * Install the polyfill if needed.
23
- * @export
24
- */
25
- static install() {
26
- if (window.AbortController) {
27
- // Not needed.
28
- return;
29
- }
30
-
31
- window.AbortController = shaka.polyfill.AbortController;
32
- window.AbortSignal = shaka.polyfill.AbortController.AbortSignal;
33
- }
34
-
35
- /** */
36
- constructor() {
37
- /** @private {!shaka.polyfill.AbortController.AbortSignal} */
38
- this.signal_ = new shaka.polyfill.AbortController.AbortSignal();
39
- }
40
-
41
- /**
42
- * @override
43
- * @suppress {const|duplicate} Since the original is defined as "const", we
44
- * need this suppression to override it.
45
- */
46
- get signal() {
47
- return this.signal_;
48
- }
49
-
50
- /**
51
- * @param {*=} reason
52
- * @override
53
- */
54
- abort(reason) {
55
- this.signal_.doAbort_(reason);
56
- }
57
- };
58
-
59
- /**
60
- * @summary A polyfill for AbortSignal, part of the AbortController API.
61
- * @extends AbortSignal
62
- */
63
- shaka.polyfill.AbortController.AbortSignal = class {
64
- /** */
65
- constructor() {
66
- /** @private {boolean} */
67
- this.aborted_ = false;
68
-
69
- /** @private {*} */
70
- this.reason_ = undefined;
71
-
72
- /** @type {?function(!Event)} */
73
- this.onabort = null;
74
-
75
- /** @private {!shaka.util.FakeEventTarget} */
76
- this.eventTarget_ = new shaka.util.FakeEventTarget();
77
- }
78
-
79
- /** @override */
80
- addEventListener(type, listener, options) {
81
- return this.eventTarget_.addEventListener(type, listener, options);
82
- }
83
-
84
- /** @override */
85
- removeEventListener(type, listener, options) {
86
- return this.eventTarget_.removeEventListener(type, listener, options);
87
- }
88
-
89
- /** @override */
90
- dispatchEvent(event) {
91
- return this.eventTarget_.dispatchEvent(event);
92
- }
93
-
94
- /** @override */
95
- get aborted() {
96
- return this.aborted_;
97
- }
98
-
99
- /** @override */
100
- get reason() {
101
- return this.reason_;
102
- }
103
-
104
- /** @override */
105
- throwIfAborted() {
106
- if (this.aborted_) {
107
- throw this.reason_;
108
- }
109
- }
110
-
111
- /**
112
- * @param {*} reason
113
- * @private
114
- */
115
- doAbort_(reason) {
116
- if (this.aborted_) {
117
- return;
118
- }
119
-
120
- this.aborted_ = true;
121
- this.reason_ = reason;
122
- if (this.reason_ === undefined) {
123
- // This is equivalent to a native implementation.
124
- this.reason_ = new DOMException(
125
- 'signal is aborted without reason', 'AbortError');
126
- }
127
-
128
- // According to MDN:
129
- // "Event type - A generic Event with no added properties."
130
- const event = new shaka.util.FakeEvent('abort');
131
- if (this.onabort) {
132
- this.onabort(event);
133
- }
134
- this.dispatchEvent(event);
135
- }
136
-
137
- /** @override */
138
- static abort(reason) {
139
- const signal = new shaka.polyfill.AbortController.AbortSignal();
140
- signal.doAbort_(reason);
141
- return signal;
142
- }
143
-
144
- /** @override */
145
- static timeout(timeMs) {
146
- const signal = new shaka.polyfill.AbortController.AbortSignal();
147
-
148
- window.setTimeout(() => {
149
- // This is equivalent to a native implementation.
150
- signal.doAbort_(new DOMException('signal timed out', 'TimeoutError'));
151
- }, timeMs);
152
-
153
- return signal;
154
- }
155
- };
156
-
157
-
158
- shaka.polyfill.register(shaka.polyfill.AbortController.install);