shaka-player 4.7.12 → 4.8.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 (120) hide show
  1. package/AUTHORS +1 -0
  2. package/CONTRIBUTORS +1 -0
  3. package/LICENSE +54 -0
  4. package/README.md +22 -1
  5. package/dist/controls.css +1 -1
  6. package/dist/controls.css.map +1 -1
  7. package/dist/deps.js +36 -25
  8. package/dist/locales.js +40 -30
  9. package/dist/shaka-player.compiled.d.ts +196 -46
  10. package/dist/shaka-player.compiled.debug.d.ts +196 -46
  11. package/dist/shaka-player.compiled.debug.externs.js +474 -337
  12. package/dist/shaka-player.compiled.debug.js +992 -871
  13. package/dist/shaka-player.compiled.debug.map +4 -4
  14. package/dist/shaka-player.compiled.externs.js +474 -337
  15. package/dist/shaka-player.compiled.js +1248 -1174
  16. package/dist/shaka-player.compiled.map +4 -4
  17. package/dist/shaka-player.ui.d.ts +259 -49
  18. package/dist/shaka-player.ui.debug.d.ts +259 -49
  19. package/dist/shaka-player.ui.debug.externs.js +591 -376
  20. package/dist/shaka-player.ui.debug.js +1208 -1003
  21. package/dist/shaka-player.ui.debug.map +4 -4
  22. package/dist/shaka-player.ui.externs.js +591 -376
  23. package/dist/shaka-player.ui.js +1533 -1408
  24. package/dist/shaka-player.ui.map +4 -4
  25. package/externs/device_sensor_event.js +18 -0
  26. package/externs/hisense.js +16 -0
  27. package/externs/playstation.js +31 -0
  28. package/externs/shaka/abr_manager.js +3 -1
  29. package/externs/shaka/ads.js +5 -0
  30. package/externs/shaka/codecs.js +13 -0
  31. package/externs/shaka/manifest.js +69 -7
  32. package/externs/shaka/net.js +13 -1
  33. package/externs/shaka/offline.js +7 -1
  34. package/externs/shaka/player.js +184 -13
  35. package/externs/shaka/text.js +19 -0
  36. package/externs/tizen.js +41 -0
  37. package/externs/webos.js +19 -0
  38. package/externs/xbox.js +43 -0
  39. package/lib/abr/simple_abr_manager.js +9 -1
  40. package/lib/ads/ad_manager.js +19 -2
  41. package/lib/ads/client_side_ad_manager.js +5 -3
  42. package/lib/ads/media_tailor_ad_manager.js +9 -0
  43. package/lib/cast/cast_receiver.js +0 -14
  44. package/lib/cast/cast_utils.js +1 -0
  45. package/lib/cea/mp4_cea_parser.js +6 -1
  46. package/lib/dash/content_protection.js +97 -53
  47. package/lib/dash/dash_parser.js +240 -179
  48. package/lib/dash/mpd_utils.js +72 -65
  49. package/lib/dash/segment_base.js +35 -22
  50. package/lib/dash/segment_list.js +39 -31
  51. package/lib/dash/segment_template.js +47 -23
  52. package/lib/hls/hls_parser.js +376 -165
  53. package/lib/media/buffering_observer.js +25 -1
  54. package/lib/media/drm_engine.js +91 -71
  55. package/lib/media/manifest_filterer.js +220 -0
  56. package/lib/media/media_source_engine.js +108 -29
  57. package/lib/media/playhead.js +3 -3
  58. package/lib/media/preload_manager.js +827 -0
  59. package/lib/media/presentation_timeline.js +11 -0
  60. package/lib/media/segment_index.js +60 -49
  61. package/lib/media/segment_prefetch.js +140 -43
  62. package/lib/media/segment_reference.js +31 -8
  63. package/lib/media/segment_utils.js +208 -25
  64. package/lib/media/streaming_engine.js +321 -77
  65. package/lib/mss/content_protection.js +31 -25
  66. package/lib/mss/mss_parser.js +78 -55
  67. package/lib/net/networking_engine.js +49 -4
  68. package/lib/offline/indexeddb/v1_storage_cell.js +2 -0
  69. package/lib/offline/indexeddb/v2_storage_cell.js +2 -0
  70. package/lib/offline/manifest_converter.js +10 -3
  71. package/lib/offline/storage.js +5 -3
  72. package/lib/player.js +896 -674
  73. package/lib/polyfill/media_capabilities.js +16 -1
  74. package/lib/text/simple_text_displayer.js +9 -0
  75. package/lib/text/stub_text_displayer.js +7 -0
  76. package/lib/text/text_engine.js +16 -3
  77. package/lib/text/ttml_text_parser.js +116 -114
  78. package/lib/text/ui_text_displayer.js +28 -11
  79. package/lib/text/vtt_text_parser.js +54 -115
  80. package/lib/transmuxer/opus.js +91 -0
  81. package/lib/transmuxer/ts_transmuxer.js +115 -0
  82. package/lib/util/cmcd_manager.js +152 -3
  83. package/lib/util/dom_utils.js +11 -0
  84. package/lib/util/error.js +5 -0
  85. package/lib/util/fake_event.js +2 -0
  86. package/lib/util/manifest_parser_utils.js +97 -3
  87. package/lib/util/mime_utils.js +10 -5
  88. package/lib/util/mp4_box_parsers.js +346 -17
  89. package/lib/util/mp4_generator.js +23 -0
  90. package/lib/util/periods.js +24 -37
  91. package/lib/util/platform.js +161 -9
  92. package/lib/util/player_configuration.js +61 -3
  93. package/lib/util/stats.js +16 -0
  94. package/lib/util/stream_utils.js +350 -277
  95. package/lib/util/string_utils.js +36 -0
  96. package/lib/util/tXml.js +814 -0
  97. package/lib/util/ts_parser.js +50 -0
  98. package/lib/util/xml_utils.js +10 -338
  99. package/package.json +2 -2
  100. package/shaka-player.uncompiled.js +8 -0
  101. package/ui/controls.js +187 -5
  102. package/ui/enums.js +2 -0
  103. package/ui/externs/ui.js +30 -3
  104. package/ui/gl_matrix/matrix_4x4.js +568 -0
  105. package/ui/gl_matrix/matrix_quaternion.js +45 -0
  106. package/ui/less/containers.less +11 -0
  107. package/ui/locales/en-GB.json +2 -0
  108. package/ui/locales/en.json +2 -0
  109. package/ui/locales/es-419.json +2 -0
  110. package/ui/locales/es.json +2 -0
  111. package/ui/locales/source.json +8 -0
  112. package/ui/recenter_vr.js +126 -0
  113. package/ui/resolution_selection.js +25 -5
  114. package/ui/statistics_button.js +12 -0
  115. package/ui/text_selection.js +1 -1
  116. package/ui/toggle_stereoscopic.js +127 -0
  117. package/ui/ui.js +74 -38
  118. package/ui/vr_manager.js +557 -0
  119. package/ui/vr_utils.js +232 -0
  120. package/ui/vr_webgl.js +697 -0
