shaka-player 4.2.5 → 4.3.1

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 (143) hide show
  1. package/.github/workflows/build-and-test.yaml +7 -0
  2. package/.github/workflows/sync-labels.yaml +1 -1
  3. package/.github/workflows/update-issues.yaml +1 -1
  4. package/AUTHORS +4 -0
  5. package/CHANGELOG.md +114 -74
  6. package/CONTRIBUTORS +4 -0
  7. package/README.md +14 -0
  8. package/conditional/dummy_cast_proxy.js +120 -0
  9. package/demo/common/assets.js +58 -0
  10. package/demo/common/message_ids.js +22 -1
  11. package/demo/config.js +89 -5
  12. package/demo/demo.less +7 -1
  13. package/demo/index.html +8 -1
  14. package/demo/locales/en.json +21 -1
  15. package/demo/locales/source.json +82 -2
  16. package/demo/main.js +57 -1
  17. package/demo/search.js +2 -0
  18. package/demo/visualizer.js +337 -0
  19. package/demo/visualizer_button.js +103 -0
  20. package/dist/controls.css +1 -1
  21. package/dist/controls.css.map +1 -1
  22. package/dist/demo.compiled.debug.js +107 -88
  23. package/dist/demo.compiled.debug.map +4 -4
  24. package/dist/demo.compiled.js +107 -88
  25. package/dist/demo.compiled.map +4 -4
  26. package/dist/demo.css +1 -1
  27. package/dist/demo.css.map +1 -1
  28. package/dist/deps.js +21 -13
  29. package/dist/locales.js +31 -31
  30. package/dist/receiver.compiled.debug.js +75 -77
  31. package/dist/receiver.compiled.debug.map +3 -3
  32. package/dist/receiver.compiled.js +75 -77
  33. package/dist/receiver.compiled.map +3 -3
  34. package/dist/shaka-player.compiled.d.ts +181 -27
  35. package/dist/shaka-player.compiled.debug.d.ts +181 -27
  36. package/dist/shaka-player.compiled.debug.externs.js +169 -31
  37. package/dist/shaka-player.compiled.debug.js +510 -450
  38. package/dist/shaka-player.compiled.debug.map +4 -4
  39. package/dist/shaka-player.compiled.externs.js +169 -31
  40. package/dist/shaka-player.compiled.js +912 -874
  41. package/dist/shaka-player.compiled.map +4 -4
  42. package/dist/shaka-player.ui.d.ts +181 -27
  43. package/dist/shaka-player.ui.debug.d.ts +181 -27
  44. package/dist/shaka-player.ui.debug.externs.js +169 -31
  45. package/dist/shaka-player.ui.debug.js +533 -471
  46. package/dist/shaka-player.ui.debug.map +4 -4
  47. package/dist/shaka-player.ui.externs.js +169 -31
  48. package/dist/shaka-player.ui.js +1073 -1036
  49. package/dist/shaka-player.ui.map +4 -4
  50. package/docs/design/lcevc-architecture.png +0 -0
  51. package/docs/design/lcevc-demo.png +0 -0
  52. package/docs/design/lcevc-integration.md +72 -0
  53. package/docs/tutorials/fairplay.md +7 -0
  54. package/docs/tutorials/faq.md +1 -1
  55. package/docs/tutorials/ui.md +7 -7
  56. package/docs/tutorials/upgrade.md +6 -0
  57. package/externs/ima.js +13 -1
  58. package/externs/lcevc.js +81 -0
  59. package/externs/mux.js +1 -42
  60. package/externs/shaka/ads.js +11 -1
  61. package/externs/shaka/manifest_parser.js +5 -1
  62. package/externs/shaka/mp4_parser.js +3 -0
  63. package/externs/shaka/player.js +178 -15
  64. package/lib/abr/simple_abr_manager.js +7 -0
  65. package/lib/ads/ad_manager.js +0 -8
  66. package/lib/ads/client_side_ad.js +15 -0
  67. package/lib/ads/client_side_ad_manager.js +21 -8
  68. package/lib/ads/server_side_ad.js +15 -0
  69. package/lib/ads/server_side_ad_manager.js +3 -3
  70. package/lib/cast/cast_utils.js +2 -0
  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 +108 -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 +808 -384
  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_capabilities.js +36 -0
  81. package/lib/media/media_source_engine.js +113 -28
  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 +142 -12
  85. package/lib/media/transmuxer.js +78 -21
  86. package/lib/offline/storage.js +1 -0
  87. package/lib/player.js +456 -77
  88. package/lib/polyfill/media_capabilities.js +9 -5
  89. package/lib/polyfill/patchedmediakeys_apple.js +63 -4
  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/mime_utils.js +3 -6
  96. package/lib/util/mp4_box_parsers.js +39 -5
  97. package/lib/util/mp4_parser.js +35 -0
  98. package/lib/util/player_configuration.js +23 -1
  99. package/lib/util/stream_utils.js +5 -3
  100. package/lib/util/ts_parser.js +499 -0
  101. package/maintained-branches.md +2 -2
  102. package/package.json +7 -4
  103. package/roadmap.md +5 -3
  104. package/test/ads/ad_manager_unit.js +182 -29
  105. package/test/cast/cast_utils_unit.js +3 -1
  106. package/test/dash/dash_parser_content_protection_unit.js +1 -0
  107. package/test/dash/dash_parser_live_unit.js +1 -0
  108. package/test/dash/dash_parser_manifest_unit.js +93 -1
  109. package/test/dash/dash_parser_segment_base_unit.js +1 -0
  110. package/test/dash/dash_parser_segment_list_unit.js +1 -0
  111. package/test/dash/dash_parser_segment_template_unit.js +1 -0
  112. package/test/demo/demo_unit.js +2 -1
  113. package/test/hls/hls_live_unit.js +253 -19
  114. package/test/hls/hls_parser_unit.js +631 -12
  115. package/test/media/closed_caption_parser_unit.js +2 -1
  116. package/test/media/drm_engine_integration.js +3 -1
  117. package/test/media/media_source_engine_integration.js +71 -6
  118. package/test/media/media_source_engine_unit.js +10 -5
  119. package/test/media/streaming_engine_integration.js +4 -1
  120. package/test/media/streaming_engine_unit.js +144 -1
  121. package/test/media/transmuxer_integration.js +21 -10
  122. package/test/player_integration.js +224 -82
  123. package/test/player_unit.js +5 -2
  124. package/test/polyfill/media_capabilities_unit.js +21 -23
  125. package/test/polyfill/patchedmediakeys_apple_unit.js +130 -0
  126. package/test/test/assets/id3-metadata.aac +0 -0
  127. package/test/test/assets/id3-metadata.ts +0 -0
  128. package/test/test/assets/thumbnails-sprites.vtt +10 -0
  129. package/test/test/assets/thumbnails.vtt +10 -0
  130. package/test/test/util/dash_parser_util.js +2 -0
  131. package/test/test/util/fake_ad.js +21 -0
  132. package/test/test/util/fake_media_source_engine.js +7 -0
  133. package/test/test/util/id3_generator.js +100 -0
  134. package/test/test/util/manifest_generator.js +3 -6
  135. package/test/test/util/simple_fakes.js +4 -0
  136. package/test/test/util/stream_generator.js +38 -0
  137. package/test/test/util/test_scheme.js +43 -14
  138. package/test/text/vtt_text_parser_unit.js +11 -0
  139. package/test/util/id3_utils_unit.js +116 -0
  140. package/test/util/ts_parser_unit.js +77 -0
  141. package/third_party/closure-uri/uri.js +1 -1
  142. package/ui/less/containers.less +7 -0
  143. package/ui/ui.js +43 -4
