shaka-player 4.2.3 → 4.3.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 (147) hide show
  1. package/.github/workflows/sync-labels.yaml +1 -1
  2. package/.github/workflows/update-issues.yaml +1 -1
  3. package/AUTHORS +5 -0
  4. package/CHANGELOG.md +85 -39
  5. package/CONTRIBUTORS +5 -0
  6. package/README.md +14 -0
  7. package/demo/common/assets.js +58 -0
  8. package/demo/common/message_ids.js +22 -1
  9. package/demo/config.js +89 -5
  10. package/demo/demo.less +7 -1
  11. package/demo/index.html +8 -1
  12. package/demo/locales/en.json +21 -1
  13. package/demo/locales/source.json +82 -2
  14. package/demo/main.js +57 -1
  15. package/demo/search.js +2 -0
  16. package/demo/visualizer.js +337 -0
  17. package/demo/visualizer_button.js +103 -0
  18. package/dist/controls.css +1 -1
  19. package/dist/controls.css.map +1 -1
  20. package/dist/demo.compiled.debug.js +83 -58
  21. package/dist/demo.compiled.debug.map +4 -4
  22. package/dist/demo.compiled.js +83 -58
  23. package/dist/demo.compiled.map +4 -4
  24. package/dist/demo.css +1 -1
  25. package/dist/demo.css.map +1 -1
  26. package/dist/deps.js +18 -11
  27. package/dist/locales.js +32 -32
  28. package/dist/receiver.compiled.debug.js +23 -19
  29. package/dist/receiver.compiled.debug.map +3 -3
  30. package/dist/receiver.compiled.js +23 -19
  31. package/dist/receiver.compiled.map +3 -3
  32. package/dist/shaka-player.compiled.d.ts +178 -27
  33. package/dist/shaka-player.compiled.debug.d.ts +178 -27
  34. package/dist/shaka-player.compiled.debug.externs.js +163 -32
  35. package/dist/shaka-player.compiled.debug.js +488 -422
  36. package/dist/shaka-player.compiled.debug.map +4 -4
  37. package/dist/shaka-player.compiled.externs.js +163 -32
  38. package/dist/shaka-player.compiled.js +895 -857
  39. package/dist/shaka-player.compiled.map +4 -4
  40. package/dist/shaka-player.ui.d.ts +178 -27
  41. package/dist/shaka-player.ui.debug.d.ts +178 -27
  42. package/dist/shaka-player.ui.debug.externs.js +163 -32
  43. package/dist/shaka-player.ui.debug.js +519 -450
  44. package/dist/shaka-player.ui.debug.map +4 -4
  45. package/dist/shaka-player.ui.externs.js +163 -32
  46. package/dist/shaka-player.ui.js +1053 -1015
  47. package/dist/shaka-player.ui.map +4 -4
  48. package/docs/design/lcevc-architecture.png +0 -0
  49. package/docs/design/lcevc-demo.png +0 -0
  50. package/docs/design/lcevc-integration.md +72 -0
  51. package/docs/tutorials/fairplay.md +7 -0
  52. package/docs/tutorials/faq.md +1 -1
  53. package/docs/tutorials/ui.md +7 -7
  54. package/docs/tutorials/upgrade.md +6 -0
  55. package/externs/ima.js +13 -1
  56. package/externs/lcevc.js +81 -0
  57. package/externs/mux.js +4 -42
  58. package/externs/shaka/ads.js +11 -1
  59. package/externs/shaka/manifest_parser.js +5 -1
  60. package/externs/shaka/player.js +178 -15
  61. package/lib/abr/simple_abr_manager.js +7 -0
  62. package/lib/ads/ad_manager.js +0 -8
  63. package/lib/ads/client_side_ad.js +15 -0
  64. package/lib/ads/client_side_ad_manager.js +21 -8
  65. package/lib/ads/server_side_ad.js +15 -0
  66. package/lib/ads/server_side_ad_manager.js +3 -3
  67. package/lib/cast/cast_proxy.js +2 -1
  68. package/lib/cast/cast_receiver.js +19 -5
  69. package/lib/cast/cast_sender.js +2 -1
  70. package/lib/cast/cast_utils.js +18 -6
  71. package/lib/cea/dummy_cea_parser.js +28 -0
  72. package/lib/cea/i_cea_parser.js +14 -2
  73. package/lib/cea/mp4_cea_parser.js +87 -5
  74. package/lib/config/auto_show_text.js +33 -0
  75. package/lib/dash/dash_parser.js +1 -1
  76. package/lib/hls/hls_parser.js +799 -376
  77. package/lib/lcevc/lcevc_dil.js +152 -0
  78. package/lib/media/closed_caption_parser.js +9 -6
  79. package/lib/media/drm_engine.js +14 -6
  80. package/lib/media/media_source_engine.js +112 -26
  81. package/lib/media/playhead.js +23 -1
  82. package/lib/media/presentation_timeline.js +26 -11
  83. package/lib/media/segment_reference.js +49 -1
  84. package/lib/media/streaming_engine.js +145 -24
  85. package/lib/media/transmuxer.js +79 -18
  86. package/lib/offline/storage.js +1 -0
  87. package/lib/player.js +477 -85
  88. package/lib/polyfill/patchedmediakeys_apple.js +55 -1
  89. package/lib/text/ui_text_displayer.js +5 -5
  90. package/lib/text/vtt_text_parser.js +35 -1
  91. package/lib/util/dom_utils.js +0 -1
  92. package/lib/util/error.js +17 -0
  93. package/lib/util/fake_event.js +2 -0
  94. package/lib/util/id3_utils.js +300 -0
  95. package/lib/util/manifest_parser_utils.js +4 -0
  96. package/lib/util/mime_utils.js +3 -6
  97. package/lib/util/mp4_box_parsers.js +15 -5
  98. package/lib/util/platform.js +9 -1
  99. package/lib/util/player_configuration.js +23 -1
  100. package/lib/util/ts_parser.js +499 -0
  101. package/maintained-branches.md +2 -2
  102. package/package.json +4 -1
  103. package/roadmap.md +27 -7
  104. package/test/ads/ad_manager_unit.js +180 -29
  105. package/test/cast/cast_receiver_integration.js +97 -16
  106. package/test/cast/cast_receiver_unit.js +17 -12
  107. package/test/cast/cast_utils_unit.js +4 -1
  108. package/test/dash/dash_parser_content_protection_unit.js +1 -0
  109. package/test/dash/dash_parser_live_unit.js +1 -0
  110. package/test/dash/dash_parser_manifest_unit.js +93 -1
  111. package/test/dash/dash_parser_segment_base_unit.js +1 -0
  112. package/test/dash/dash_parser_segment_list_unit.js +1 -0
  113. package/test/dash/dash_parser_segment_template_unit.js +1 -0
  114. package/test/demo/demo_unit.js +2 -1
  115. package/test/hls/hls_live_unit.js +253 -19
  116. package/test/hls/hls_parser_unit.js +500 -12
  117. package/test/media/closed_caption_parser_unit.js +2 -1
  118. package/test/media/drm_engine_integration.js +3 -1
  119. package/test/media/media_source_engine_integration.js +102 -6
  120. package/test/media/media_source_engine_unit.js +10 -5
  121. package/test/media/playhead_unit.js +41 -0
  122. package/test/media/streaming_engine_integration.js +17 -1
  123. package/test/media/streaming_engine_unit.js +180 -24
  124. package/test/media/transmuxer_integration.js +21 -10
  125. package/test/player_integration.js +224 -82
  126. package/test/player_unit.js +92 -2
  127. package/test/polyfill/patchedmediakeys_apple_unit.js +124 -0
  128. package/test/test/assets/id3-metadata.aac +0 -0
  129. package/test/test/assets/id3-metadata.ts +0 -0
  130. package/test/test/assets/thumbnails-sprites.vtt +10 -0
  131. package/test/test/assets/thumbnails.vtt +10 -0
  132. package/test/test/util/dash_parser_util.js +2 -0
  133. package/test/test/util/fake_ad.js +21 -0
  134. package/test/test/util/fake_media_source_engine.js +7 -0
  135. package/test/test/util/id3_generator.js +100 -0
  136. package/test/test/util/manifest_generator.js +3 -6
  137. package/test/test/util/simple_fakes.js +7 -0
  138. package/test/test/util/stream_generator.js +38 -0
  139. package/test/test/util/test_scheme.js +43 -14
  140. package/test/text/vtt_text_parser_unit.js +11 -0
  141. package/test/ui/text_displayer_layout_unit.js +14 -0
  142. package/test/util/id3_utils_unit.js +116 -0
  143. package/test/util/ts_parser_unit.js +77 -0
  144. package/ui/controls.js +4 -1
  145. package/ui/less/containers.less +7 -0
  146. package/ui/settings_menu.js +11 -2
  147. package/ui/ui.js +43 -4
