shaka-player 4.4.3 → 4.5.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 (198) hide show
  1. package/.github/workflows/release-please.yaml +2 -27
  2. package/CHANGELOG.md +64 -45
  3. package/README.md +16 -10
  4. package/demo/asset_card.js +18 -21
  5. package/demo/cast_receiver/index.html +0 -1
  6. package/demo/close_button.js +0 -3
  7. package/demo/common/asset.js +22 -5
  8. package/demo/common/assets.js +132 -49
  9. package/demo/config.js +192 -253
  10. package/demo/custom.js +39 -98
  11. package/demo/front.js +7 -10
  12. package/demo/index.html +19 -22
  13. package/demo/input.js +6 -11
  14. package/demo/input_container.js +8 -9
  15. package/demo/main.js +51 -123
  16. package/demo/search.js +22 -34
  17. package/demo/service_worker.js +0 -3
  18. package/demo/tooltip.js +3 -5
  19. package/demo/visualizer.js +3 -5
  20. package/demo/visualizer_button.js +1 -20
  21. package/dist/demo.compiled.debug.js +152 -178
  22. package/dist/demo.compiled.debug.map +4 -4
  23. package/dist/demo.compiled.js +152 -178
  24. package/dist/demo.compiled.map +4 -4
  25. package/dist/deps.js +27 -24
  26. package/dist/locales.js +31 -31
  27. package/dist/receiver.compiled.debug.js +22 -43
  28. package/dist/receiver.compiled.debug.map +4 -4
  29. package/dist/receiver.compiled.js +22 -43
  30. package/dist/receiver.compiled.map +4 -4
  31. package/dist/shaka-player.compiled.d.ts +507 -365
  32. package/dist/shaka-player.compiled.debug.d.ts +507 -365
  33. package/dist/shaka-player.compiled.debug.externs.js +205 -51
  34. package/dist/shaka-player.compiled.debug.js +541 -450
  35. package/dist/shaka-player.compiled.debug.map +4 -4
  36. package/dist/shaka-player.compiled.externs.js +205 -51
  37. package/dist/shaka-player.compiled.js +1120 -1066
  38. package/dist/shaka-player.compiled.map +4 -4
  39. package/dist/shaka-player.ui.d.ts +562 -410
  40. package/dist/shaka-player.ui.debug.d.ts +562 -410
  41. package/dist/shaka-player.ui.debug.externs.js +226 -51
  42. package/dist/shaka-player.ui.debug.js +606 -506
  43. package/dist/shaka-player.ui.debug.map +4 -4
  44. package/dist/shaka-player.ui.externs.js +226 -51
  45. package/dist/shaka-player.ui.js +1266 -1207
  46. package/dist/shaka-player.ui.map +4 -4
  47. package/docs/design/lcevc-integration.md +14 -14
  48. package/docs/tutorials/faq.md +27 -55
  49. package/docs/tutorials/index.json +2 -1
  50. package/docs/tutorials/lcevc.md +118 -0
  51. package/docs/tutorials/ui-customization.md +4 -0
  52. package/externs/css_style_declaration.js +19 -0
  53. package/externs/lcevc.js +37 -13
  54. package/externs/media_remote.js +68 -0
  55. package/externs/mediatailor.js +193 -0
  56. package/externs/pictureinpicture.js +11 -0
  57. package/externs/shaka/ads.js +27 -0
  58. package/externs/shaka/manifest.js +10 -5
  59. package/externs/shaka/manifest_parser.js +7 -1
  60. package/externs/shaka/offline.js +4 -0
  61. package/externs/shaka/player.js +12 -1
  62. package/karma.conf.js +7 -3
  63. package/lib/abr/simple_abr_manager.js +43 -3
  64. package/lib/ads/ad_manager.js +104 -50
  65. package/lib/ads/media_tailor_ad.js +297 -0
  66. package/lib/ads/media_tailor_ad_manager.js +828 -0
  67. package/lib/cea/ts_cea_parser.js +15 -2
  68. package/lib/config/codec_switching_strategy.js +24 -0
  69. package/lib/dash/content_protection.js +120 -2
  70. package/lib/dash/dash_parser.js +75 -12
  71. package/lib/dash/mpd_utils.js +10 -6
  72. package/lib/dash/segment_base.js +13 -5
  73. package/lib/dash/segment_list.js +13 -5
  74. package/lib/dash/segment_template.js +43 -85
  75. package/lib/dependencies/all.js +8 -7
  76. package/lib/hls/hls_parser.js +44 -16
  77. package/lib/lcevc/lcevc_dec.js +220 -0
  78. package/lib/media/adaptation_set.js +22 -11
  79. package/lib/media/adaptation_set_criteria.js +25 -7
  80. package/lib/media/media_source_engine.js +215 -27
  81. package/lib/media/segment_index.js +1 -1
  82. package/lib/media/segment_reference.js +7 -7
  83. package/lib/media/streaming_engine.js +33 -18
  84. package/lib/mss/mss_parser.js +1 -0
  85. package/lib/net/networking_engine.js +1 -0
  86. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  87. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  88. package/lib/offline/manifest_converter.js +1 -0
  89. package/lib/offline/storage.js +3 -0
  90. package/lib/player.js +142 -72
  91. package/lib/routing/payload.js +5 -1
  92. package/lib/text/cue.js +15 -0
  93. package/lib/text/ttml_text_parser.js +17 -0
  94. package/lib/text/ui_text_displayer.js +4 -0
  95. package/lib/text/vtt_text_parser.js +33 -20
  96. package/lib/transmuxer/h265.js +862 -0
  97. package/lib/transmuxer/mpeg_ts_transmuxer.js +3 -2
  98. package/lib/transmuxer/ts_transmuxer.js +160 -15
  99. package/lib/util/error.js +28 -9
  100. package/lib/util/exp_golomb.js +30 -2
  101. package/lib/util/fake_event.js +3 -0
  102. package/lib/util/mp4_generator.js +4 -4
  103. package/lib/util/periods.js +2 -0
  104. package/lib/util/platform.js +40 -0
  105. package/lib/util/player_configuration.js +8 -0
  106. package/lib/util/state_history.js +6 -2
  107. package/lib/util/stream_utils.js +133 -217
  108. package/lib/util/ts_parser.js +226 -40
  109. package/maintained-branches.md +3 -2
  110. package/package.json +4 -6
  111. package/roadmap.md +15 -5
  112. package/shaka-player.uncompiled.js +2 -1
  113. package/support.html +0 -1
  114. package/test/cast/cast_receiver_integration.js +47 -0
  115. package/test/codec_switching/codec_switching_integration.js +181 -0
  116. package/test/dash/dash_parser_content_protection_unit.js +2 -0
  117. package/test/dash/dash_parser_integration.js +73 -0
  118. package/test/dash/dash_parser_live_unit.js +2 -0
  119. package/test/dash/dash_parser_manifest_unit.js +42 -0
  120. package/test/dash/dash_parser_segment_base_unit.js +2 -0
  121. package/test/dash/dash_parser_segment_list_unit.js +2 -0
  122. package/test/dash/dash_parser_segment_template_unit.js +2 -0
  123. package/test/demo/demo_unit.js +0 -16
  124. package/test/hls/hls_live_unit.js +2 -0
  125. package/test/hls/hls_parser_unit.js +8 -6
  126. package/test/media/adaptation_set_criteria_unit.js +118 -0
  127. package/test/media/adaptation_set_unit.js +1 -0
  128. package/test/media/media_source_engine_unit.js +165 -1
  129. package/test/media/segment_index_unit.js +4 -4
  130. package/test/media/segment_prefetch_unit.js +1 -1
  131. package/test/media/streaming_engine_unit.js +17 -17
  132. package/test/mss/mss_parser_unit.js +2 -0
  133. package/test/offline/manifest_convert_unit.js +5 -0
  134. package/test/offline/storage_integration.js +1 -4
  135. package/test/player_unit.js +102 -131
  136. package/test/routing/walker_unit.js +1 -0
  137. package/test/test/assets/dash-aes-128/Fragments(video=0,format=mpd-time-csf) +0 -0
  138. package/test/test/assets/dash-aes-128/Fragments(video=20000000,format=mpd-time-csf) +0 -0
  139. package/test/test/assets/dash-aes-128/Fragments(video=40000000,format=mpd-time-csf) +0 -0
  140. package/test/test/assets/dash-aes-128/Fragments(video=60000000,format=mpd-time-csf) +0 -0
  141. package/test/test/assets/dash-aes-128/Fragments(video=i,format=mpd-time-csf) +0 -0
  142. package/test/test/assets/dash-aes-128/dash.mpd +18 -0
  143. package/test/test/assets/dash-aes-128/license +1 -0
  144. package/test/test/assets/dash-multi-codec/audio_en_2c_128k_aac.mp4 +0 -0
  145. package/test/test/assets/dash-multi-codec/audio_es_2c_64k_opus.webm +0 -0
  146. package/test/test/assets/dash-multi-codec/dash.mpd +32 -0
  147. package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
  148. package/test/test/assets/hls-ts-h265/0.ts +0 -0
  149. package/test/test/assets/hls-ts-h265/hevc.m3u8 +6 -0
  150. package/test/test/assets/hls-ts-h265/index.m3u8 +7 -0
  151. package/test/test/assets/hls-ts-muxed-aac-h265/0.ts +0 -0
  152. package/test/test/assets/hls-ts-muxed-aac-h265/1.ts +0 -0
  153. package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +9 -0
  154. package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +24 -0
  155. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00000.ts +0 -0
  156. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00001.ts +0 -0
  157. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00002.ts +0 -0
  158. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00003.ts +0 -0
  159. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00004.ts +0 -0
  160. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00005.ts +0 -0
  161. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0000.ts +0 -0
  162. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0001.ts +0 -0
  163. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0002.ts +0 -0
  164. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0003.ts +0 -0
  165. package/test/test/assets/hls-ts-muxed-ec3-h264/prog_index.m3u8 +14 -0
  166. package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +23 -0
  167. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-1-v1-a1.ts +0 -0
  168. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-2-v1-a1.ts +0 -0
  169. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-3-v1-a1.ts +0 -0
  170. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-4-v1-a1.ts +0 -0
  171. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-5-v1-a1.ts +0 -0
  172. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-6-v1-a1.ts +0 -0
  173. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-7-v1-a1.ts +0 -0
  174. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-8-v1-a1.ts +0 -0
  175. package/test/test/util/dash_parser_util.js +4 -0
  176. package/test/test/util/fake_ad_manager.js +20 -0
  177. package/test/test/util/fake_media_source_engine.js +8 -2
  178. package/test/test/util/manifest_generator.js +7 -3
  179. package/test/test/util/mss_parser_util.js +4 -0
  180. package/test/test/util/offline_utils.js +1 -0
  181. package/test/test/util/streaming_engine_util.js +7 -4
  182. package/test/text/ttml_text_parser_unit.js +52 -0
  183. package/test/text/vtt_text_parser_unit.js +103 -31
  184. package/test/transmuxer/transmuxer_integration.js +117 -0
  185. package/test/ui/ui_unit.js +3 -10
  186. package/test/util/stream_utils_unit.js +208 -74
  187. package/ui/controls.js +125 -0
  188. package/ui/externs/ui.js +8 -1
  189. package/ui/pip_button.js +22 -120
  190. package/ui/remote_button.js +201 -0
  191. package/ui/ui.js +5 -2
  192. package/demo/common/message_ids.js +0 -309
  193. package/demo/locales/en.json +0 -288
  194. package/demo/locales/source.json +0 -1146
  195. package/externs/mux.js +0 -69
  196. package/lib/lcevc/lcevc_dil.js +0 -152
  197. package/lib/transmuxer/muxjs_transmuxer.js +0 -242
  198. package/test/transmuxer/muxjs_transmuxer_integration.js +0 -177
