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
@@ -0,0 +1,18 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for DeviceMotionEvent which were missing in the
9
+ * Closure compiler.
10
+ *
11
+ * @externs
12
+ */
13
+
14
+
15
+ /**
16
+ * @return {!Promise.<string>}
17
+ */
18
+ DeviceMotionEvent.requestPermission = function() {};
@@ -0,0 +1,16 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for Hisense
9
+ *
10
+ * @externs
11
+ */
12
+
13
+ /**
14
+ * @return {boolean}
15
+ */
16
+ window.Hisense_Get4KSupportState = function() {};
@@ -0,0 +1,31 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for PlayStation
9
+ *
10
+ * @externs
11
+ */
12
+
13
+
14
+ /** @const */
15
+ var msdk = {};
16
+
17
+
18
+ /** @const */
19
+ msdk.device = {};
20
+
21
+
22
+ /**
23
+ * @return {!Promise.<{resolution: string}>}
24
+ */
25
+ msdk.device.getDisplayInfo = function() {};
26
+
27
+
28
+ /**
29
+ * @return {!Promise.<{resolution: string}>}
30
+ */
31
+ msdk.device.getDisplayInfoImmediate = function() {};
@@ -92,9 +92,11 @@ shaka.extern.AbrManager = class {
92
92
  * @param {number} numBytes The total number of bytes transferred.
93
93
  * @param {boolean} allowSwitch Indicate if the segment is allowed to switch
94
94
  * to another stream.
95
+ * @param {shaka.extern.Request=} request
96
+ * A reference to the request
95
97
  * @exportDoc
96
98
  */
97
- segmentDownloaded(deltaTimeMs, numBytes, allowSwitch) {}
99
+ segmentDownloaded(deltaTimeMs, numBytes, allowSwitch, request) {}
98
100
 
99
101
  /**
100
102
  * Notifies the ABR that it is a time to suggest new streams. This is used by
@@ -109,6 +109,11 @@ shaka.extern.IAdManager = class extends EventTarget {
109
109
  */
110
110
  requestMediaTailorStream(url, adsParams, backupUrl) {}
111
111
 
112
+ /**
113
+ * @param {string} url
114
+ */
115
+ addMediaTailorTrackingUrl(url) {}
116
+
112
117
  /**
113
118
  * @param {!HTMLElement} adContainer
114
119
  * @param {!HTMLMediaElement} video
@@ -42,3 +42,16 @@ shaka.extern.MPEG_PES;
42
42
  * @property {?number} time
43
43
  */
44
44
  shaka.extern.VideoNalu;
45
+
46
+
47
+ /**
48
+ * @typedef {{
49
+ * projection: ?string,
50
+ * hfov: ?number
51
+ * }}
52
+ *
53
+ * @summary VideoNalu.
54
+ * @property {?string} projection
55
+ * @property {?number} hfov
56
+ */
57
+ shaka.extern.SpatialVideoInfo;
@@ -181,6 +181,7 @@ shaka.extern.ServiceDescription;
181
181
  /**
182
182
  * @typedef {{
183
183
  * keySystem: string,
184
+ * encryptionScheme: string,
184
185
  * licenseServerUri: string,
185
186
  * distinctiveIdentifierRequired: boolean,
186
187
  * persistentStateRequired: boolean,
@@ -199,6 +200,9 @@ shaka.extern.ServiceDescription;
199
200
  * @property {string} keySystem
200
201
  * <i>Required.</i> <br>
201
202
  * The key system, e.g., "com.widevine.alpha".
203
+ * @property {string} encryptionScheme
204
+ * <i>Required.</i> <br>
205
+ * The encryption scheme, e.g., "cenc", "cbcs", "cbcs-1-9".
202
206
  * @property {string} licenseServerUri
203
207
  * <i>Filled in by DRM config if missing.</i> <br>
204
208
  * The license server URI.
@@ -318,7 +322,8 @@ shaka.extern.CreateSegmentIndexFunction;
318
322
 
319
323
  /**
320
324
  * @typedef {{
321
- * method: string,
325
+ * bitsKey: number,
326
+ * blockCipherMode: string,
322
327
  * cryptoKey: (webCrypto.CryptoKey|undefined),
323
328
  * fetchKey: (shaka.extern.CreateSegmentIndexFunction|undefined),
324
329
  * iv: (!Uint8Array|undefined),
@@ -326,12 +331,14 @@ shaka.extern.CreateSegmentIndexFunction;
326
331
  * }}
327
332
  *
328
333
  * @description
329
- * AES-128 key and iv info from the manifest.
334
+ * AES key and iv info from the manifest.
330
335
  *
331
- * @property {string} method
332
- * The key method defined in the manifest.
336
+ * @property {number} bitsKey
337
+ * The number of the bit key (eg: 128, 256).
338
+ * @property {string} blockCipherMode
339
+ * The block cipher mode of operation. Possible values: 'CTR' or 'CBC'.
333
340
  * @property {webCrypto.CryptoKey|undefined} cryptoKey
334
- * Web crypto key object of the AES-128 CBC key. If unset, the "fetchKey"
341
+ * Web crypto key object of the AES key. If unset, the "fetchKey"
335
342
  * property should be provided.
336
343
  * @property {shaka.extern.FetchCryptoKeysFunction|undefined} fetchKey
337
344
  * A function that fetches the key.
@@ -346,7 +353,7 @@ shaka.extern.CreateSegmentIndexFunction;
346
353
  *
347
354
  * @exportDoc
348
355
  */
349
- shaka.extern.aes128Key;
356
+ shaka.extern.aesKey;
350
357
 
351
358
 
352
359
  /**
@@ -359,6 +366,51 @@ shaka.extern.aes128Key;
359
366
  shaka.extern.FetchCryptoKeysFunction;
360
367
 
361
368
 
369
+ /**
370
+ * SegmentIndex minimal API.
371
+ * @interface
372
+ * @exportDoc
373
+ */
374
+ shaka.extern.SegmentIndex = class {
375
+ /**
376
+ * Get number of references.
377
+ * @return {number}
378
+ * @exportDoc
379
+ */
380
+ getNumReferences() {}
381
+
382
+ /**
383
+ * Finds the position of the segment for the given time, in seconds, relative
384
+ * to the start of the presentation. Returns the position of the segment
385
+ * with the largest end time if more than one segment is known for the given
386
+ * time.
387
+ *
388
+ * @param {number} time
389
+ * @return {?number} The position of the segment, or null if the position of
390
+ * the segment could not be determined.
391
+ * @exportDoc
392
+ */
393
+ find(time) {}
394
+
395
+ /**
396
+ * Gets the SegmentReference for the segment at the given position.
397
+ *
398
+ * @param {number} position The position of the segment as returned by find().
399
+ * @return {shaka.media.SegmentReference} The SegmentReference, or null if
400
+ * no such SegmentReference exists.
401
+ * @exportDoc
402
+ */
403
+ get(position) {}
404
+
405
+ /**
406
+ * Gets number of already evicted segments.
407
+ * @return {number}
408
+ * @exportDoc
409
+ */
410
+ getNumEvicted() {}
411
+ };
412
+
413
+
362
414
  /**
363
415
  * @typedef {{
364
416
  * id: number,
@@ -400,7 +452,8 @@ shaka.extern.FetchCryptoKeysFunction;
400
452
  * undefined),
401
453
  * mssPrivateData: (shaka.extern.MssPrivateData|undefined),
402
454
  * external: boolean,
403
- * fastSwitching: boolean
455
+ * fastSwitching: boolean,
456
+ * fullMimeTypes: !Set.<string>
404
457
  * }}
405
458
  *
406
459
  * @description
@@ -430,10 +483,14 @@ shaka.extern.FetchCryptoKeysFunction;
430
483
  * @property {string} mimeType
431
484
  * <i>Required.</i> <br>
432
485
  * The Stream's MIME type, e.g., 'audio/mp4', 'video/webm', or 'text/vtt'.
486
+ * In the case of a stream that adapts between different periods with
487
+ * different MIME types, this represents only the first period.
433
488
  * @property {string} codecs
434
489
  * <i>Defaults to '' (i.e., unknown / not needed).</i> <br>
435
490
  * The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be
436
491
  * compatible with the Stream's MIME type. <br>
492
+ * In the case of a stream that adapts between different periods with
493
+ * different codecs, this represents only the first period.
437
494
  * See {@link https://tools.ietf.org/html/rfc6381}
438
495
  * @property {(number|undefined)} frameRate
439
496
  * <i>Video streams only.</i> <br>
@@ -535,6 +592,11 @@ shaka.extern.FetchCryptoKeysFunction;
535
592
  * Eg: external text tracks.
536
593
  * @property {boolean} fastSwitching
537
594
  * Indicate if the stream should be used for fast switching.
595
+ * @property {!Set.<string>} fullMimeTypes
596
+ * A set of full MIME types (e.g. MIME types plus codecs information), that
597
+ * represents the types used in each period of the original manifest.
598
+ * Meant for being used by compatibility checking, such as with
599
+ * MediaSource.isTypeSupported.
538
600
  *
539
601
  * @exportDoc
540
602
  */
@@ -63,7 +63,11 @@ shaka.extern.RetryParameters;
63
63
  * drmInfo: ?shaka.extern.DrmInfo,
64
64
  * initData: ?Uint8Array,
65
65
  * initDataType: ?string,
66
- * streamDataCallback: ?function(BufferSource):!Promise
66
+ * streamDataCallback: ?function(BufferSource):!Promise,
67
+ * requestStartTime: (?number|undefined),
68
+ * timeToFirstByte: (?number|undefined),
69
+ * packetNumber: (?number|undefined),
70
+ * contentType: (?string|undefined)
67
71
  * }}