@@ -437,20 +437,63 @@ shaka.extern.DrmSupportType;
437
437
  */
438
438
  shaka.extern.SupportType;
439
439
 
440
-
441
440
  /**
442
- * @typedef {!Object.<string, ?>}
441
+ * @typedef {{
442
+ * cueTime: ?number,
443
+ * data: !Uint8Array,
444
+ * frames: !Array.<shaka.extern.MetadataFrame>,
445
+ * dts: ?number,
446
+ * pts: ?number
447
+ * }}
443
448
  *
444
449
  * @description
445
450
  * ID3 metadata in format defined by
446
451
  * https://id3.org/id3v2.3.0#Declared_ID3v2_frames
447
452
  * The content of the field.
448
453
  *
454
+ * @property {?number} cueTime
455
+ * @property {!Uint8Array} data
456
+ * @property {!Array.<shaka.extern.MetadataFrame>} frames
457
+ * @property {?number} dts
458
+ * @property {?number} pts
459
+ *
449
460
  * @exportDoc
450
461
  */
451
462
  shaka.extern.ID3Metadata;
452
463
 
453
464
 
465
+ /**
466
+ * @typedef {{
467
+ * type: string,
468
+ * size: number,
469
+ * data: Uint8Array
470
+ * }}
471
+ *
472
+ * @description metadata raw frame.
473
+ * @property {string} type
474
+ * @property {number} size
475
+ * @property {Uint8Array} data
476
+ * @exportDoc
477
+ */
478
+ shaka.extern.MetadataRawFrame;
479
+
480
+
481
+ /**
482
+ * @typedef {{
483
+ * key: string,
484
+ * data: (ArrayBuffer|string),
485
+ * description: string
486
+ * }}
487
+ *
488
+ * @description metadata frame parsed.
489
+ * @property {string} key
490
+ * @property {ArrayBuffer|string} data
491
+ * @property {string} description
492
+ * @exportDoc
493
+ */
494
+ shaka.extern.MetadataFrame;
495
+
496
+
454
497
  /**
455
498
  * @typedef {{
456
499
  * schemeIdUri: string,
@@ -565,6 +608,24 @@ shaka.extern.MediaQualityInfo;
565
608
  shaka.extern.EmsgInfo;
566
609
 
567
610
 
611
+ /**
612
+ * @typedef {{
613
+ * wallClockTime: number,
614
+ * programStartDate: Date
615
+ * }}
616
+ *
617
+ * @description
618
+ * Contains information about an PRFT MP4 box.
619
+ *
620
+ * @property {number} wallClockTime
621
+ * A UTC timestamp corresponding to decoding time in milliseconds.
622
+ * @property {Date} programStartDate
623
+ * The derived start date of the program.
624
+ * @exportDoc
625
+ */
626
+ shaka.extern.ProducerReferenceTime;
627
+
628
+
568
629
  /**
569
630
  * @typedef {{
570
631
  * distinctiveIdentifierRequired: boolean,
@@ -645,7 +706,7 @@ shaka.extern.AdvancedDrmConfiguration;
645
706
  * <code>{'com.widevine.alpha': 'https://example.com/drm'}</code>.
646
707
  * @property {!Object.<string, string>} clearKeys
647
708
  * <i>Forces the use of the Clear Key CDM.</i>
648
- * A map of key IDs (hex) to keys (hex).
709
+ * A map of key IDs (hex or base64) to keys (hex or base64).
649
710
  * @property {boolean} delayLicenseRequestUntilPlayed
650
711
  * <i>Defaults to false.</i> <br>
651
712
  * True to configure drm to delay sending a license request until a user
@@ -700,7 +761,8 @@ shaka.extern.DrmConfiguration;
700
761
  * ignoreEmptyAdaptationSet: boolean,
701
762
  * ignoreMaxSegmentDuration: boolean,
702
763
  * keySystemsByURI: !Object.<string, string>,
703
- * manifestPreprocessor: function(!Element)
764
+ * manifestPreprocessor: function(!Element),
765
+ * sequenceMode: boolean
704
766
  * }}
705
767
  *
706
768
  * @property {string} clockSyncUri
@@ -754,6 +816,10 @@ shaka.extern.DrmConfiguration;
754
816
  * Called immediately after the DASH manifest has been parsed into an
755
817
  * XMLDocument. Provides a way for applications to perform efficient
756
818
  * preprocessing of the manifest.
819
+ * @property {boolean} sequenceMode
820
+ * If true, the media segments are appended to the SourceBuffer in
821
+ * "sequence mode" (ignoring their internal timestamps).
822
+ * <i>Defaults to <code>false</code>.</i>
757
823
  * @exportDoc
758
824
  */