@@ -0,0 +1,193 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for Media Tailor.
9
+ * @externs
10
+ */
11
+
12
+
13
+ /** @const */
14
+ var mediaTailor = {};
15
+
16
+
17
+ /**
18
+ * @typedef {{
19
+ * manifestUrl: ?string,
20
+ * trackingUrl: ?string
21
+ * }}
22
+ *
23
+ * @property {?string} manifestUrl
24
+ * @property {?string} trackingUrl
25
+ * @exportDoc
26
+ */
27
+ mediaTailor.SessionResponse;
28
+
29
+
30
+ /**
31
+ * @typedef {{
32
+ * avails: !Array.<mediaTailor.AdBreak>
33
+ * }}
34
+ *
35
+ * @property {!Array.<mediaTailor.AdBreak>} avails
36
+ * @exportDoc
37
+ */
38
+ mediaTailor.TrackingResponse;
39
+
40
+
41
+ /**
42
+ * @typedef {{
43
+ * adBreakTrackingEvents: !Array.<mediaTailor.TrackingEvent>,
44
+ * ads: !Array.<mediaTailor.Ad>,
45
+ * durationInSeconds: number,
46
+ * nonLinearAdsList: !Array.<mediaTailor.Ad>,
47
+ * startTimeInSeconds: number
48
+ * }}
49
+ *
50
+ * @property {!Array.<mediaTailor.TrackingEvent>} adBreakTrackingEvents
51
+ * @property {!Array.<mediaTailor.Ad>} ads
52
+ * @property {number} durationInSeconds
53
+ * @property {!Array.<mediaTailor.Ad>} nonLinearAdsList
54
+ * @property {number} startTimeInSeconds
55
+ * @exportDoc
56
+ */
57
+ mediaTailor.AdBreak;
58
+
59
+
60
+ /**
61
+ * @typedef {{
62
+ * adId: string,
63
+ * adParameters: string,
64
+ * adSystem: string,
65
+ * adTitle: string,
66
+ * creativeId: string,
67
+ * creativeSequence: string,
68
+ * durationInSeconds: number,
69
+ * skipOffset: ?number,
70
+ * startTimeInSeconds: number,
71
+ * nonLinearAdList: !Array.<mediaTailor.NonLinearAd>,
72
+ * trackingEvents: !Array.<mediaTailor.TrackingEvent>
73
+ * }}
74
+ *
75
+ * @property {string} adId
76
+ * @property {string} adParameters
77
+ * @property {string} adSystem
78
+ * @property {string} adTitle
79
+ * @property {string} creativeId
80
+ * @property {string} creativeSequence
81
+ * @property {number} durationInSeconds
82
+ * @property {?number} skipOffset
83
+ * @property {number} startTimeInSeconds
84
+ * @property {!Array.<mediaTailor.NonLinearAd>} nonLinearAdList
85
+ * @property {!Array.<mediaTailor.TrackingEvent>} trackingEvents
86
+ * @exportDoc
87
+ */
88
+ mediaTailor.Ad;
89
+
90
+
91
+ /**
92
+ * @typedef {{
93
+ * adId: string,
94
+ * adParameters: string,
95
+ * adSystem: string,
96
+ * adTitle: string,
97
+ * creativeAdId: string,
98
+ * creativeId: string,
99
+ * creativeSequence: string,
100
+ * height: ?number,
101
+ * width: ?number,
102
+ * staticResource: string
103
+ * }}
104
+ *
105
+ * @property {string} adId
106
+ * @property {string} adParameters
107
+ * @property {string} adSystem
108
+ * @property {string} adTitle
109
+ * @property {string} creativeAdId
110
+ * @property {string} creativeId
111
+ * @property {string} creativeSequence
112
+ * @property {?number} height
113
+ * @property {?number} width
114
+ * @property {string} staticResource
115
+ * @exportDoc
116
+ */
117
+ mediaTailor.NonLinearAd;
118
+
119
+
120
+ /**
121
+ * @typedef {{
122
+ * beaconUrls: !Array.<string>,
123
+ * eventType: string
124
+ * }}
125
+ *
126
+ * @property {!Array.<string>} beaconUrls
127
+ * @property {string} eventType
128
+ * @exportDoc
129
+ */
130
+ mediaTailor.TrackingEvent;
131
+
132
+
133
+ /** @const */
134
+ var mediaTailorExternalResource = {};
135
+
136
+
137
+ /**
138
+ * @typedef {{
139
+ * apps: !Array.<mediaTailorExternalResource.App>
140
+ * }}
141
+ *
142
+ * @property {!Array.<mediaTailorExternalResource.App>} apps
143
+ * @exportDoc
144
+ */
145
+ mediaTailorExternalResource.Response;
146
+
147
+
148
+ /**
149
+ * @typedef {{
150
+ * placeholder: mediaTailorExternalResource.AppPlaceholder,
151
+ * data: mediaTailorExternalResource.AppData
152
+ * }}
153
+ *
154
+ * @property {mediaTailorExternalResource.AppPlaceholder} placeholder
155
+ * @property {mediaTailorExternalResource.AppData} data
156
+ * @exportDoc
157
+ */
158
+ mediaTailorExternalResource.App;
159
+
160
+
161
+ /**
162
+ * @typedef {{
163
+ * left: number,
164
+ * top: number
165
+ * }}
166
+ *
167
+ * @property {number} left
168
+ * @property {number} top
169
+ * @exportDoc
170
+ */
171
+ mediaTailorExternalResource.AppPlaceholder;
172
+
173
+
174
+ /**
175
+ * @typedef {{
176
+ * source: !Array.<mediaTailorExternalResource.AppDataSource>
177
+ * }}
178
+ *
179
+ * @property {!Array.<mediaTailorExternalResource.AppDataSource>} source
180
+ * @exportDoc
181
+ */
182
+ mediaTailorExternalResource.AppData;
183
+
184
+
185
+ /**
186
+ * @typedef {{
187
+ * url: string
188
+ * }}
189
+ *
190
+ * @property {string} url
191
+ * @exportDoc
192
+ */
193
+ mediaTailorExternalResource.AppDataSource;
@@ -97,3 +97,14 @@ DocumentPictureInPicture.prototype.dispatchEvent = function(event) {};
97
97
  * @type {!DocumentPictureInPicture}
