shaka-player 2.5.4 → 2.5.5

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 (102) hide show
  1. package/.csslintrc +13 -0
  2. package/CHANGELOG.md +56 -0
  3. package/build/build.py +4 -1
  4. package/build/check.py +17 -0
  5. package/build/compiler.py +40 -0
  6. package/build/types/core +1 -0
  7. package/build/types/ui +4 -1
  8. package/demo/asset_card.js +41 -11
  9. package/demo/cast_receiver/receiver_app.css +19 -13
  10. package/demo/close_button.js +0 -6
  11. package/demo/common/asset.js +6 -1
  12. package/demo/common/assets.js +72 -14
  13. package/demo/demo.less +105 -16
  14. package/demo/index.html +8 -5
  15. package/demo/load.js +5 -7
  16. package/demo/main.js +81 -16
  17. package/dist/.csslintstamp +0 -0
  18. package/dist/controls.css +1 -1
  19. package/dist/controls.css.map +1 -1
  20. package/dist/demo.compiled.debug.js +46 -39
  21. package/dist/demo.compiled.debug.map +3 -3
  22. package/dist/demo.compiled.js +46 -39
  23. package/dist/demo.compiled.map +3 -3
  24. package/dist/demo.css +1 -1
  25. package/dist/demo.css.map +1 -1
  26. package/dist/deps.js +11 -7
  27. package/dist/receiver.compiled.debug.js +10 -6
  28. package/dist/receiver.compiled.debug.map +3 -3
  29. package/dist/receiver.compiled.js +10 -6
  30. package/dist/receiver.compiled.map +3 -3
  31. package/dist/shaka-player.compiled.debug.externs.js +123 -92
  32. package/dist/shaka-player.compiled.debug.js +113 -105
  33. package/dist/shaka-player.compiled.debug.map +4 -4
  34. package/dist/shaka-player.compiled.externs.js +123 -92
  35. package/dist/shaka-player.compiled.js +551 -548
  36. package/dist/shaka-player.compiled.map +4 -4
  37. package/dist/shaka-player.ui.debug.externs.js +170 -101
  38. package/dist/shaka-player.ui.debug.js +187 -188
  39. package/dist/shaka-player.ui.debug.map +4 -4
  40. package/dist/shaka-player.ui.externs.js +170 -101
  41. package/dist/shaka-player.ui.js +651 -651
  42. package/dist/shaka-player.ui.map +3 -3
  43. package/docs/tutorials/drm-config.md +1 -0
  44. package/docs/tutorials/fairplay.md +77 -0
  45. package/docs/tutorials/index.json +1 -0
  46. package/docs/tutorials/ui-customization.md +3 -0
  47. package/docs/tutorials/ui.md +3 -1
  48. package/externs/mediasession.js +16 -1
  49. package/externs/shaka/net.js +5 -1
  50. package/externs/shaka/player.js +136 -90
  51. package/externs/webkitmediakeys.js +4 -0
  52. package/lib/dash/content_protection.js +33 -1
  53. package/lib/dash/dash_parser.js +12 -4
  54. package/lib/hls/hls_parser.js +20 -4
  55. package/lib/media/drm_engine.js +29 -2
  56. package/lib/media/media_source_engine.js +7 -3
  57. package/lib/media/playhead.js +8 -3
  58. package/lib/media/streaming_engine.js +24 -8
  59. package/lib/media/video_wrapper.js +8 -3
  60. package/lib/net/networking_engine.js +1 -0
  61. package/lib/player.js +3 -2
  62. package/lib/polyfill/patchedmediakeys_apple.js +2 -72
  63. package/lib/util/error.js +12 -0
  64. package/lib/util/fairplay_utils.js +122 -0
  65. package/lib/util/player_configuration.js +5 -0
  66. package/lib/util/pssh.js +41 -0
  67. package/package.json +4 -3
  68. package/shaka-player.uncompiled.js +5 -1
  69. package/test/dash/dash_parser_content_protection_unit.js +35 -1
  70. package/test/dash/dash_parser_manifest_unit.js +31 -0
  71. package/test/hls/hls_live_unit.js +7 -1
  72. package/test/hls/hls_parser_unit.js +50 -0
  73. package/test/media/media_source_engine_integration.js +12 -0
  74. package/test/media/playhead_unit.js +2 -0
  75. package/test/player_external.js +3 -2
  76. package/test/player_integration.js +75 -0
  77. package/test/test/externs/jasmine.js +6 -0
  78. package/test/test/util/test_scheme.js +32 -1
  79. package/test/test/util/ui_utils.js +41 -0
  80. package/test/ui/ui_unit.js +129 -3
  81. package/ui/audio_language_selection.js +17 -96
  82. package/ui/big_play_button.js +61 -0
  83. package/ui/controls.js +111 -86
  84. package/ui/controls.less +3 -5
  85. package/ui/externs/ui.js +14 -2
  86. package/ui/fullscreen_button.js +2 -52
  87. package/ui/less/buttons.less +8 -8
  88. package/ui/less/containers.less +21 -21
  89. package/ui/less/general.less +11 -0
  90. package/ui/less/other_elements.less +2 -1
  91. package/ui/less/overflow_menu.less +11 -10
  92. package/ui/less/range_elements.less +6 -0
  93. package/ui/less/spinner.less +2 -0
  94. package/ui/pip_button.js +1 -1
  95. package/ui/{play_pause_button.js → play_button.js} +17 -47
  96. package/ui/resolution_selection.js +41 -104
  97. package/ui/seek_bar.js +15 -17
  98. package/ui/settings_menu.js +113 -0
  99. package/ui/small_play_button.js +73 -0
  100. package/ui/text_displayer.js +2 -2
  101. package/ui/text_selection.js +39 -105
  102. package/ui/ui.js +12 -0