759
825
  shaka.extern.DashManifestConfiguration;
@@ -766,7 +832,9 @@ shaka.extern.DashManifestConfiguration;
766
832
  * defaultAudioCodec: string,
767
833
  * defaultVideoCodec: string,
768
834
  * ignoreManifestProgramDateTime: boolean,
769
- * mediaPlaylistFullMimeType: string
835
+ * mediaPlaylistFullMimeType: string,
836
+ * useSafariBehaviorForLive: boolean,
837
+ * liveSegmentsDelay: number
770
838
  * }}
771
839
  *
772
840
  * @property {boolean} ignoreTextStreamFailures
@@ -797,6 +865,16 @@ shaka.extern.DashManifestConfiguration;
797
865
  * format this value.
798
866
  * <i>Defaults to
799
867
  * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
868
+ * @property {boolean} useSafariBehaviorForLive
869
+ * If this is true, playback will set the availability window to the
870
+ * presentation delay. The player will be able to buffer ahead three
871
+ * segments, but the seek window will be zero-sized, to be consistent with
872
+ * Safari. If this is false, the seek window will be the entire duration.
873
+ * <i>Defaults to <code>true</code>.</i>
874
+ * @property {number} liveSegmentsDelay
875
+ * The default presentation delay will be calculated as a number of segments.
876
+ * This is the number of segments for this calculation..
877
+ * <i>Defaults to <code>3</code>.</i>
800
878
  * @exportDoc