68
72
  *
69
73
  * @description
@@ -104,6 +108,14 @@ shaka.extern.RetryParameters;
104
108
  * used to initialize EME.
105
109
  * @property {?function(BufferSource):!Promise} streamDataCallback
106
110
  * A callback function to handle the chunked data of the ReadableStream.
111
+ * @property {(?number|undefined)} requestStartTime
112
+ * The time that the request started.
113
+ * @property {(?number|undefined)} timeToFirstByte
114
+ * The time taken to the first byte.
115
+ * @property {(?number|undefined)} packetNumber
116
+ * A number representing the order the packet within the request.
117
+ * @property {(?string|undefined)} contentType
118
+ * Content type (e.g. 'video', 'audio' or 'text', 'image')
107
119
  * @exportDoc
108
120
  */
109
121
  shaka.extern.Request;
@@ -230,7 +230,9 @@ shaka.extern.StreamDB;
230
230
  * tilesLayout: ?string,
231
231
  * pendingSegmentRefId: (string|undefined),
232
232
  * pendingInitSegmentRefId: (string|undefined),
233
- * dataKey: number
233
+ * dataKey: number,
234
+ * mimeType: ?string,
235
+ * codecs: ?string
234
236
  * }}
235
237
  *
236
238
  * @property {?number} initSegmentKey
@@ -263,6 +265,10 @@ shaka.extern.StreamDB;
263
265
  * downloaded.
264
266
  * @property {number} dataKey
265
267
  * The key to the data in storage.
268
+ * @property {?string} mimeType
269
+ * The mimeType of the segment.
270
+ * @property {?string} codecs
271
+ * The codecs of the segment.
266
272
  */
267
273
  shaka.extern.SegmentDB;
268
274