shaka-player 3.2.14 → 3.2.15

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 (38) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/deps.js +1 -1
  3. package/dist/locales.js +27 -27
  4. package/dist/shaka-player.compiled.d.ts +1 -1
  5. package/dist/shaka-player.compiled.debug.d.ts +1 -1
  6. package/dist/shaka-player.compiled.debug.externs.js +2 -1
  7. package/dist/shaka-player.compiled.debug.js +74 -73
  8. package/dist/shaka-player.compiled.debug.map +3 -3
  9. package/dist/shaka-player.compiled.externs.js +2 -1
  10. package/dist/shaka-player.compiled.js +542 -540
  11. package/dist/shaka-player.compiled.map +3 -3
  12. package/dist/shaka-player.ui.d.ts +1 -1
  13. package/dist/shaka-player.ui.debug.d.ts +1 -1
  14. package/dist/shaka-player.ui.debug.externs.js +2 -1
  15. package/dist/shaka-player.ui.debug.js +91 -90
  16. package/dist/shaka-player.ui.debug.map +3 -3
  17. package/dist/shaka-player.ui.externs.js +2 -1
  18. package/dist/shaka-player.ui.js +657 -655
  19. package/dist/shaka-player.ui.map +3 -3
  20. package/lib/cast/cast_proxy.js +2 -1
  21. package/lib/cast/cast_receiver.js +19 -5
  22. package/lib/cast/cast_sender.js +2 -1
  23. package/lib/cast/cast_utils.js +16 -6
  24. package/lib/hls/hls_parser.js +1 -0
  25. package/lib/media/playhead.js +23 -1
  26. package/lib/media/streaming_engine.js +3 -12
  27. package/lib/player.js +24 -11
  28. package/lib/util/manifest_parser_utils.js +4 -0
  29. package/package.json +1 -1
  30. package/test/cast/cast_receiver_integration.js +97 -16
  31. package/test/cast/cast_receiver_unit.js +17 -12
  32. package/test/cast/cast_utils_unit.js +1 -0
  33. package/test/media/playhead_unit.js +41 -0
  34. package/test/media/streaming_engine_integration.js +13 -0
  35. package/test/media/streaming_engine_unit.js +23 -8
  36. package/test/player_unit.js +87 -0
  37. package/test/test/util/simple_fakes.js +3 -0
  38. package/ui/controls.js +4 -1
@@ -694,7 +694,8 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
694
694
  // If we are casting, but the first update has not come in yet, use local
695
695
  // getters, but not local methods.