801
879
  */
802
880
  shaka.extern.HlsManifestConfiguration;
@@ -869,7 +947,7 @@ shaka.extern.ManifestConfiguration;
869
947
  * startAtSegmentBoundary: boolean,
870
948
  * gapDetectionThreshold: number,
871
949
  * durationBackoff: number,
872
- * forceTransmuxTS: boolean,
950
+ * forceTransmux: boolean,
873
951
  * safeSeekOffset: number,
874
952
  * stallEnabled: boolean,
875
953
  * stallThreshold: number,
@@ -883,7 +961,8 @@ shaka.extern.ManifestConfiguration;
883
961
  * updateIntervalSeconds: number,
884
962
  * dispatchAllEmsgBoxes: boolean,
885
963
  * observeQualityChanges: boolean,
886
- * maxDisabledTime: number
964
+ * maxDisabledTime: number,
965
+ * parsePrftBox: boolean
887
966
  * }}
888
967
  *
889
968
  * @description
@@ -931,12 +1010,12 @@ shaka.extern.ManifestConfiguration;
931
1010
  * seek to when the user tries to seek to or start playback at the duration.
932
1011
  * To disable this behavior, the config can be set to 0. We recommend using
933
1012
  * the default value unless you have a good reason not to.
934
- * @property {boolean} forceTransmuxTS
935
- * If this is <code>true</code>, we will transmux TS content even if not
936
- * strictly necessary for the assets to be played. Shaka Player currently
937
- * only supports CEA 708 captions by transmuxing, so this value is necessary
938
- * for enabling them on platforms with native TS support like Edge or
939
- * Chromecast. This value defaults to <code>false</code>.
1013
+ * @property {boolean} forceTransmux
1014
+ * If this is <code>true</code>, we will transmux AAC and TS content even if
1015
+ * not strictly necessary for the assets to be played. Shaka Player
1016
+ * currently only supports CEA 708 captions by transmuxing, so this value is
1017
+ * necessary for enabling them on platforms with native TS support like Edge
1018
+ * or Chromecast. This value defaults to <code>false</code>.
940
1019
  * @property {number} safeSeekOffset
941
1020
  * The amount of seconds that should be added when repositioning the playhead
942
1021
  * after falling out of the availability window or seek. This gives the player
@@ -992,11 +1071,35 @@ shaka.extern.ManifestConfiguration;
992
1071
  * The maximum time a variant can be disabled when NETWORK HTTP_ERROR
993
1072
  * is reached, in seconds.
994
1073
  * If all variants are disabled this way, NETWORK HTTP_ERROR will be thrown.
1074
+ * @property {boolean} parsePrftBox
1075
+ * If <code>true</code>, will raise a shaka.extern.ProducerReferenceTime
1076
+ * player event (event name 'prft').
1077
+ * The event will be raised only once per playback session as program
1078
+ * start date will not change, and would save parsing the segment multiple
1079
+ * times needlessly.
1080
+ * Defaults to <code>false</code>.
995
1081
  * @exportDoc
996
1082
  */
997
1083
  shaka.extern.StreamingConfiguration;
998
1084
 
999
1085
 
1086
+ /**
1087
+ * @typedef {{
1088
+ * sourceBufferExtraFeatures: string
1089
+ * }}
1090
+ *
1091
+ * @description
1092
+ * Media source configuration.
1093
+ *
1094
+ * @property {string} sourceBufferExtraFeatures
1095
+ * Some platforms may need to pass features when initializing the
1096
+ * sourceBuffer.
1097
+ * This string is ultimately appended to MIME types in addSourceBuffer().
1098
+ * @exportDoc
1099
+ */
1100
+ shaka.extern.MediaSourceConfiguration;
1101
+
1102
+
1000
1103
  /**
1001
1104
  * @typedef {{
1002
1105
  * enabled: boolean,
@@ -1008,6 +1111,7 @@ shaka.extern.StreamingConfiguration;
1008
1111
  * bandwidthDowngradeTarget: number,
1009
1112
  * advanced: shaka.extern.AdvancedAbrConfiguration,
1010
1113
  * restrictToElementSize: boolean,
1114
+ * restrictToScreenSize: boolean,
1011
1115
  * ignoreDevicePixelRatio: boolean
1012
1116
  * }}
1013
1117
  *
@@ -1043,9 +1147,12 @@ shaka.extern.StreamingConfiguration;
1043
1147
  * Note: The use of ResizeObserver is required for it to work properly. If
1044
1148
  * true without ResizeObserver, it behaves as false.
1045
1149
  * Defaults false.
1150
+ * @property {boolean} restrictToScreenSize
1151
+ * If true, restrict the quality to screen size.
1152
+ * Defaults false.
1046
1153
  * @property {boolean} ignoreDevicePixelRatio
1047
1154
  * If true,device pixel ratio is ignored when restricting the quality to
1048
- * media element size.
1155
+ * media element size or screen size.
1049
1156
  * Defaults false.
1050
1157
  * @exportDoc
1051
1158
  */