@@ -438,20 +438,63 @@ shaka.extern.DrmSupportType;
438
438
  */
439
439
  shaka.extern.SupportType;
440
440
 
441
-
442
441
  /**
443
- * @typedef {!Object.<string, ?>}
442
+ * @typedef {{
443
+ * cueTime: ?number,
444
+ * data: !Uint8Array,
445
+ * frames: !Array.<shaka.extern.MetadataFrame>,
446
+ * dts: ?number,
447
+ * pts: ?number
448
+ * }}
444
449
  *
445
450
  * @description
446
451
  * ID3 metadata in format defined by
447
452
  * https://id3.org/id3v2.3.0#Declared_ID3v2_frames
448
453
  * The content of the field.
449
454
  *
455
+ * @property {?number} cueTime
456
+ * @property {!Uint8Array} data
457
+ * @property {!Array.<shaka.extern.MetadataFrame>} frames
458
+ * @property {?number} dts
459
+ * @property {?number} pts
460
+ *
450
461
  * @exportDoc
451
462
  */
452
463
  shaka.extern.ID3Metadata;
453
464
 
454
465
 
466
+ /**
467
+ * @typedef {{
468
+ * type: string,
469
+ * size: number,
470
+ * data: Uint8Array
471
+ * }}
472
+ *
473
+ * @description metadata raw frame.
474
+ * @property {string} type
475
+ * @property {number} size
476
+ * @property {Uint8Array} data
477
+ * @exportDoc
478
+ */
479
+ shaka.extern.MetadataRawFrame;
480
+
481
+
482
+ /**
483
+ * @typedef {{
484
+ * key: string,
485
+ * data: (ArrayBuffer|string),
486
+ * description: string
487
+ * }}
488
+ *
489
+ * @description metadata frame parsed.
490
+ * @property {string} key
491
+ * @property {ArrayBuffer|string} data
492
+ * @property {string} description
493
+ * @exportDoc
494
+ */
495
+ shaka.extern.MetadataFrame;
496
+
497
+
455
498
  /**
456
499
  * @typedef {{
457
500
  * schemeIdUri: string,
@@ -566,6 +609,24 @@ shaka.extern.MediaQualityInfo;
566
609
  shaka.extern.EmsgInfo;
567
610
 
568
611
 
612
+ /**
613
+ * @typedef {{
614
+ * wallClockTime: number,
615
+ * programStartDate: Date
616
+ * }}
617
+ *
618
+ * @description
619
+ * Contains information about an PRFT MP4 box.
620
+ *
621
+ * @property {number} wallClockTime
622
+ * A UTC timestamp corresponding to decoding time in milliseconds.
623
+ * @property {Date} programStartDate
624
+ * The derived start date of the program.
625
+ * @exportDoc
626
+ */
627
+ shaka.extern.ProducerReferenceTime;
628
+
629
+
569
630
  /**
570
631
  * @typedef {{
571
632
  * distinctiveIdentifierRequired: boolean,
@@ -646,7 +707,7 @@ shaka.extern.AdvancedDrmConfiguration;
646
707
  * <code>{'com.widevine.alpha': 'https://example.com/drm'}</code>.
647
708
  * @property {!Object.<string, string>} clearKeys
648
709
  * <i>Forces the use of the Clear Key CDM.</i>
649
- * A map of key IDs (hex) to keys (hex).
710
+ * A map of key IDs (hex or base64) to keys (hex or base64).
650
711
  * @property {boolean} delayLicenseRequestUntilPlayed
651
712
  * <i>Defaults to false.</i> <br>
652
713
  * True to configure drm to delay sending a license request until a user
@@ -701,7 +762,8 @@ shaka.extern.DrmConfiguration;
701
762
  * ignoreEmptyAdaptationSet: boolean,
702
763
  * ignoreMaxSegmentDuration: boolean,
703
764
  * keySystemsByURI: !Object.<string, string>,
704
- * manifestPreprocessor: function(!Element)
765
+ * manifestPreprocessor: function(!Element),
766
+ * sequenceMode: boolean
705
767
  * }}
706
768
  *
707
769
  * @property {string} clockSyncUri
@@ -755,6 +817,10 @@ shaka.extern.DrmConfiguration;
755
817
  * Called immediately after the DASH manifest has been parsed into an
756
818
  * XMLDocument. Provides a way for applications to perform efficient
757
819
  * preprocessing of the manifest.
820
+ * @property {boolean} sequenceMode
821
+ * If true, the media segments are appended to the SourceBuffer in
822
+ * "sequence mode" (ignoring their internal timestamps).
823
+ * <i>Defaults to <code>false</code>.</i>
758
824
  * @exportDoc
759
825
  */