696
696
  if (this.sender_.isCasting() && !this.sender_.hasRemoteProperties()) {
697
- if (shaka.cast.CastUtils.PlayerGetterMethods[name]) {
697
+ if (shaka.cast.CastUtils.PlayerGetterMethods[name] ||
698
+ shaka.cast.CastUtils.LargePlayerGetterMethods[name]) {
698
699
  const value = /** @type {Object} */(this.localPlayer_)[name];
699
700
  goog.asserts.assert(typeof value == 'function',
700
701
  '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
 
@@ -360,7 +360,8 @@ shaka.cast.CastSender = class {
360
360
  return (...args) =>
361
361
  this.remoteAsyncCall_(targetName, property, ...args);
362
362
  }
363
- if (CastUtils.PlayerGetterMethods[property]) {
363
+ if (CastUtils.PlayerGetterMethods[property] ||
364
+ CastUtils.LargePlayerGetterMethods[property]) {
364
365
  return () => this.propertyGetter_(targetName, property);
365
366
  }
366
367
  }
@@ -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.
@@ -2969,6 +2969,7 @@ shaka.hls.HlsParser.TEXT_EXTENSIONS_TO_MIME_TYPES_ = {
2969
2969
  'm4f': 'application/mp4',
2970
2970
  'cmft': 'application/mp4',
2971
2971
  'vtt': 'text/vtt',
2972
+ 'webvtt': 'txt/vtt',
2972
2973
  'ttml': 'application/ttml+xml',
2973
2974
  };
2974
2975
 
@@ -33,6 +33,14 @@ goog.requireType('shaka.media.PresentationTimeline');
33
33
  * @interface
34
34
  */
35
35
  shaka.media.Playhead = class {
36
+ /**
37
+ * Called when the Player is ready to begin playback. Anything that depends
38
+ * on setStartTime() should be done here, not in the constructor.
39
+ *
40
+ * @see https://github.com/shaka-project/shaka-player/issues/4244
41
+ */
42
+ ready() {}
43
+
36
44
  /**
37
45
  * Set the start time. If the content has already started playback, this will
38
46
  * be ignored.
@@ -76,6 +84,14 @@ shaka.media.SrcEqualsPlayhead = class {
76
84
 
77
85
  /** @private {shaka.util.EventManager} */
78
86
  this.eventManager_ = new shaka.util.EventManager();
87
+ }
88
+
89
+ /** @override */
90
+ ready() {
91
+ goog.asserts.assert(
92
+ this.mediaElement_ != null,
93
+ 'Playhead should not be released before calling ready()',
94
+ );
79
95
 
80
96
  // We listen for the loaded-data-event so that we know when we can
81
97
  // interact with |currentTime|.
@@ -88,6 +104,7 @@ shaka.media.SrcEqualsPlayhead = class {
88
104
  this.eventManager_.listenOnce(this.mediaElement_, 'seeking', () => {
89
105
  this.started_ = true;
90
106
  });
107
+
91
108
  const currentTime = this.mediaElement_.currentTime;
92
109
  // Using the currentTime allows using a negative number in Live HLS
93
110
  const newTime = Math.max(0, currentTime + this.startTime_);
@@ -211,7 +228,12 @@ shaka.media.MediaSourcePlayhead = class {
211
228
  /** @type {shaka.util.Timer} */
212
229
  this.checkWindowTimer_ = new shaka.util.Timer(() => {
213
230
  this.onPollWindow_();
214
- }).tickEvery(/* seconds= */ 0.25);
231
+ });
232
+ }
233
+
234
+ /** @override */
235
+ ready() {
236
+ this.checkWindowTimer_.tickEvery(/* seconds= */ 0.25);
215
237
  }
216
238
 
217
239
  /** @override */
@@ -1355,16 +1355,6 @@ shaka.media.StreamingEngine = class {
1355
1355
  this.mediaStates_.delete(ContentType.TEXT);
1356
1356
  } else if (error.code == shaka.util.Error.Code.QUOTA_EXCEEDED_ERROR) {
1357
1357
  this.handleQuotaExceeded_(mediaState, error);
1358
- } else if (error.code == shaka.util.Error.Code.BAD_HTTP_STATUS &&
1359
- error.data && error.data[1] == 404) {
1360
- // The segment could not be found, does not exist, or is not available.
1361
- // In any case just try again.
1362
- // The current segment is not available. Schedule another update to
1363
- // fetch the segment again.
1364
- shaka.log.v2(logPrefix, 'segment not available.');
1365
- mediaState.performingUpdate = false;
1366
- mediaState.updateTimer = null;
1367
- this.scheduleUpdate_(mediaState, 1);
1368
1358
  } else {
1369
1359
  shaka.log.error(logPrefix, 'failed fetch and append: code=' +
1370
1360
  error.code);
@@ -1379,9 +1369,10 @@ shaka.media.StreamingEngine = class {
1379
1369
 
1380
1370
  /**
1381
1371
  * Clear per-stream error states and retry any failed streams.
1372
+ * @param {number} delaySeconds
1382
1373
  * @return {boolean} False if unable to retry.
1383
1374
  */
1384
- retry() {
1375
+ retry(delaySeconds) {
1385
1376
  if (this.destroyer_.destroyed()) {
1386
1377
  shaka.log.error('Unable to retry after StreamingEngine is destroyed!');
1387
1378
  return false;
@@ -1398,7 +1389,7 @@ shaka.media.StreamingEngine = class {
1398
1389
  if (mediaState.hasError) {
1399
1390
  shaka.log.info(logPrefix, 'Retrying after failure...');
1400
1391
  mediaState.hasError = false;
1401
- this.scheduleUpdate_(mediaState, 0.1);
1392
+ this.scheduleUpdate_(mediaState, delaySeconds);
1402
1393
  }
1403
1394
  }
1404
1395
 
package/lib/player.js CHANGED
@@ -1933,6 +1933,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1933
1933
  shaka.util.StreamUtils.variantToTrack(initialVariant));
1934
1934
  }
1935
1935
 
1936
+ this.playhead_.ready();
1937
+
1936
1938
  // Decide if text should be shown automatically.
1937
1939
  // similar to video/audio track, we would skip switch initial text track
1938
1940
  // if user already pick text track (via selectTextTrack api)
@@ -2263,6 +2265,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2263
2265
  HTMLMediaElement.HAVE_METADATA,
2264
2266
  this.loadEventManager_,
2265
2267
  () => {
2268
+ this.playhead_.ready();
2266
2269
  fullyLoaded.resolve();
2267
2270
  });
2268
2271
 
@@ -4792,12 +4795,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
4792
4795
  * If the player has loaded content, and streaming seen an error, but the
4793
4796
  * could not resume streaming, this will return <code>false</code>.
4794
4797
  *
4798
+ * @param {number=} retryDelaySeconds
4795
4799
  * @return {boolean}
4796
4800
  * @export
4797
4801
  */
4798
- retryStreaming() {
4802
+ retryStreaming(retryDelaySeconds = 0.1) {
4799
4803
  return this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE ?
4800
- this.streamingEngine_.retry() :
4804
+ this.streamingEngine_.retry(retryDelaySeconds) :
4801
4805
  false;
4802
4806
  }
4803
4807
 
@@ -4893,17 +4897,26 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
4893
4897
  * @private
4894
4898
  */
4895
4899
  defaultStreamingFailureCallback_(error) {
4896
- const retryErrorCodes = [
4897
- shaka.util.Error.Code.BAD_HTTP_STATUS,
4898
- shaka.util.Error.Code.HTTP_ERROR,
4899
- shaka.util.Error.Code.TIMEOUT,
4900
- ];
4900
+ // For live streams, we retry streaming automatically for certain errors.
4901
+ // For VOD streams, all streaming failures are fatal.
4902
+ if (!this.isLive()) {
4903
+ return;
4904
+ }
4901
4905
 
4902
- if (this.isLive() && retryErrorCodes.includes(error.code)) {
4903
- error.severity = shaka.util.Error.Severity.RECOVERABLE;
4906
+ let retryDelaySeconds = null;
4907
+ if (error.code == shaka.util.Error.Code.BAD_HTTP_STATUS ||
4908
+ error.code == shaka.util.Error.Code.HTTP_ERROR) {
4909
+ // These errors can be near-instant, so delay a bit before retrying.
4910
+ retryDelaySeconds = 1;
4911
+ } else if (error.code == shaka.util.Error.Code.TIMEOUT) {
4912
+ // We already waited for a timeout, so retry quickly.
4913
+ retryDelaySeconds = 0.1;
4914
+ }
4904
4915
 
4916
+ if (retryDelaySeconds != null) {
4917
+ error.severity = shaka.util.Error.Severity.RECOVERABLE;
4905
4918
  shaka.log.warning('Live streaming error. Retrying automatically...');
4906
- this.retryStreaming();
4919
+ this.retryStreaming(retryDelaySeconds);
4907
4920
  }
4908
4921
  }
4909
4922
 
@@ -6431,7 +6444,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6431
6444
  * @define {string} A version number taken from git at compile time.
6432
6445
  * @export
6433
6446
  */
6434
- shaka.Player.version = 'v3.2.14-uncompiled';
6447
+ shaka.Player.version = 'v3.2.15-uncompiled';
6435
6448
 
6436
6449
  // Initialize the deprecation system using the version string we just set
6437
6450
  // on the player.
@@ -168,6 +168,7 @@ shaka.util.ManifestParserUtils.VIDEO_CODEC_REGEXPS_ = [
168
168
  /^hvc/,
169
169
  /^vp0?[89]/,
170
170
  /^av01/,
171
+ /^dvhe/,
171
172
  ];
172
173
 
173
174
 
@@ -183,6 +184,9 @@ shaka.util.ManifestParserUtils.AUDIO_CODEC_REGEXPS_ = [
183
184
  /^flac$/,
184
185
  /^mp4a/,
185
186
  /^[ae]c-3$/,
187
+ /^ac-4$/,
188
+ /^dts[cx]$/, // DTS Surround Sound
189
+ /^[du]dts$/, // DTS Surround Sound
186
190
  ];
187
191
 
188
192
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shaka-player",
3
3
  "description": "DASH/EME video player library",
4
- "version": "3.2.14",
4
+ "version": "3.2.15",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -34,6 +34,8 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
34
34
 
35
35
  /** @type {shaka.util.PublicPromise} */
36
36
  let messageWaitPromise;
37
+ /** @type {Array.<string>} */
38
+ let pendingMessages = null;
37
39
 
38
40
  /** @type {!Array.<function()>} */
39
41
  let toRestore;
@@ -91,6 +93,9 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
91
93
  toRestore = [];
92
94
  pendingWaitWrapperCalls = 0;
93
95
 
96
+ messageWaitPromise = null;
97
+ pendingMessages = null;
98
+
94
99
  fakeInitState = {
95
100
  player: {
96
101
  configure: {},
@@ -118,6 +123,12 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
118
123
  player = null;
119
124
  video = null;
120
125
  receiver = null;
126
+
127
+ if (messageWaitPromise) {
128
+ messageWaitPromise.resolve([]);
129
+ }
130
+ messageWaitPromise = null;
131
+ pendingMessages = null;
121
132
  });
122
133
 
123
134
  afterAll(() => {
@@ -128,6 +139,66 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
128
139
  }
129
140
  });
130
141
 
142
+ describe('without drm', () => {
143
+ it('sends reasonably-sized updates', async () => {
144
+ // Use an unencrypted asset.
145
+ fakeInitState.manifest = 'test:sintel';
146
+
147
+ const p = waitForLoadedData();
148
+
149
+ // Start the process of loading by sending a fake init message.
150
+ fakeConnectedSenders(1);
151
+ fakeIncomingMessage({
152
+ type: 'init',
153
+ initState: fakeInitState,
154
+ appData: {},
155
+ }, mockShakaMessageBus);
156
+
157
+ await p;
158
+ // Wait for an update message.
159
+ const messages = await waitForUpdateMessages();
160
+ for (const message of messages) {
161
+ // Check that the update message is of a reasonable size. From previous
162
+ // testing we found that the socket would silently reject data that got
163
+ // too big. 6KB is safely below the limit.
164
+ expect(message.length).toBeLessThan(6000);
165
+ }
166
+ });
167
+
168
+ it('has reasonable average message size', async () => {
169
+ // Use an unencrypted asset.
170
+ fakeInitState.manifest = 'test:sintel';
171
+
172
+ const p = waitForLoadedData();
173
+
174
+ // Start the process of loading by sending a fake init message.
175
+ fakeConnectedSenders(1);
176
+ fakeIncomingMessage({
177
+ type: 'init',
178
+ initState: fakeInitState,
179
+ appData: {},
180
+ }, mockShakaMessageBus);
181
+
182
+ await p;
183
+
184
+ // Collect messages over 50 update cycles, and average their length.
185
+ // Not all properties are passed along on every update message, so
186
+ // the average length is expected to be lower than the length of the first
187
+ // update message.
188
+ let totalLength = 0;
189
+ let totalMessages = 0;
190
+ for (let i = 0; i < 50; i++) {
191
+ // eslint-disable-next-line no-await-in-loop
192
+ const messages = await waitForUpdateMessages();
193
+ for (const message of messages) {
194
+ totalLength += message.length;
195
+ totalMessages += 1;
196
+ }
197
+ }
198
+ expect(totalLength / totalMessages).toBeLessThan(2000);
199
+ });
200
+ });
201
+
131
202
  filterDescribe('with drm', () => support['com.widevine.alpha'], () => {
132
203
  drmIt('sends reasonably-sized updates', async () => {
133
204
  // Use an encrypted asset, to make sure DRM info doesn't balloon the size.
@@ -150,11 +221,13 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
150
221
 
151
222
  await p;
152
223
  // Wait for an update message.
153
- const message = await waitForUpdateMessage();
154
- // Check that the update message is of a reasonable size. From previous
155
- // testing we found that the socket would silently reject data that got
156
- // too big. 6KB is safely below the limit.
157
- expect(message.length).toBeLessThan(7 * 1024);
224
+ const messages = await waitForUpdateMessages();
225
+ for (const message of messages) {
226
+ // Check that the update message is of a reasonable size. From previous
227
+ // testing we found that the socket would silently reject data that got
228
+ // too big. 6KB is safely below the limit.
229
+ expect(message.length).toBeLessThan(6000);
230
+ }
158
231
  });
159
232
 
160
233
  drmIt('has reasonable average message size', async () => {
@@ -177,17 +250,22 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
177
250
  }, mockShakaMessageBus);
178
251
 
179
252
  await p;
180
- // Collect 50 update messages, and average their length.
253
+
254
+ // Collect messages over 50 update cycles, and average their length.
181
255
  // Not all properties are passed along on every update message, so
182
256
  // the average length is expected to be lower than the length of the first
183
257
  // update message.
184
258
  let totalLength = 0;
259
+ let totalMessages = 0;
185
260
  for (let i = 0; i < 50; i++) {
186
261
  // eslint-disable-next-line no-await-in-loop
187
- const message = await waitForUpdateMessage();
188
- totalLength += message.length;
262
+ const messages = await waitForUpdateMessages();
263
+ for (const message of messages) {
264
+ totalLength += message.length;
265
+ totalMessages += 1;
266
+ }
189
267
  }
190
- expect(totalLength / 50).toBeLessThan(3000);
268
+ expect(totalLength / totalMessages).toBeLessThan(2000);
191
269
  });
192
270
  });
193
271
 
@@ -227,12 +305,12 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
227
305
  expect(pendingWaitWrapperCalls).toBe(0);
228
306
 
229
307
  // Wait for a final update message before proceeding.
230
- await waitForUpdateMessage();
308
+ await waitForUpdateMessages();
231
309
  });
232
310
 
233
311
  /**
234
312
  * Creates a wrapper around a method on a given prototype, which makes it
235
- * wait on waitForUpdateMessage before returning, and registers that wrapper
313
+ * wait on waitForUpdateMessages before returning, and registers that wrapper
236
314
  * to be uninstalled afterwards.
237
315
  * The replaced method is expected to be a method that returns a promise.
238
316
  * @param {!Object} prototype
@@ -249,7 +327,7 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
249
327
  'Waiting for update message before calling ' +
250
328
  name + '.' + methodName + '...');
251
329
  const originalArguments = Array.from(arguments);
252
- await waitForUpdateMessage();
330
+ await waitForUpdateMessages();
253
331
  // eslint-disable-next-line no-restricted-syntax
254
332
  return original.apply(this, originalArguments);
255
333
  };
@@ -265,7 +343,8 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
265
343
  });
266
344
  }
267
345
 
268
- function waitForUpdateMessage() {
346
+ function waitForUpdateMessages() {
347
+ pendingMessages = [];
269
348
  messageWaitPromise = new shaka.util.PublicPromise();
270
349
  return messageWaitPromise;
271
350
  }
@@ -316,10 +395,12 @@ filterDescribe('CastReceiver', castReceiverIntegrationSupport, () => {
316
395
  bus.messages.push(CastUtils.deserialize(message));
317
396
  // Check to see if it's an update message.
318
397
  const parsed = CastUtils.deserialize(message);
319
- if (parsed.type == 'update' && messageWaitPromise) {
398
+ if (parsed.type == 'update' && pendingMessages) {
320
399
  shaka.log.debug('Received update message. Proceeding...');
321
- messageWaitPromise.resolve(message);
322
- messageWaitPromise = null;
400
+ // The code waiting on this Promise will get an array of all of the
401
+ // messages processed within this tick.
402
+ pendingMessages.push(message);
403
+ messageWaitPromise.resolve(pendingMessages);
323
404
  }
324
405
  });
325
406
  const channel = {
@@ -245,18 +245,20 @@ filterDescribe('CastReceiver', castReceiverSupport, () => {
245
245
  const fakeEvent = {type: 'timeupdate'};
246
246
  mockVideo.on['timeupdate'](fakeEvent);
247
247
 
248
- // There are now "update" and "event" messages, in that order.
249
- expect(mockShakaMessageBus.messages).toEqual([
250
- {
251
- type: 'update',
252
- update: jasmine.any(Object),
253
- },
254
- {
255
- type: 'event',
256
- targetName: 'video',
257
- event: jasmine.objectContaining(fakeEvent),
258
- },
259
- ]);
248
+ // There are now some number of "update" and "event" messages, in that
249
+ // order.
250
+ expect(mockShakaMessageBus.messages).toContain({
251
+ type: 'update',
252
+ update: jasmine.any(Object),
253
+ });
254
+ expect(mockShakaMessageBus.messages).toContain({
255
+ type: 'event',
256
+ targetName: 'video',
257
+ event: jasmine.objectContaining(fakeEvent),
258
+ });
259
+ const eventIndex = mockShakaMessageBus.messages.findIndex(
260
+ (message) => message.type == 'event');
261
+ expect(eventIndex).toBe(mockShakaMessageBus.messages.length - 1);
260
262
  });
261
263
  });
262
264
 
@@ -1105,6 +1107,9 @@ filterDescribe('CastReceiver', castReceiverSupport, () => {
1105
1107
  for (const name in CastUtils.PlayerGetterMethods) {
1106
1108
  player[name] = jasmine.createSpy(name);
1107
1109
  }
1110
+ for (const name in CastUtils.LargePlayerGetterMethods) {
1111
+ player[name] = jasmine.createSpy(name);
1112
+ }
1108
1113
  for (const name in CastUtils.PlayerGetterMethodsThatRequireLive) {
1109
1114
  player[name] = jasmine.createSpy(name);
1110
1115
  }
@@ -34,6 +34,7 @@ describe('CastUtils', () => {
34
34
  const castMembers = CastUtils.PlayerVoidMethods
35
35
  .concat(CastUtils.PlayerPromiseMethods)
36
36
  .concat(Object.keys(CastUtils.PlayerGetterMethods))
37
+ .concat(Object.keys(CastUtils.LargePlayerGetterMethods))
37
38
  .concat(Object.keys(CastUtils.PlayerGetterMethodsThatRequireLive));
38
39
  // eslint-disable-next-line no-restricted-syntax
39
40
  const allPlayerMembers = Object.getOwnPropertyNames(shaka.Player.prototype);