@@ -1114,6 +1221,49 @@ shaka.extern.AdvancedAbrConfiguration;
1114
1221
  */
1115
1222
  shaka.extern.CmcdConfiguration;
1116
1223
 
1224
+ /**
1225
+ * @typedef {{
1226
+ * enabled: boolean,
1227
+ * dynamicPerformanceScaling: boolean,
1228
+ * logLevel: number,
1229
+ * drawLogo: boolean
1230
+ * }}
1231
+ *
1232
+ * @description
1233
+ * Decoding for MPEG-5 Part2 LCEVC.
1234
+ *
1235
+ * @property {boolean} enabled
1236
+ * If <code>true</code>, enable LCEVC.
1237
+ * Defaults to <code>false</code>.
1238
+ * @property {boolean} dynamicPerformanceScaling
1239
+ * If <code>true</code>, LCEVC Dynamic Performance Scaling or dps is enabled
1240
+ * to be triggered, when the system is not able to decode frames within a
1241
+ * specific tolerance of the fps of the video and disables LCEVC decoding
1242
+ * for some time. The base video will be shown upscaled to target resolution.
1243
+ * If it is triggered again within a short period of time, the disabled
1244
+ * time will be higher and if it is triggered three times in a row the LCEVC
1245
+ * decoding will be disabled for that playback session.
1246
+ * If dynamicPerformanceScaling is false, LCEVC decode will be forced
1247
+ * and will drop frames appropriately if performance is sub optimal.
1248
+ * Defaults to <code>true</code>.
1249
+ * @property {number} logLevel
1250
+ * Loglevel 0-5 for logging.
1251
+ * NONE = 0
1252
+ * ERROR = 1
1253
+ * WARNING = 2
1254
+ * INFO = 3
1255
+ * DEBUG = 4
1256
+ * VERBOSE = 5
1257
+ * Defaults to <code>0</code>.
1258
+ * @property {boolean} drawLogo
1259
+ * If <code>true</code>, LCEVC Logo is placed on the top left hand corner
1260
+ * which only appears when the LCEVC enhanced frames are being rendered.
1261
+ * Defaults to true for the lib but is forced to false in this integration
1262
+ * unless explicitly set to true through config.
1263
+ * Defaults to <code>false</code>.
1264
+ * @exportDoc
1265
+ */
1266
+ shaka.extern.LcevcConfiguration;
1117
1267
 
1118
1268
  /**
1119
1269
  * @typedef {{
@@ -1157,12 +1307,15 @@ shaka.extern.OfflineConfiguration;
1157
1307
 
1158
1308
  /**
1159
1309
  * @typedef {{
1310
+ * autoShowText: shaka.config.AutoShowText,
1160
1311
  * drm: shaka.extern.DrmConfiguration,
1161
1312
  * manifest: shaka.extern.ManifestConfiguration,
1162
1313
  * streaming: shaka.extern.StreamingConfiguration,
1314
+ * mediaSource: shaka.extern.MediaSourceConfiguration,
1163
1315
  * abrFactory: shaka.extern.AbrManager.Factory,
1164
1316
  * abr: shaka.extern.AbrConfiguration,
1165
1317
  * cmcd: shaka.extern.CmcdConfiguration,
1318
+ * lcevc: shaka.extern.LcevcConfiguration,
1166
1319
  * offline: shaka.extern.OfflineConfiguration,
1167
1320
  * preferredAudioLanguage: string,
1168
1321
  * preferredTextLanguage: string,
@@ -1179,18 +1332,25 @@ shaka.extern.OfflineConfiguration;
1179
1332
  * textDisplayFactory: shaka.extern.TextDisplayer.Factory
1180
1333
  * }}
1181
1334
  *
1335
+ * @property {shaka.config.AutoShowText} autoShowText
1336
+ * Controls behavior of auto-showing text tracks on load().
1182
1337
  * @property {shaka.extern.DrmConfiguration} drm
1183
1338
  * DRM configuration and settings.
1184
1339
  * @property {shaka.extern.ManifestConfiguration} manifest
1185
1340
  * Manifest configuration and settings.
1186
1341
  * @property {shaka.extern.StreamingConfiguration} streaming
1187
1342
  * Streaming configuration and settings.
1343
+ * @property {shaka.extern.MediaSourceConfiguration} mediaSource
1344
+ * Media source configuration and settings.
1188
1345
  * @property {shaka.extern.AbrManager.Factory} abrFactory
1189
1346
  * A factory to construct an abr manager.
1190
1347
  * @property {shaka.extern.AbrConfiguration} abr
1191
1348
  * ABR configuration and settings.
1192
1349
  * @property {shaka.extern.CmcdConfiguration} cmcd
1193
1350
  * CMCD configuration and settings. (Common Media Client Data)
1351
+ * @property {shaka.extern.LcevcConfiguration} lcevc
1352
+ * MPEG-5 LCEVC configuration and settings.
1353
+ * (Low Complexity Enhancement Video Codec)
1194
1354
  * @property {shaka.extern.OfflineConfiguration} offline
1195
1355
  * Offline configuration and settings.
1196
1356
  * @property {string} preferredAudioLanguage
@@ -1268,7 +1428,8 @@ shaka.extern.LanguageRole;
1268
1428
  * startTime: number,
1269
1429
  * duration: number,
1270
1430
  * uris: !Array.<string>,
1271
- * width: number
1431
+ * width: number,
1432
+ * sprite: boolean
1272
1433
  * }}
1273
1434
  *
1274
1435
  * @property {number} imageHeight
@@ -1292,6 +1453,8 @@ shaka.extern.LanguageRole;
1292
1453
  * given.
1293
1454
  * @property {number} width
1294
1455
  * The thumbnail width in px.
1456
+ * @property {boolean} sprite
1457
+ * Indicate if the thumbnail is a sprite.
1295
1458
  * @exportDoc
1296
1459
  */