98
98
  */
99
99
  Window.prototype.documentPictureInPicture;
100
+
101
+
102
+ /**
103
+ * @constructor
104
+ * @extends {Event}
105
+ */
106
+ function DocumentPictureInPictureEvent() {}
107
+
108
+
109
+ /** @type {Window} */
110
+ DocumentPictureInPictureEvent.prototype.window;
@@ -94,6 +94,21 @@ shaka.extern.IAdManager = class extends EventTarget {
94
94
  */
95
95
  updateClientSideAdsRenderingSettings(adsRenderingSettings) {}
96
96
 
97
+ /**
98
+ * @param {!HTMLElement} adContainer
99
+ * @param {!shaka.net.NetworkingEngine} networkingEngine
100
+ * @param {!HTMLMediaElement} video
101
+ */
102
+ initMediaTailor(adContainer, networkingEngine, video) {}
103
+
104
+ /**
105
+ * @param {string} url
106
+ * @param {Object} adsParams
107
+ * @param {string=} backupUrl
108
+ * @return {!Promise.<string>}
109
+ */
110
+ requestMediaTailorStream(url, adsParams, backupUrl) {}
111
+
97
112
  /**
98
113
  * @param {!HTMLElement} adContainer
99
114
  * @param {!HTMLMediaElement} video
@@ -117,6 +132,11 @@ shaka.extern.IAdManager = class extends EventTarget {
117
132
  */
118
133
  getServerSideCuePoints() {}
119
134
 
135
+ /**
136
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
137
+ */
138
+ getCuePoints() {}
139
+
120
140
  /**
121
141
  * Get statistics for the current playback session. If the player is not
122
142
  * playing content, this will return an empty stats object.
@@ -128,6 +148,13 @@ shaka.extern.IAdManager = class extends EventTarget {
128
148
  */
129
149
  onDashTimedMetadata(region) {}
130
150
 
151
+ /**
152
+ * Fired when the manifest is updated.
153
+ *
154
+ * @param {boolean} isLive
155
+ */
156
+ onManifestUpdated(isLive) {}
157
+
131
158
  /**
132
159
  * @param {shaka.extern.ID3Metadata} metadata
133
160
  * @param {number} timestampOffset
@@ -318,10 +318,10 @@ shaka.extern.CreateSegmentIndexFunction;
318
318
  * }}
319
319
  *
320
320
  * @description
321
- * AES-128 key and iv info from the HLS manifest.
321
+ * AES-128 key and iv info from the manifest.
322
322
  *
323
323
  * @property {string} method
324
- * The key method defined in the HLS manifest.
324
+ * The key method defined in the manifest.
325
325
  * @property {webCrypto.CryptoKey|undefined} cryptoKey
326
326
  * Web crypto key object of the AES-128 CBC key. If unset, the "fetchKey"
327
327
  * property should be provided.
@@ -330,15 +330,15 @@ shaka.extern.CreateSegmentIndexFunction;
330
330
  * Should be provided if the "cryptoKey" property is unset.
331
331
  * Should update this object in-place, to set "cryptoKey".
332
332
  * @property {(!Uint8Array|undefined)} iv
333
- * The IV in the HLS manifest, if defined. See HLS RFC 8216 Section 5.2 for
334
- * handling undefined IV.
333
+ * The IV in the manifest, if defined. For HLS see HLS RFC 8216 Section 5.2
334
+ * for handling undefined IV.
335
335
  * @property {number} firstMediaSequenceNumber
336
336
  * The starting Media Sequence Number of the playlist, used when IV is
337
337
  * undefined.
338
338
  *
339
339
  * @exportDoc
340
340
  */
341
- shaka.extern.HlsAes128Key;
341
+ shaka.extern.aes128Key;
342
342
 
343
343
 
344
344
  /**
@@ -355,6 +355,7 @@ shaka.extern.FetchCryptoKeysFunction;
355
355
  * @typedef {{
356
356
  * id: number,
357
357
  * originalId: ?string,
358
+ * groupId: ?string,
358
359
  * createSegmentIndex: shaka.extern.CreateSegmentIndexFunction,
359
360
  * closeSegmentIndex: (function()|undefined),
360
361
  * segmentIndex: shaka.media.SegmentIndex,
@@ -403,6 +404,10 @@ shaka.extern.FetchCryptoKeysFunction;
403
404
  * The original ID, if any, that appeared in the manifest. For example, in
404
405
  * DASH, this is the "id" attribute of the Representation element. In HLS,
405
406
  * this is the "NAME" attribute.
407
+ * @property {?string} groupId
408
+ * <i>Optional.</i> <br>
409
+ * The ID of the stream's parent element. In DASH, this will be a unique
410
+ * ID that represents the representation's parent adaptation element
406
411
  * @property {shaka.extern.CreateSegmentIndexFunction} createSegmentIndex
407
412
  * <i>Required.</i> <br>
408
413
  * Creates the Stream's segmentIndex (asynchronously).
@@ -109,7 +109,9 @@ shaka.extern.ManifestParser = class {
109
109
  * isAutoLowLatencyMode: function():boolean,
110
110
  * enableLowLatencyMode: function(),
111
111
  * updateDuration: function(),
112
- * newDrmInfo: function(shaka.extern.Stream)
112
+ * newDrmInfo: function(shaka.extern.Stream),
113
+ * onManifestUpdated: function(),
114
+ * getBandwidthEstimate: function():number
113
115
  * }}
114
116
  *
115
117
  * @description
@@ -144,6 +146,10 @@ shaka.extern.ManifestParser = class {
144
146
  * @property {function(shaka.extern.Stream)} newDrmInfo
145
147
  * Inform the player of new DRM info that needs to be processed for the given
146
148
  * stream.
149
+ * @property {function()} onManifestUpdated
150
+ * Should be called when the manifest is updated.
151
+ * @property {function():number} getBandwidthEstimate
152
+ * Get the estimated bandwidth in bits per second.
147
153
  * @exportDoc
148
154
  */
149
155
  shaka.extern.ManifestParser.PlayerInterface;
@@ -114,6 +114,7 @@ shaka.extern.ManifestDB;
114
114
  * @typedef {{
115
115
  * id: number,
116
116
  * originalId: ?string,
117
+ * groupId: ?string,
117
118
  * primary: boolean,
118
119
  * type: string,
119
120
  * mimeType: string,
@@ -146,6 +147,9 @@ shaka.extern.ManifestDB;
146
147
  * @property {?string} originalId
147
148
  * The original ID, if any, that appeared in the manifest. For example, in
148
149
  * DASH, this is the "id" attribute of the Representation element.
150
+ * @property {?string} groupId
151
+ * The ID of the stream's parent element. In DASH, this will be a unique
152
+ * ID that represents the representation's parent adaptation element
149
153
  * @property {boolean} primary
150
154
  * Whether the stream set was primary.
151
155
  * @property {string} type
@@ -841,7 +841,8 @@ shaka.extern.InitDataTransform;
841
841
  * ignoreMaxSegmentDuration: boolean,
842
842
  * keySystemsByURI: !Object.<string, string>,
843
843
  * manifestPreprocessor: function(!Element),
844
- * sequenceMode: boolean
844
+ * sequenceMode: boolean,
845
+ * enableAudioGroups: boolean
845
846
  * }}
846
847
  *
847
848
  * @property {string} clockSyncUri
@@ -899,6 +900,10 @@ shaka.extern.InitDataTransform;
899
900
  * If true, the media segments are appended to the SourceBuffer in
900
901
  * "sequence mode" (ignoring their internal timestamps).
901
902
  * <i>Defaults to <code>false</code>.</i>
903
+ * @property {boolean} enableAudioGroups
904
+ * If set, audio streams will be grouped and filtered by their parent
905
+ * adaptation set ID.
906
+ * <i>Defaults to <code>false</code>.</i>
902
907
  * @exportDoc
903
908
  */
904
909
  shaka.extern.DashManifestConfiguration;
@@ -1225,6 +1230,7 @@ shaka.extern.StreamingConfiguration;
1225
1230
 
1226
1231
  /**
1227
1232
  * @typedef {{
1233
+ * codecSwitchingStrategy: shaka.config.CodecSwitchingStrategy,
1228
1234
  * sourceBufferExtraFeatures: string,
1229
1235
  * forceTransmux: boolean,
1230
1236
  * insertFakeEncryptionInInit: boolean
@@ -1233,6 +1239,11 @@ shaka.extern.StreamingConfiguration;
1233
1239
  * @description
1234
1240
  * Media source configuration.
1235
1241
  *
1242
+ * @property {shaka.config.CodecSwitchingStrategy} codecSwitchingStrategy
1243
+ * Allow codec switching strategy. SMOOTH loading uses
1244
+ * SourceBuffer.changeType. RELOAD uses cycling of MediaSource.
1245
+ * Defaults to SMOOTH if SMOOTH codec switching is supported, RELOAD
1246
+ * overwise.
1236
1247
  * @property {string} sourceBufferExtraFeatures
1237
1248
  * Some platforms may need to pass features when initializing the
1238
1249
  * sourceBuffer.
package/karma.conf.js CHANGED
@@ -191,9 +191,6 @@ module.exports = (config) => {
191
191
  // Babel polyfill, required for async/await
192
192
  'node_modules/@babel/polyfill/dist/polyfill.js',
193
193
 
194
- // muxjs module next
195
- 'node_modules/mux.js/dist/mux.min.js',
196
-
197
194
  // codem-isoboxer module next
198
195
  'node_modules/codem-isoboxer/dist/iso_boxer.min.js',
199
196
 
@@ -236,7 +233,9 @@ module.exports = (config) => {
236
233
  {pattern: 'third_party/**/*.js', included: false},
237
234
  {pattern: 'test/**/*.js', included: false},
238
235
  {pattern: 'test/test/assets/*', included: false},
236
+ {pattern: 'test/test/assets/dash-multi-codec/*', included: false},
239
237
  {pattern: 'test/test/assets/3675/*', included: false},
238
+ {pattern: 'test/test/assets/dash-aes-128/*', included: false},
240
239
  {pattern: 'test/test/assets/hls-raw-aac/*', included: false},
241
240
  {pattern: 'test/test/assets/hls-raw-ac3/*', included: false},
242
241
  {pattern: 'test/test/assets/hls-raw-ec3/*', included: false},
@@ -245,8 +244,13 @@ module.exports = (config) => {
245
244
  {pattern: 'test/test/assets/hls-ts-ac3/*', included: false},
246
245
  {pattern: 'test/test/assets/hls-ts-ec3/*', included: false},
247
246
  {pattern: 'test/test/assets/hls-ts-h264/*', included: false},
247
+ {pattern: 'test/test/assets/hls-ts-h265/*', included: false},
248
248
  {pattern: 'test/test/assets/hls-ts-mp3/*', included: false},
249
249
  {pattern: 'test/test/assets/hls-ts-muxed-aac-h264/*', included: false},
250
+ {pattern: 'test/test/assets/hls-ts-muxed-aac-h265/*', included: false},
251
+ {pattern: 'test/test/assets/hls-ts-muxed-ac3-h264/*', included: false},
252
+ {pattern: 'test/test/assets/hls-ts-muxed-mp3-h264/*', included: false},
253
+ {pattern: 'test/test/assets/hls-ts-muxed-ec3-h264/*', included: false},
250
254
  {pattern: 'dist/shaka-player.ui.js', included: false},
251
255
  {pattern: 'dist/locales.js', included: false},
252
256
  {pattern: 'demo/**/*.js', included: false},
@@ -184,13 +184,30 @@ shaka.abr.SimpleAbrManager = class {
184
184
  if (this.resizeObserver_ && this.config_.restrictToElementSize) {
185
185
  const devicePixelRatio =
186
186
  this.config_.ignoreDevicePixelRatio ? 1 : window.devicePixelRatio;
187
- maxHeight = this.mediaElement_.clientHeight * devicePixelRatio;
188
- maxWidth = this.mediaElement_.clientWidth * devicePixelRatio;
187
+ maxHeight = Math.min(
188
+ maxHeight, this.mediaElement_.clientHeight * devicePixelRatio);
189
+ maxWidth = Math.min(
190
+ maxWidth, this.mediaElement_.clientWidth * devicePixelRatio);
189
191
  }
190
192
 
191
193
  // Get sorted Variants.
192
194
  let sortedVariants = SimpleAbrManager.filterAndSortVariants_(
193
- this.config_.restrictions, this.variants_, maxHeight, maxWidth);
195
+ this.config_.restrictions, this.variants_,
196
+ /* maxHeight= */ Infinity, /* maxWidth= */ Infinity);
197
+
198
+ if (maxHeight != Infinity || maxWidth != Infinity) {
199
+ const resolutions = SimpleAbrManager.getResolutionList_(sortedVariants);
200
+ for (const resolution of resolutions) {
201
+ if (resolution.height >= maxHeight && resolution.width >= maxWidth) {
202
+ maxHeight = resolution.height;
203
+ maxWidth = resolution.width;
204
+ break;
205
+ }
206
+ }
207
+
208
+ sortedVariants = SimpleAbrManager.filterAndSortVariants_(
209
+ this.config_.restrictions, this.variants_, maxHeight, maxWidth);
210
+ }
194
211
 
195
212
  const defaultBandwidthEstimate = this.getDefaultBandwidth_();
196
213
  const currentBandwidth = this.bandwidthEstimator_.getBandwidthEstimate(
@@ -435,6 +452,29 @@ shaka.abr.SimpleAbrManager = class {
435
452
  return v1.bandwidth - v2.bandwidth;
436
453
  });
437
454
  }
455
+
456
+ /**
457
+ * @param {!Array.<shaka.extern.Variant>} variants
458
+ * @return {!Array.<{height: number, width: number}>}
459
+ * @private
460
+ */
461
+ static getResolutionList_(variants) {
462
+ const resolutions = [];
463
+ for (const variant of variants) {
464
+ const video = variant.video;
465
+ if (!video || !video.height || !video.width) {
466
+ continue;
467
+ }
468
+ resolutions.push({
469
+ height: video.height,
470
+ width: video.width,
471
+ });
472
+ }
473
+
474
+ return resolutions.sort((v1, v2) => {
475
+ return v1.width - v2.width;
476
+ });
477
+ }
438
478
  };
439
479
 
440
480