760
826
  shaka.extern.DashManifestConfiguration;
@@ -767,7 +833,9 @@ shaka.extern.DashManifestConfiguration;
767
833
  * defaultAudioCodec: string,
768
834
  * defaultVideoCodec: string,
769
835
  * ignoreManifestProgramDateTime: boolean,
770
- * mediaPlaylistFullMimeType: string
836
+ * mediaPlaylistFullMimeType: string,
837
+ * useSafariBehaviorForLive: boolean,
838
+ * liveSegmentsDelay: number
771
839
  * }}
772
840
  *
773
841
  * @property {boolean} ignoreTextStreamFailures
@@ -798,6 +866,16 @@ shaka.extern.DashManifestConfiguration;
798
866
  * format this value.
799
867
  * <i>Defaults to
800
868
  * <code>'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'</code>.</i>
869
+ * @property {boolean} useSafariBehaviorForLive
870
+ * If this is true, playback will set the availability window to the
871
+ * presentation delay. The player will be able to buffer ahead three
872
+ * segments, but the seek window will be zero-sized, to be consistent with
873
+ * Safari. If this is false, the seek window will be the entire duration.
874
+ * <i>Defaults to <code>true</code>.</i>
875
+ * @property {number} liveSegmentsDelay
876
+ * The default presentation delay will be calculated as a number of segments.
877
+ * This is the number of segments for this calculation..
878
+ * <i>Defaults to <code>3</code>.</i>
801
879
  * @exportDoc