1297
1460
  shaka.extern.Thumbnail;
@@ -148,6 +148,13 @@ shaka.abr.SimpleAbrManager = class {
148
148
  let maxHeight = Infinity;
149
149
  let maxWidth = Infinity;
150
150
 
151
+ if (this.config_.restrictToScreenSize) {
152
+ const devicePixelRatio =
153
+ this.config_.ignoreDevicePixelRatio ? 1 : window.devicePixelRatio;
154
+ maxHeight = window.screen.height * devicePixelRatio;
155
+ maxWidth = window.screen.width * devicePixelRatio;
156
+ }
157
+
151
158
  if (this.resizeObserver_ && this.config_.restrictToElementSize) {
152
159
  const devicePixelRatio =
153
160
  this.config_.ignoreDevicePixelRatio ? 1 : window.devicePixelRatio;
@@ -640,10 +640,6 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
640
640
  onHlsTimedMetadata(metadata, timestamp) {
641
641
  if (this.ssAdManager_) {
642
642
  this.ssAdManager_.onTimedMetadata('ID3', metadata['data'], timestamp);
643
- } else {
644
- shaka.log.warning('ID3 metadata processing was called without ' +
645
- 'initializing server side ad logic. Ad-related metadata will ' +
646
- 'not take effect');
647
643
  }
648
644
  }
649
645
 
@@ -654,10 +650,6 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
654
650
  onCueMetadataChange(value) {
655
651
  if (this.ssAdManager_) {
656
652
  this.ssAdManager_.onCueMetadataChange(value);
657
- } else {
658
- shaka.log.warning('ID3 metadata processing was called without ' +
659
- 'initializing server side ad logic. Ad-related metadata will ' +
660
- 'not take effect');
661
653
  }
662
654
  }
663
655
  };
@@ -236,6 +236,21 @@ shaka.ads.ClientSideAd = class {
236
236
  return podInfo.getAdPosition();
237
237
  }
238
238
 
239
+ /**
240
+ * @override
241
+ * @export
242
+ */
243
+ getTitle() {
244
+ return this.ad_.getTitle();
245
+ }
246
+
247
+ /**
248
+ * @override
249
+ * @export
250
+ */
251
+ getDescription() {
252
+ return this.ad_.getDescription();
253
+ }
239
254
 
240
255
  /**
241
256
  * @override
@@ -323,22 +323,25 @@ shaka.ads.ClientSideAdManager = class {
323
323
 
324
324
  this.eventManager_.listen(this.imaAdsManager_,
325
325
  google.ima.AdEvent.Type.PAUSED, (e) => {
326
- goog.asserts.assert(this.ad_ != null, 'Ad should not be null!');
327
- this.ad_.setPaused(true);
328
- convertEventAndSend(e, shaka.ads.AdManager.AD_PAUSED);
326
+ if (this.ad_) {
327
+ this.ad_.setPaused(true);
328
+ convertEventAndSend(e, shaka.ads.AdManager.AD_PAUSED);
329
+ }
329
330
  });
330
331
 
331
332
  this.eventManager_.listen(this.imaAdsManager_,
332
333
  google.ima.AdEvent.Type.RESUMED, (e) => {
333
- goog.asserts.assert(this.ad_ != null, 'Ad should not be null!');
334
- this.ad_.setPaused(false);
335
- convertEventAndSend(e, shaka.ads.AdManager.AD_RESUMED);
334
+ if (this.ad_) {
335
+ this.ad_.setPaused(false);
336
+ convertEventAndSend(e, shaka.ads.AdManager.AD_RESUMED);
337
+ }
336
338
  });
337
339
 
338
340
  this.eventManager_.listen(this.imaAdsManager_,
339
341
  google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED, (e) => {
340
- goog.asserts.assert(this.ad_ != null, 'Ad should not be null!');
341
- convertEventAndSend(e, shaka.ads.AdManager.AD_SKIP_STATE_CHANGED);
342
+ if (this.ad_) {
343
+ convertEventAndSend(e, shaka.ads.AdManager.AD_SKIP_STATE_CHANGED);
344
+ }
342
345
  });
343
346
 
344
347
  this.eventManager_.listen(this.imaAdsManager_,
@@ -416,6 +419,16 @@ shaka.ads.ClientSideAdManager = class {
416
419
  'Should have an ads manager at this point!');
417
420
 
418
421
  const imaAd = e.getAd();
422
+ if (!imaAd) {
423
+ // Sometimes the IMA SDK will fire a CONTENT_PAUSE_REQUESTED or STARTED
424
+ // event with no associated ad object.
425
+ // We can't really play an ad in that situation, so just ignore the event.
426
+ shaka.log.alwaysWarn(
427
+ 'The IMA SDK fired a ' + e.type + ' event with no associated ad. ' +
428
+ 'Unable to play ad!');
429
+ return;
430
+ }
431
+
419
432
  this.ad_ = new shaka.ads.ClientSideAd(imaAd,
420
433
  this.imaAdsManager_, this.video_);
421
434
  const data = new Map()
@@ -205,6 +205,21 @@ shaka.ads.ServerSideAd = class {
205
205
  return podInfo.getAdPosition();
206
206
  }
207
207
 
208
+ /**
209
+ * @override
210
+ * @export
211
+ */
212
+ getTitle() {
213
+ return this.ad_.getTitle();
214
+ }
215
+
216
+ /**
217
+ * @override
218
+ * @export
219
+ */
220
+ getDescription() {
221
+ return this.ad_.getDescription();
222
+ }
208
223
 
209
224
  /**
210
225
  * @override
@@ -237,7 +237,7 @@ shaka.ads.ServerSideAdManager = class {
237
237
  }
238
238
 
239
239
  /**
240
- * @param {shaka.extern.ID3Metadata} value
240
+ * @param {shaka.extern.MetadataFrame} value
241
241
  */
242
242
  onCueMetadataChange(value) {
243
243
  // Native HLS over Safari/iOS/iPadOS
@@ -246,9 +246,9 @@ shaka.ads.ServerSideAdManager = class {
246
246
  // done through timed metadata. Timed metadata is carried as part of the
247
247
  // DAI stream content and carries ad break timing information used by the
248
248
  // SDK to track ad breaks.
249
- if (value['key'] && value['data']) {
249
+ if (value.key && value.data) {
250
250
  const metadata = {};
251
- metadata[value['key']] = value['data'];
251
+ metadata[value.key] = value.data;
252
252
  this.streamManager_.onTimedMetadata(metadata);
253
253
  }
254
254
  }
@@ -705,7 +705,8 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
705
705
  // If we are casting, but the first update has not come in yet, use local
706
706
  // getters, but not local methods.
707
707
  if (this.sender_.isCasting() && !this.sender_.hasRemoteProperties()) {
708
- if (shaka.cast.CastUtils.PlayerGetterMethods[name]) {
708
+ if (shaka.cast.CastUtils.PlayerGetterMethods[name] ||
709
+ shaka.cast.CastUtils.LargePlayerGetterMethods[name]) {
709
710
  const value = /** @type {Object} */(this.localPlayer_)[name];
710
711
  goog.asserts.assert(typeof value == 'function',
711
712
  'only methods on Player');
@@ -518,6 +518,25 @@ shaka.cast.CastReceiver = class extends shaka.util.FakeEventTarget {
518
518
  update['video']['muted'] = systemVolume.muted;
519
519
  }
520
520
 
521
+ this.sendMessage_({
522
+ 'type': 'update',
523
+ 'update': update,
524
+ }, this.shakaBus_);
525
+
526
+ // Getters with large outputs each get sent in their own update message.
527
+ for (const name in shaka.cast.CastUtils.LargePlayerGetterMethods) {
528
+ const frequency = shaka.cast.CastUtils.LargePlayerGetterMethods[name];
529
+ if (this.updateNumber_ % frequency == 0) {
530
+ const update = {'player': {}};
531
+ update['player'][name] = /** @type {Object} */ (this.player_)[name]();
532
+
533
+ this.sendMessage_({
534
+ 'type': 'update',
535
+ 'update': update,
536
+ }, this.shakaBus_);
537
+ }
538
+ }
539
+
521
540
  // Only start progressing the update number once data is loaded,
522
541
  // just in case any of the "rarely changing" properties with less frequent
523
542
  // update messages changes significantly during the loading process.
@@ -525,11 +544,6 @@ shaka.cast.CastReceiver = class extends shaka.util.FakeEventTarget {
525
544
  this.updateNumber_ += 1;
526
545
  }
527
546
 
528
- this.sendMessage_({
529
- 'type': 'update',
530
- 'update': update,
531
- }, this.shakaBus_);
532
-
533
547
  this.maybeSendMediaInfoMessage_();
534
548
  }
535
549
 
@@ -370,7 +370,8 @@ shaka.cast.CastSender = class {
370
370
  return (...args) =>
371
371
  this.remoteAsyncCall_(targetName, property, ...args);
372
372
  }
373
- if (CastUtils.PlayerGetterMethods[property]) {
373
+ if (CastUtils.PlayerGetterMethods[property] ||
374
+ CastUtils.LargePlayerGetterMethods[property]) {
374
375
  return () => this.propertyGetter_(targetName, property);
375
376
  }
376
377
  }
@@ -307,9 +307,6 @@ shaka.cast.CastUtils.PlayerGetterMethods = {
307
307
  'getAudioLanguagesAndRoles': 4,
308
308
  'getBufferFullness': 1,
309
309
  'getBufferedInfo': 2,
310
- // NOTE: The 'getSharedConfiguration' property is not proxied as it would
311
- // not be possible to share a reference.
312
- 'getConfiguration': 4,
313
310
  'getExpiration': 2,
314
311
  'getKeyStatuses': 2,
315
312
  // NOTE: The 'getManifest' property is not proxied, as it is very large.
@@ -318,9 +315,6 @@ shaka.cast.CastUtils.PlayerGetterMethods = {
318
315
  'getPlaybackRate': 2,
319
316
  'getTextLanguages': 4,
320
317
  'getTextLanguagesAndRoles': 4,
321
- 'getTextTracks': 2,
322
- 'getStats': 5,
323
- 'getVariantTracks': 2,
324
318
  'getImageTracks': 2,
325
319
  'getThumbnails': 2,
326
320
  'isAudioOnly': 10,
@@ -334,6 +328,22 @@ shaka.cast.CastUtils.PlayerGetterMethods = {
334
328
  };
335
329
 
336
330
 
331
+ /**
332
+ * Player getter methods with data large enough to be sent in their own update
333
+ * messages, to reduce the size of each message. The format of this is
334
+ * identical to PlayerGetterMethods.
335
+ * @const {!Object.<string, number>}
336
+ */
337
+ shaka.cast.CastUtils.LargePlayerGetterMethods = {
338
+ // NOTE: The 'getSharedConfiguration' property is not proxied as it would
339
+ // not be possible to share a reference.
340
+ 'getConfiguration': 4,
341
+ 'getStats': 5,
342
+ 'getTextTracks': 2,
343
+ 'getVariantTracks': 2,
344
+ };
345
+
346
+
337
347
  /**
338
348
  * Player getter methods that are proxied while casting, but only when casting
339
349
  * a livestream.
@@ -374,6 +384,7 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
374
384
  shaka.cast.CastUtils.PlayerVoidMethods = [
375
385
  'addChaptersTrack',
376
386
  'addTextTrackAsync',
387
+ 'addThumbnailsTrack',
377
388
  'cancelTrickPlay',
378
389
  'configure',
379
390
  'getChapters',
@@ -398,6 +409,7 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
398
409
  */
399
410
  shaka.cast.CastUtils.PlayerPromiseMethods = [
400
411
  'attach',
412
+ 'attachCanvas',
401
413
  'detach',
402
414
  // The manifestFactory parameter of load is not supported.
403
415
  'load',
@@ -0,0 +1,28 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ goog.provide('shaka.cea.DummyCeaParser');
8
+
9
+ goog.require('shaka.cea.ICeaParser');
10
+
11
+ /**
12
+ * Dummy CEA parser.
13
+ * @implements {shaka.cea.ICeaParser}
14
+ */
15
+ shaka.cea.DummyCeaParser = class {
16
+ /**
17
+ * @override
18
+ */
19
+ init(initSegment) {
20
+ }
21
+
22
+ /**
23
+ * @override
24
+ */
25
+ parse(mediaSegment) {
26
+ return /* captionPackets= */ [];
27
+ }
28
+ };
@@ -26,10 +26,22 @@ shaka.cea.ICeaParser = class {
26
26
  };
27
27
 
28
28
  /**
29
- * NALU type for Supplemental Enhancement Information (SEI).
29
+ * NALU type for Supplemental Enhancement Information (SEI) for H.264.
30
30
  * @const {number}
31
31
  */
32
- shaka.cea.ICeaParser.NALU_TYPE_SEI = 0x06;
32
+ shaka.cea.ICeaParser.H264_NALU_TYPE_SEI = 0x06;
33
+
34
+ /**
35
+ * NALU type for Supplemental Enhancement Information (SEI) for H.265.
36
+ * @const {number}
37
+ */
38
+ shaka.cea.ICeaParser.H265_PREFIX_NALU_TYPE_SEI = 0x27;
39
+
40
+ /**
41
+ * NALU type for Supplemental Enhancement Information (SEI) for H.265.
42
+ * @const {number}
43
+ */
44
+ shaka.cea.ICeaParser.H265_SUFFIX_NALU_TYPE_SEI = 0x28;
33
45
 
34
46
  /**
35
47
  * Default timescale value for a track.