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
@@ -373,6 +373,8 @@ shaka.util.Error.Code = {
373
373
  'NO_LICENSE_SERVER_GIVEN': 6012,
374
374
  'OFFLINE_SESSION_REMOVED': 6013,
375
375
  'EXPIRED': 6014,
376
+ 'SERVER_CERTIFICATE_REQUIRED': 6015,
377
+ 'INIT_DATA_TRANSFORM_ERROR': 6016,
376
378
  'LOAD_INTERRUPTED': 7000,
377
379
  'OPERATION_ABORTED': 7001,
378
380
  'NO_VIDEO_ELEMENT': 7002,
@@ -689,6 +691,35 @@ shaka.util.EventManager = class {
689
691
  * @typedef {function(!Event)}
690
692
  */
691
693
  shaka.util.EventManager.ListenerType;
694
+ /**
695
+ * @summary A set of FairPlay utility functions.
696
+ */
697
+ shaka.util.FairPlayUtils = class {
698
+ /**
699
+ * Using the default method, extract a content ID from the init data. This is
700
+ * based on the FairPlay example documentation.
701
+ * @param {!BufferSource} initData
702
+ * @return {string}
703
+ */
704
+ static defaultGetContentId(initData) {}
705
+ /**
706
+ * Transforms the init data buffer using the given data. The format is:
707
+ * <pre>
708
+ * [4 bytes] initDataSize
709
+ * [initDataSize bytes] initData
710
+ * [4 bytes] contentIdSize
711
+ * [contentIdSize bytes] contentId
712
+ * [4 bytes] certSize
713
+ * [certSize bytes] cert
714
+ * </pre>
715
+ * @param {!BufferSource} initData
716
+ * @param {!BufferSource|string} contentId
717
+ * @param {?BufferSource} cert The server certificate; this will throw if not
718
+ * provided.
719
+ * @return {!Uint8Array}
720
+ */
721
+ static initDataTransform(initData,contentId,cert) {}
722
+ };
692
723
  /**
693
724
  * Creates a string from the given buffer as UTF-8 encoding.
694
725
  * @param {?BufferSource} data
@@ -1216,98 +1247,6 @@ shaka.cast.CastReceiver.prototype.isIdle = function() {};
1216
1247
  * @override
1217
1248
  */
1218
1249
  shaka.cast.CastReceiver.prototype.destroy = function() {};
1219
- /**
1220
- * Creates an InitSegmentReference, which provides the location to an
1221
- * initialization segment.
1222
- * @param {function():!Array.<string>} uris A function that creates the URIs of
1223
- * the resource containing the segment.
1224
- * @param {number} startByte The offset from the start of the resource to the
1225
- * start of the segment.
1226
- * @param {?number} endByte The offset from the start of the resource to the
1227
- * end of the segment, inclusive. A value of null indicates that the segment
1228
- * extends to the end of the resource.
1229
- * @constructor
1230
- * @struct
1231
- */
1232
- shaka.media.InitSegmentReference = function(uris, startByte, endByte) {};
1233
- /**
1234
- * Creates the URIs of the resource containing the segment.
1235
- * @return {!Array.<string>}
1236
- */
1237
- shaka.media.InitSegmentReference.prototype.createUris = function() {};
1238
- /**
1239
- * Returns the offset from the start of the resource to the
1240
- * start of the segment.
1241
- * @return {number}
1242
- */
1243
- shaka.media.InitSegmentReference.prototype.getStartByte = function() {};
1244
- /**
1245
- * Returns the offset from the start of the resource to the end of the segment,
1246
- * inclusive. A value of null indicates that the segment extends to the end of
1247
- * the resource.
1248
- * @return {?number}
1249
- */
1250
- shaka.media.InitSegmentReference.prototype.getEndByte = function() {};
1251
- /**
1252
- * Creates a SegmentReference, which provides the start time, end time, and
1253
- * location to a media segment.
1254
- * @param {number} position The segment's position within a particular Period.
1255
- * The following should hold true between any two SegmentReferences from the
1256
- * same Period, r1 and r2:
1257
- * IF r2.position > r1.position THEN
1258
- * [ (r2.startTime > r1.startTime) OR
1259
- * (r2.startTime == r1.startTime AND r2.endTime >= r1.endTime) ]
1260
- * @param {number} startTime The segment's start time in seconds, relative to
1261
- * the start of a particular Period.
1262
- * @param {number} endTime The segment's end time in seconds, relative to
1263
- * the start of a particular Period. The segment ends the instant before
1264
- * this time, so |endTime| must be strictly greater than |startTime|.
1265
- * @param {function():!Array.<string>} uris
1266
- * A function that creates the URIs of the resource containing the segment.
1267
- * @param {number} startByte The offset from the start of the resource to the
1268
- * start of the segment.
1269
- * @param {?number} endByte The offset from the start of the resource to the
1270
- * end of the segment, inclusive. A value of null indicates that the segment
1271
- * extends to the end of the resource.
1272
- * @constructor
1273
- * @struct
1274
- */
1275
- shaka.media.SegmentReference = function(position, startTime, endTime, uris, startByte, endByte) {};
1276
- /**
1277
- * Returns the segment's position within a particular Period.
1278
- * @return {number} The segment's position.
1279
- */
1280
- shaka.media.SegmentReference.prototype.getPosition = function() {};
1281
- /**
1282
- * Returns the segment's start time in seconds, relative to
1283
- * the start of a particular Period.
1284
- * @return {number}
1285
- */
1286
- shaka.media.SegmentReference.prototype.getStartTime = function() {};
1287
- /**
1288
- * Returns the segment's end time in seconds, relative to
1289
- * the start of a particular Period.
1290
- * @return {number}
1291
- */
1292
- shaka.media.SegmentReference.prototype.getEndTime = function() {};
1293
- /**
1294
- * Creates the URIs of the resource containing the segment.
1295
- * @return {!Array.<string>}
1296
- */
1297
- shaka.media.SegmentReference.prototype.createUris = function() {};
1298
- /**
1299
- * Returns the offset from the start of the resource to the
1300
- * start of the segment.
1301
- * @return {number}
1302
- */
1303
- shaka.media.SegmentReference.prototype.getStartByte = function() {};
1304
- /**
1305
- * Returns the offset from the start of the resource to the end of the segment,
1306
- * inclusive. A value of null indicates that the segment extends to the end of
1307
- * the resource.
1308
- * @return {?number}
1309
- */
1310
- shaka.media.SegmentReference.prototype.getEndByte = function() {};
1311
1250
  /**
1312
1251
  * Creates a DataViewReader, which abstracts a DataView object.
1313
1252
  * @param {!DataView} dataView The DataView.
@@ -1476,6 +1415,98 @@ shaka.util.Mp4Parser.allData = function(callback) {};
1476
1415
  * @return {string}
1477
1416
  */
1478
1417
  shaka.util.Mp4Parser.typeToString = function(type) {};
1418
+ /**
1419
+ * Creates an InitSegmentReference, which provides the location to an
1420
+ * initialization segment.
1421
+ * @param {function():!Array.<string>} uris A function that creates the URIs of
1422
+ * the resource containing the segment.
1423
+ * @param {number} startByte The offset from the start of the resource to the
1424
+ * start of the segment.
1425
+ * @param {?number} endByte The offset from the start of the resource to the
1426
+ * end of the segment, inclusive. A value of null indicates that the segment
1427
+ * extends to the end of the resource.
1428
+ * @constructor
1429
+ * @struct
1430
+ */
1431
+ shaka.media.InitSegmentReference = function(uris, startByte, endByte) {};
1432
+ /**
1433
+ * Creates the URIs of the resource containing the segment.
1434
+ * @return {!Array.<string>}
1435
+ */
1436
+ shaka.media.InitSegmentReference.prototype.createUris = function() {};
1437
+ /**
1438
+ * Returns the offset from the start of the resource to the
1439
+ * start of the segment.
1440
+ * @return {number}
1441
+ */
1442
+ shaka.media.InitSegmentReference.prototype.getStartByte = function() {};
1443
+ /**
1444
+ * Returns the offset from the start of the resource to the end of the segment,
1445
+ * inclusive. A value of null indicates that the segment extends to the end of
1446
+ * the resource.
1447
+ * @return {?number}
1448
+ */
1449
+ shaka.media.InitSegmentReference.prototype.getEndByte = function() {};
1450
+ /**
1451
+ * Creates a SegmentReference, which provides the start time, end time, and
1452
+ * location to a media segment.
1453
+ * @param {number} position The segment's position within a particular Period.
1454
+ * The following should hold true between any two SegmentReferences from the
1455
+ * same Period, r1 and r2:
1456
+ * IF r2.position > r1.position THEN
1457
+ * [ (r2.startTime > r1.startTime) OR
1458
+ * (r2.startTime == r1.startTime AND r2.endTime >= r1.endTime) ]
1459
+ * @param {number} startTime The segment's start time in seconds, relative to
1460
+ * the start of a particular Period.
1461
+ * @param {number} endTime The segment's end time in seconds, relative to
1462
+ * the start of a particular Period. The segment ends the instant before
1463
+ * this time, so |endTime| must be strictly greater than |startTime|.
1464
+ * @param {function():!Array.<string>} uris
1465
+ * A function that creates the URIs of the resource containing the segment.
1466
+ * @param {number} startByte The offset from the start of the resource to the
1467
+ * start of the segment.
1468
+ * @param {?number} endByte The offset from the start of the resource to the
1469
+ * end of the segment, inclusive. A value of null indicates that the segment
1470
+ * extends to the end of the resource.
1471
+ * @constructor
1472
+ * @struct
1473
+ */
1474
+ shaka.media.SegmentReference = function(position, startTime, endTime, uris, startByte, endByte) {};
1475
+ /**
1476
+ * Returns the segment's position within a particular Period.
1477
+ * @return {number} The segment's position.
1478
+ */
1479
+ shaka.media.SegmentReference.prototype.getPosition = function() {};
1480
+ /**
1481
+ * Returns the segment's start time in seconds, relative to
1482
+ * the start of a particular Period.
1483
+ * @return {number}
1484
+ */
1485
+ shaka.media.SegmentReference.prototype.getStartTime = function() {};
1486
+ /**
1487
+ * Returns the segment's end time in seconds, relative to
1488
+ * the start of a particular Period.
1489
+ * @return {number}
1490
+ */
1491
+ shaka.media.SegmentReference.prototype.getEndTime = function() {};
1492
+ /**
1493
+ * Creates the URIs of the resource containing the segment.
1494
+ * @return {!Array.<string>}
1495
+ */
1496
+ shaka.media.SegmentReference.prototype.createUris = function() {};
1497
+ /**
1498
+ * Returns the offset from the start of the resource to the
1499
+ * start of the segment.
1500
+ * @return {number}
1501
+ */
1502
+ shaka.media.SegmentReference.prototype.getStartByte = function() {};
1503
+ /**
1504
+ * Returns the offset from the start of the resource to the end of the segment,
1505
+ * inclusive. A value of null indicates that the segment extends to the end of
1506
+ * the resource.
1507
+ * @return {?number}
1508
+ */
1509
+ shaka.media.SegmentReference.prototype.getEndByte = function() {};
1479
1510
  /**
1480
1511
  * Creates a SegmentIndex.
1481
1512
  * @param {!Array.<!shaka.media.SegmentReference>} references The list of
@@ -2546,6 +2577,10 @@ shaka.ui.Controls.prototype.configure = function(config) {};
2546
2577
  * @param {boolean} enabled
2547
2578
  */
2548
2579
  shaka.ui.Controls.prototype.setEnabledShakaControls = function(enabled) {};
2580
+ /**
2581
+ * @param {boolean} seeking
2582
+ */
2583
+ shaka.ui.Controls.prototype.setSeeking = function(seeking) {};
2549
2584
  /**
2550
2585
  * Enable or disable native browser controls. Enabling disables shaka
2551
2586
  * controls.
@@ -2560,6 +2595,8 @@ shaka.ui.Controls.prototype.getCastProxy = function() {};
2560
2595
  * @return {shaka.ui.Localization}
2561
2596
  */
2562
2597
  shaka.ui.Controls.prototype.getLocalization = function() {};
2598
+ /** */
2599
+ shaka.ui.Controls.prototype.toggleFullScreen = function() {};
2563
2600
  /**
2564
2601
  * @return {!HTMLElement}
2565
2602
  */
@@ -2638,9 +2675,41 @@ shaka.ui.OverflowMenu = class extends shaka.ui.Element {
2638
2675
  };
2639
2676
  /**
2640
2677
  * @extends {shaka.ui.Element}
2678
+ */
2679
+ shaka.ui.SettingsMenu = class extends shaka.ui.Element {
2680
+ /**
2681
+ * @param {!HTMLElement} parent
2682
+ * @param {!shaka.ui.Controls} controls
2683
+ * @param {string} iconText
2684
+ */
2685
+ constructor(parent,controls,iconText) {}
2686
+ };
2687
+ /**
2688
+ * @extends {shaka.ui.SettingsMenu}
2689
+ * @final
2690
+ */
2691
+ shaka.ui.AudioLanguageSelection = class extends shaka.ui.SettingsMenu {
2692
+ /**
2693
+ * @param {!HTMLElement} parent
2694
+ * @param {!shaka.ui.Controls} controls
2695
+ */
2696
+ constructor(parent,controls) {}
2697
+ };
2698
+ /**
2699
+ * @extends {shaka.ui.Element}
2700
+ */
2701
+ shaka.ui.PlayButton = class extends shaka.ui.Element {
2702
+ /**
2703
+ * @param {!HTMLElement} parent
2704
+ * @param {!shaka.ui.Controls} controls
2705
+ */
2706
+ constructor(parent,controls) {}
2707
+ };
2708
+ /**
2709
+ * @extends {shaka.ui.PlayButton}
2641
2710
  * @final
2642
2711
  */
2643
- shaka.ui.AudioLanguageSelection = class extends shaka.ui.Element {
2712
+ shaka.ui.BigPlayButton = class extends shaka.ui.PlayButton {
2644
2713
  /**
2645
2714
  * @param {!HTMLElement} parent
2646
2715
  * @param {!shaka.ui.Controls} controls
@@ -2706,7 +2775,7 @@ shaka.ui.PipButton = class extends shaka.ui.Element {
2706
2775
  * @extends {shaka.ui.Element}
2707
2776
  * @final
2708
2777
  */
2709
- shaka.ui.PlayPauseButton = class extends shaka.ui.Element {
2778
+ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
2710
2779
  /**
2711
2780
  * @param {!HTMLElement} parent
2712
2781
  * @param {!shaka.ui.Controls} controls
@@ -2714,10 +2783,10 @@ shaka.ui.PlayPauseButton = class extends shaka.ui.Element {
2714
2783
  constructor(parent,controls) {}
2715
2784
  };
2716
2785
  /**
2717
- * @extends {shaka.ui.Element}
2786
+ * @extends {shaka.ui.SettingsMenu}
2718
2787
  * @final
2719
2788
  */
2720
- shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
2789
+ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu {
2721
2790
  /**
2722
2791
  * @param {!HTMLElement} parent
2723
2792
  * @param {!shaka.ui.Controls} controls
@@ -2728,7 +2797,7 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
2728
2797
  * @extends {shaka.ui.Element}
2729
2798
  * @final
2730
2799
  */
2731
- shaka.ui.ResolutionSelection = class extends shaka.ui.Element {
2800
+ shaka.ui.RewindButton = class extends shaka.ui.Element {
2732
2801
  /**
2733
2802
  * @param {!HTMLElement} parent
2734
2803
  * @param {!shaka.ui.Controls} controls
@@ -2736,10 +2805,10 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.Element {
2736
2805
  constructor(parent,controls) {}
2737
2806
  };
2738
2807
  /**
2739
- * @extends {shaka.ui.Element}
2808
+ * @extends {shaka.ui.PlayButton}
2740
2809
  * @final
2741
2810
  */
2742
- shaka.ui.RewindButton = class extends shaka.ui.Element {
2811
+ shaka.ui.SmallPlayButton = class extends shaka.ui.PlayButton {
2743
2812
  /**
2744
2813
  * @param {!HTMLElement} parent
2745
2814
  * @param {!shaka.ui.Controls} controls
@@ -2790,10 +2859,10 @@ shaka.ui.TextDisplayer = class {
2790
2859
  setTextVisibility(on) {}
2791
2860
  };
2792
2861
  /**
2793
- * @extends {shaka.ui.Element}
2862
+ * @extends {shaka.ui.SettingsMenu}
2794
2863
  * @final
2795
2864
  */
2796
- shaka.ui.TextSelection = class extends shaka.ui.Element {
2865
+ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
2797
2866
  /**
2798
2867
  * @param {!HTMLElement} parent
2799
2868
  * @param {!shaka.ui.Controls} controls