802
880
  */
803
881
  shaka.extern.HlsManifestConfiguration;
@@ -870,7 +948,7 @@ shaka.extern.ManifestConfiguration;
870
948
  * startAtSegmentBoundary: boolean,
871
949
  * gapDetectionThreshold: number,
872
950
  * durationBackoff: number,
873
- * forceTransmuxTS: boolean,
951
+ * forceTransmux: boolean,
874
952
  * safeSeekOffset: number,
875
953
  * stallEnabled: boolean,
876
954
  * stallThreshold: number,
@@ -884,7 +962,8 @@ shaka.extern.ManifestConfiguration;
884
962
  * updateIntervalSeconds: number,
885
963
  * dispatchAllEmsgBoxes: boolean,
886
964
  * observeQualityChanges: boolean,
887
- * maxDisabledTime: number
965
+ * maxDisabledTime: number,
966
+ * parsePrftBox: boolean
888
967
  * }}
889
968
  *
890
969
  * @description
@@ -932,12 +1011,12 @@ shaka.extern.ManifestConfiguration;
932
1011
  * seek to when the user tries to seek to or start playback at the duration.
933
1012
  * To disable this behavior, the config can be set to 0. We recommend using
934
1013
  * the default value unless you have a good reason not to.
935
- * @property {boolean} forceTransmuxTS
936
- * If this is <code>true</code>, we will transmux TS content even if not
937
- * strictly necessary for the assets to be played. Shaka Player currently
938
- * only supports CEA 708 captions by transmuxing, so this value is necessary
939
- * for enabling them on platforms with native TS support like Edge or
940
- * Chromecast. This value defaults to <code>false</code>.
1014
+ * @property {boolean} forceTransmux
1015
+ * If this is <code>true</code>, we will transmux AAC and TS content even if
1016
+ * not strictly necessary for the assets to be played. Shaka Player
1017
+ * currently only supports CEA 708 captions by transmuxing, so this value is
1018
+ * necessary for enabling them on platforms with native TS support like Edge
1019
+ * or Chromecast. This value defaults to <code>false</code>.
941
1020
  * @property {number} safeSeekOffset
942
1021
  * The amount of seconds that should be added when repositioning the playhead
943
1022
  * after falling out of the availability window or seek. This gives the player
@@ -993,11 +1072,35 @@ shaka.extern.ManifestConfiguration;
993
1072
  * The maximum time a variant can be disabled when NETWORK HTTP_ERROR
994
1073
  * is reached, in seconds.
995
1074
  * If all variants are disabled this way, NETWORK HTTP_ERROR will be thrown.
1075
+ * @property {boolean} parsePrftBox
1076
+ * If <code>true</code>, will raise a shaka.extern.ProducerReferenceTime
1077
+ * player event (event name 'prft').
1078
+ * The event will be raised only once per playback session as program
1079
+ * start date will not change, and would save parsing the segment multiple
1080
+ * times needlessly.
1081
+ * Defaults to <code>false</code>.
996
1082
  * @exportDoc
997
1083
  */
998
1084
  shaka.extern.StreamingConfiguration;