@@ -208,14 +208,29 @@ shaka.polyfill.MediaCapabilities = class {
208
208
  };
209
209
  }
210
210
 
211
+ if (mediaCapkeySystemConfig.audio.encryptionScheme) {
212
+ capability = {
213
+ robustness: capability.robustness,
214
+ contentType: capability.contentType,
215
+ encryptionScheme: mediaCapkeySystemConfig.audio.encryptionScheme,
216
+ };
217
+ }
218
+
211
219
  audioCapabilities.push(capability);
212
220
  }
213
221
 
214
222
  if (mediaCapkeySystemConfig.video) {
215
- const capability = {
223
+ let capability = {
216
224
  robustness: mediaCapkeySystemConfig.video.robustness || '',
217
225
  contentType: mediaDecodingConfig.video.contentType,
218
226
  };
227
+ if (mediaCapkeySystemConfig.video.encryptionScheme) {
228
+ capability = {
229
+ robustness: capability.robustness,
230
+ contentType: capability.contentType,
231
+ encryptionScheme: mediaCapkeySystemConfig.video.encryptionScheme,
232
+ };
233
+ }
219
234
  videoCapabilities.push(capability);
220
235
  }
221
236
 
@@ -56,6 +56,15 @@ shaka.text.SimpleTextDisplayer = class {
56
56
  this.textTrack_.mode = 'hidden';
57
57
  }
58
58
 
59
+
60
+ /**
61
+ * @override
62
+ * @export
63
+ */
64
+ configure(config) {
65
+ // Unused.
66
+ }
67
+
59
68
  /**
60
69
  * @override
61
70
  * @export
@@ -13,6 +13,13 @@ goog.provide('shaka.text.StubTextDisplayer');
13
13
  * @export
14
14
  */
15
15
  shaka.text.StubTextDisplayer = class {
16
+ /**
17
+ * @override
18
+ * @export
19
+ */
20
+ configure(config) {
21
+ }
22
+
16
23
  /**
17
24
  * @override
18
25
  * @export
@@ -7,7 +7,7 @@
7
7
  goog.provide('shaka.text.TextEngine');
8
8
 
9
9
  goog.require('goog.asserts');
10
- goog.require('shaka.log');
10
+ goog.require('shaka.Deprecate');
11
11
  goog.require('shaka.media.ClosedCaptionParser');
12
12
  goog.require('shaka.text.Cue');
13
13
  goog.require('shaka.util.BufferUtils');
@@ -51,6 +51,9 @@ shaka.text.TextEngine = class {
51
51
  /** @private {string} */
52
52
  this.selectedClosedCaptionId_ = '';
53
53
 
54
+ /** @private {shaka.extern.TextParser.ModifyCueCallback} */
55
+ this.modifyCueCallback_ = (cue, uri) => {};
56
+
54
57
  /**
55
58
  * The closed captions map stores the CEA closed captions by closed captions
56
59
  * id and start and end time.
@@ -150,18 +153,25 @@ shaka.text.TextEngine = class {
150
153
  if (this.parser_.setSequenceMode) {
151
154
  this.parser_.setSequenceMode(sequenceMode);
152
155
  } else {
153
- shaka.log.alwaysWarn(
156
+ shaka.Deprecate.deprecateFeature(5,
157
+ 'Text parsers w/ setSequenceMode',
154
158
  'Text parsers should have a "setSequenceMode" method!');
155
159
  }
156
160
  if (this.parser_.setManifestType) {
157
161
  this.parser_.setManifestType(manifestType);
158
162
  } else {
159
- shaka.log.alwaysWarn(
163
+ shaka.Deprecate.deprecateFeature(5,
164
+ 'Text parsers w/ setManifestType',
160
165
  'Text parsers should have a "setManifestType" method!');
161
166
  }
162
167
  this.segmentRelativeVttTiming_ = segmentRelativeVttTiming;
163
168
  }
164
169
 
170
+ /** @param {shaka.extern.TextParser.ModifyCueCallback} modifyCueCallback */
171
+ setModifyCueCallback(modifyCueCallback) {
172
+ this.modifyCueCallback_ = modifyCueCallback;
173
+ }
174
+
165
175
  /**
166
176
  * @param {BufferSource} buffer
167
177
  * @param {?number} startTime relative to the start of the presentation
@@ -200,6 +210,9 @@ shaka.text.TextEngine = class {
200
210
  // Parse the buffer and add the new cues.
201
211
  const allCues = this.parser_.parseMedia(
202
212
  shaka.util.BufferUtils.toUint8(buffer), time, uri);
213
+ for (const cue of allCues) {
214
+ this.modifyCueCallback_(cue, uri || null, time);
215
+ }
203
216
  const cuesToAppend = allCues.filter((cue) => {
204
217
  return cue.startTime >= this.appendWindowStart_ &&
205
218
  cue.startTime < this.appendWindowEnd_;