@@ -216,6 +216,8 @@ shaka.util.Error.Code = {
216
216
  'NO_LICENSE_SERVER_GIVEN': 6012,
217
217
  'OFFLINE_SESSION_REMOVED': 6013,
218
218
  'EXPIRED': 6014,
219
+ 'SERVER_CERTIFICATE_REQUIRED': 6015,
220
+ 'INIT_DATA_TRANSFORM_ERROR': 6016,
219
221
  'LOAD_INTERRUPTED': 7000,
220
222
  'OPERATION_ABORTED': 7001,
221
223
  'NO_VIDEO_ELEMENT': 7002,
@@ -571,6 +573,35 @@ shaka.util.EventManager = class {
571
573
  * @typedef {function(!Event)}
572
574
  */
573
575
  shaka.util.EventManager.ListenerType;
576
+ /**
577
+ * @summary A set of FairPlay utility functions.
578
+ */
579
+ shaka.util.FairPlayUtils = class {
580
+ /**
581
+ * Using the default method, extract a content ID from the init data. This is
582
+ * based on the FairPlay example documentation.
583
+ * @param {!BufferSource} initData
584
+ * @return {string}
585
+ */
586
+ static defaultGetContentId(initData) {}
587
+ /**
588
+ * Transforms the init data buffer using the given data. The format is:
589
+ * <pre>
590
+ * [4 bytes] initDataSize
591
+ * [initDataSize bytes] initData
592
+ * [4 bytes] contentIdSize
593
+ * [contentIdSize bytes] contentId
594
+ * [4 bytes] certSize
595
+ * [certSize bytes] cert
596
+ * </pre>
597
+ * @param {!BufferSource} initData
598
+ * @param {!BufferSource|string} contentId
599
+ * @param {?BufferSource} cert The server certificate; this will throw if not
600
+ * provided.
601
+ * @return {!Uint8Array}
602
+ */
603
+ static initDataTransform(initData,contentId,cert) {}
604
+ };
574
605
  /**
575
606
  * Creates a string from the given buffer as UTF-8 encoding.
576
607
  * @param {?BufferSource} data
@@ -1098,98 +1129,6 @@ shaka.cast.CastReceiver.prototype.isIdle = function() {};
1098
1129
  * @override
1099
1130
  */
1100
1131
  shaka.cast.CastReceiver.prototype.destroy = function() {};
1101
- /**
1102
- * Creates an InitSegmentReference, which provides the location to an
1103
- * initialization segment.
1104
- * @param {function():!Array.<string>} uris A function that creates the URIs of
1105
- * the resource containing the segment.
1106
- * @param {number} startByte The offset from the start of the resource to the
1107
- * start of the segment.
1108
- * @param {?number} endByte The offset from the start of the resource to the
1109
- * end of the segment, inclusive. A value of null indicates that the segment
1110
- * extends to the end of the resource.
1111
- * @constructor
1112
- * @struct
1113
- */
1114
- shaka.media.InitSegmentReference = function(uris, startByte, endByte) {};
1115
- /**
1116
- * Creates the URIs of the resource containing the segment.
1117
- * @return {!Array.<string>}
1118
- */
1119
- shaka.media.InitSegmentReference.prototype.createUris = function() {};
1120
- /**
1121
- * Returns the offset from the start of the resource to the
1122
- * start of the segment.
1123
- * @return {number}
1124
- */
1125
- shaka.media.InitSegmentReference.prototype.getStartByte = function() {};
1126
- /**
1127
- * Returns the offset from the start of the resource to the end of the segment,
1128
- * inclusive. A value of null indicates that the segment extends to the end of
1129
- * the resource.
1130
- * @return {?number}
1131
- */
1132
- shaka.media.InitSegmentReference.prototype.getEndByte = function() {};
1133
- /**
1134
- * Creates a SegmentReference, which provides the start time, end time, and
1135
- * location to a media segment.
1136
- * @param {number} position The segment's position within a particular Period.
1137
- * The following should hold true between any two SegmentReferences from the
1138
- * same Period, r1 and r2:
1139
- * IF r2.position > r1.position THEN
1140
- * [ (r2.startTime > r1.startTime) OR
1141
- * (r2.startTime == r1.startTime AND r2.endTime >= r1.endTime) ]
1142
- * @param {number} startTime The segment's start time in seconds, relative to
1143
- * the start of a particular Period.
1144
- * @param {number} endTime The segment's end time in seconds, relative to
1145
- * the start of a particular Period. The segment ends the instant before
1146
- * this time, so |endTime| must be strictly greater than |startTime|.
1147
- * @param {function():!Array.<string>} uris
1148
- * A function that creates the URIs of the resource containing the segment.
1149
- * @param {number} startByte The offset from the start of the resource to the
1150
- * start of the segment.
1151
- * @param {?number} endByte The offset from the start of the resource to the
1152
- * end of the segment, inclusive. A value of null indicates that the segment
1153
- * extends to the end of the resource.
1154
- * @constructor
1155
- * @struct
1156
- */
1157
- shaka.media.SegmentReference = function(position, startTime, endTime, uris, startByte, endByte) {};
1158
- /**
1159
- * Returns the segment's position within a particular Period.
1160
- * @return {number} The segment's position.
1161
- */
1162
- shaka.media.SegmentReference.prototype.getPosition = function() {};
1163
- /**
1164
- * Returns the segment's start time in seconds, relative to
1165
- * the start of a particular Period.
1166
- * @return {number}
1167
- */
1168
- shaka.media.SegmentReference.prototype.getStartTime = function() {};
1169
- /**
1170
- * Returns the segment's end time in seconds, relative to
1171
- * the start of a particular Period.
1172
- * @return {number}
1173
- */
1174
- shaka.media.SegmentReference.prototype.getEndTime = function() {};
1175
- /**
1176
- * Creates the URIs of the resource containing the segment.
1177
- * @return {!Array.<string>}
1178
- */
1179
- shaka.media.SegmentReference.prototype.createUris = function() {};
1180
- /**
1181
- * Returns the offset from the start of the resource to the
1182
- * start of the segment.
1183
- * @return {number}
1184
- */
1185
- shaka.media.SegmentReference.prototype.getStartByte = function() {};
1186
- /**
1187
- * Returns the offset from the start of the resource to the end of the segment,
1188
- * inclusive. A value of null indicates that the segment extends to the end of
1189
- * the resource.
1190
- * @return {?number}
1191
- */
1192
- shaka.media.SegmentReference.prototype.getEndByte = function() {};
1193
1132
  /**
1194
1133
  * Creates a DataViewReader, which abstracts a DataView object.
1195
1134
  * @param {!DataView} dataView The DataView.
@@ -1358,6 +1297,98 @@ shaka.util.Mp4Parser.allData = function(callback) {};
1358
1297
  * @return {string}
1359
1298
  */
1360
1299
  shaka.util.Mp4Parser.typeToString = function(type) {};
1300
+ /**
1301
+ * Creates an InitSegmentReference, which provides the location to an
1302
+ * initialization segment.
1303
+ * @param {function():!Array.<string>} uris A function that creates the URIs of
1304
+ * the resource containing the segment.
1305
+ * @param {number} startByte The offset from the start of the resource to the
1306
+ * start of the segment.
1307
+ * @param {?number} endByte The offset from the start of the resource to the
1308
+ * end of the segment, inclusive. A value of null indicates that the segment
1309
+ * extends to the end of the resource.
1310
+ * @constructor
1311
+ * @struct
1312
+ */
1313
+ shaka.media.InitSegmentReference = function(uris, startByte, endByte) {};
1314
+ /**
1315
+ * Creates the URIs of the resource containing the segment.
1316
+ * @return {!Array.<string>}
1317
+ */
1318
+ shaka.media.InitSegmentReference.prototype.createUris = function() {};
1319
+ /**
1320
+ * Returns the offset from the start of the resource to the
1321
+ * start of the segment.
1322
+ * @return {number}
1323
+ */
1324
+ shaka.media.InitSegmentReference.prototype.getStartByte = function() {};
1325
+ /**
1326
+ * Returns the offset from the start of the resource to the end of the segment,
1327
+ * inclusive. A value of null indicates that the segment extends to the end of
1328
+ * the resource.
1329
+ * @return {?number}
1330
+ */
1331
+ shaka.media.InitSegmentReference.prototype.getEndByte = function() {};
1332
+ /**
1333
+ * Creates a SegmentReference, which provides the start time, end time, and
1334
+ * location to a media segment.
1335
+ * @param {number} position The segment's position within a particular Period.
1336
+ * The following should hold true between any two SegmentReferences from the
1337
+ * same Period, r1 and r2:
1338
+ * IF r2.position > r1.position THEN
1339
+ * [ (r2.startTime > r1.startTime) OR
1340
+ * (r2.startTime == r1.startTime AND r2.endTime >= r1.endTime) ]
1341
+ * @param {number} startTime The segment's start time in seconds, relative to
1342
+ * the start of a particular Period.
1343
+ * @param {number} endTime The segment's end time in seconds, relative to
1344
+ * the start of a particular Period. The segment ends the instant before
1345
+ * this time, so |endTime| must be strictly greater than |startTime|.
1346
+ * @param {function():!Array.<string>} uris
1347
+ * A function that creates the URIs of the resource containing the segment.
1348
+ * @param {number} startByte The offset from the start of the resource to the
1349
+ * start of the segment.
1350
+ * @param {?number} endByte The offset from the start of the resource to the
1351
+ * end of the segment, inclusive. A value of null indicates that the segment
1352
+ * extends to the end of the resource.
1353
+ * @constructor
1354
+ * @struct
1355
+ */
1356
+ shaka.media.SegmentReference = function(position, startTime, endTime, uris, startByte, endByte) {};
1357
+ /**
1358
+ * Returns the segment's position within a particular Period.
1359
+ * @return {number} The segment's position.
1360
+ */
1361
+ shaka.media.SegmentReference.prototype.getPosition = function() {};
1362
+ /**
1363
+ * Returns the segment's start time in seconds, relative to
1364
+ * the start of a particular Period.
1365
+ * @return {number}
1366
+ */
1367
+ shaka.media.SegmentReference.prototype.getStartTime = function() {};
1368
+ /**
1369
+ * Returns the segment's end time in seconds, relative to
1370
+ * the start of a particular Period.
1371
+ * @return {number}
1372
+ */
1373
+ shaka.media.SegmentReference.prototype.getEndTime = function() {};
1374
+ /**
1375
+ * Creates the URIs of the resource containing the segment.
1376
+ * @return {!Array.<string>}
1377
+ */
1378
+ shaka.media.SegmentReference.prototype.createUris = function() {};
1379
+ /**
1380
+ * Returns the offset from the start of the resource to the
1381
+ * start of the segment.
1382
+ * @return {number}
1383
+ */
1384
+ shaka.media.SegmentReference.prototype.getStartByte = function() {};
1385
+ /**
1386
+ * Returns the offset from the start of the resource to the end of the segment,
1387
+ * inclusive. A value of null indicates that the segment extends to the end of
1388
+ * the resource.
1389
+ * @return {?number}
1390
+ */
1391
+ shaka.media.SegmentReference.prototype.getEndByte = function() {};
1361
1392
  /**
1362
1393
  * Creates a SegmentIndex.
1363
1394
  * @param {!Array.<!shaka.media.SegmentReference>} references The list of