999
1085
 
1000
1086
 
1087
+ /**
1088
+ * @typedef {{
1089
+ * sourceBufferExtraFeatures: string
1090
+ * }}
1091
+ *
1092
+ * @description
1093
+ * Media source configuration.
1094
+ *
1095
+ * @property {string} sourceBufferExtraFeatures
1096
+ * Some platforms may need to pass features when initializing the
1097
+ * sourceBuffer.
1098
+ * This string is ultimately appended to MIME types in addSourceBuffer().
1099
+ * @exportDoc
1100
+ */
1101
+ shaka.extern.MediaSourceConfiguration;
1102
+
1103
+
1001
1104
  /**
1002
1105
  * @typedef {{
1003
1106
  * enabled: boolean,
@@ -1009,6 +1112,7 @@ shaka.extern.StreamingConfiguration;
1009
1112
  * bandwidthDowngradeTarget: number,
1010
1113
  * advanced: shaka.extern.AdvancedAbrConfiguration,
1011
1114
  * restrictToElementSize: boolean,
1115
+ * restrictToScreenSize: boolean,
1012
1116
  * ignoreDevicePixelRatio: boolean
1013
1117
  * }}
1014
1118
  *
@@ -1044,9 +1148,12 @@ shaka.extern.StreamingConfiguration;
1044
1148
  * Note: The use of ResizeObserver is required for it to work properly. If
1045
1149
  * true without ResizeObserver, it behaves as false.
1046
1150
  * Defaults false.
1151
+ * @property {boolean} restrictToScreenSize
1152
+ * If true, restrict the quality to screen size.
1153
+ * Defaults false.
1047
1154
  * @property {boolean} ignoreDevicePixelRatio
1048
1155
  * If true,device pixel ratio is ignored when restricting the quality to
1049
- * media element size.
1156
+ * media element size or screen size.
1050
1157
  * Defaults false.
1051
1158
  * @exportDoc
1052
1159
  */
@@ -1115,6 +1222,49 @@ shaka.extern.AdvancedAbrConfiguration;
1115
1222
  */
1116
1223
  shaka.extern.CmcdConfiguration;
1117
1224
 
1225
+ /**
1226
+ * @typedef {{
1227
+ * enabled: boolean,
1228
+ * dynamicPerformanceScaling: boolean,
1229
+ * logLevel: number,
1230
+ * drawLogo: boolean
1231
+ * }}
1232
+ *
1233
+ * @description
1234
+ * Decoding for MPEG-5 Part2 LCEVC.
1235
+ *
1236
+ * @property {boolean} enabled
1237
+ * If <code>true</code>, enable LCEVC.
1238
+ * Defaults to <code>false</code>.
1239
+ * @property {boolean} dynamicPerformanceScaling
1240
+ * If <code>true</code>, LCEVC Dynamic Performance Scaling or dps is enabled
1241
+ * to be triggered, when the system is not able to decode frames within a
1242
+ * specific tolerance of the fps of the video and disables LCEVC decoding
1243
+ * for some time. The base video will be shown upscaled to target resolution.
1244
+ * If it is triggered again within a short period of time, the disabled
1245
+ * time will be higher and if it is triggered three times in a row the LCEVC
1246
+ * decoding will be disabled for that playback session.
1247
+ * If dynamicPerformanceScaling is false, LCEVC decode will be forced
1248
+ * and will drop frames appropriately if performance is sub optimal.
1249
+ * Defaults to <code>true</code>.
1250
+ * @property {number} logLevel
1251
+ * Loglevel 0-5 for logging.
1252
+ * NONE = 0
1253
+ * ERROR = 1
1254
+ * WARNING = 2
1255
+ * INFO = 3
1256
+ * DEBUG = 4
1257
+ * VERBOSE = 5
1258
+ * Defaults to <code>0</code>.
1259
+ * @property {boolean} drawLogo
1260
+ * If <code>true</code>, LCEVC Logo is placed on the top left hand corner
1261
+ * which only appears when the LCEVC enhanced frames are being rendered.
1262
+ * Defaults to true for the lib but is forced to false in this integration
1263
+ * unless explicitly set to true through config.
1264
+ * Defaults to <code>false</code>.
1265
+ * @exportDoc
1266
+ */
1267
+ shaka.extern.LcevcConfiguration;
1118
1268
 
1119
1269
  /**
1120
1270
  * @typedef {{
@@ -1158,12 +1308,15 @@ shaka.extern.OfflineConfiguration;
1158
1308
 
1159
1309
  /**
1160
1310
  * @typedef {{
1311
+ * autoShowText: shaka.config.AutoShowText,
1161
1312
  * drm: shaka.extern.DrmConfiguration,
1162
1313
  * manifest: shaka.extern.ManifestConfiguration,
1163
1314
  * streaming: shaka.extern.StreamingConfiguration,
1315
+ * mediaSource: shaka.extern.MediaSourceConfiguration,
1164
1316
  * abrFactory: shaka.extern.AbrManager.Factory,
1165
1317
  * abr: shaka.extern.AbrConfiguration,
1166
1318
  * cmcd: shaka.extern.CmcdConfiguration,
1319
+ * lcevc: shaka.extern.LcevcConfiguration,
1167
1320
  * offline: shaka.extern.OfflineConfiguration,
1168
1321
  * preferredAudioLanguage: string,
1169
1322
  * preferredTextLanguage: string,
@@ -1180,18 +1333,25 @@ shaka.extern.OfflineConfiguration;
1180
1333
  * textDisplayFactory: shaka.extern.TextDisplayer.Factory
1181
1334
  * }}
1182
1335
  *
1336
+ * @property {shaka.config.AutoShowText} autoShowText
1337
+ * Controls behavior of auto-showing text tracks on load().
1183
1338
  * @property {shaka.extern.DrmConfiguration} drm
1184
1339
  * DRM configuration and settings.
1185
1340
  * @property {shaka.extern.ManifestConfiguration} manifest
1186
1341
  * Manifest configuration and settings.
1187
1342
  * @property {shaka.extern.StreamingConfiguration} streaming
1188
1343
  * Streaming configuration and settings.
1344
+ * @property {shaka.extern.MediaSourceConfiguration} mediaSource
1345
+ * Media source configuration and settings.
1189
1346
  * @property {shaka.extern.AbrManager.Factory} abrFactory
1190
1347
  * A factory to construct an abr manager.
1191
1348
  * @property {shaka.extern.AbrConfiguration} abr
1192
1349
  * ABR configuration and settings.
1193
1350
  * @property {shaka.extern.CmcdConfiguration} cmcd
1194
1351
  * CMCD configuration and settings. (Common Media Client Data)
1352
+ * @property {shaka.extern.LcevcConfiguration} lcevc
1353
+ * MPEG-5 LCEVC configuration and settings.
1354
+ * (Low Complexity Enhancement Video Codec)
1195
1355
  * @property {shaka.extern.OfflineConfiguration} offline
1196
1356
  * Offline configuration and settings.
1197
1357
  * @property {string} preferredAudioLanguage
@@ -1269,7 +1429,8 @@ shaka.extern.LanguageRole;
1269
1429
  * startTime: number,
1270
1430
  * duration: number,
1271
1431
  * uris: !Array.<string>,
1272
- * width: number
1432
+ * width: number,
1433
+ * sprite: boolean
1273
1434
  * }}
1274
1435
  *
1275
1436
  * @property {number} imageHeight
@@ -1293,6 +1454,8 @@ shaka.extern.LanguageRole;
1293
1454
  * given.
1294
1455
  * @property {number} width
1295
1456
  * The thumbnail width in px.
1457
+ * @property {boolean} sprite
1458
+ * Indicate if the thumbnail is a sprite.
1296
1459
  * @exportDoc
1297
1460
  */
1298
1461
  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
  }
@@ -384,6 +384,7 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
384
384
  shaka.cast.CastUtils.PlayerVoidMethods = [
385
385
  'addChaptersTrack',
386
386
  'addTextTrackAsync',
387
+ 'addThumbnailsTrack',
387
388
  'cancelTrickPlay',
388
389
  'configure',
389
390
  'getChapters',
@@ -408,6 +409,7 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
408
409
  */
409
410
  shaka.cast.CastUtils.PlayerPromiseMethods = [
410
411
  'attach',
412
+ 'attachCanvas',
411
413
  'detach',
412
414
  // The manifestFactory parameter of load is not supported.
413
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.