shaka-player 4.2.13 → 4.2.14

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 (53) hide show
  1. package/.github/workflows/build-and-test.yaml +11 -18
  2. package/.github/workflows/compute-incremental-coverage.py +3 -0
  3. package/.github/workflows/selenium-lab-tests.yaml +45 -10
  4. package/CHANGELOG.md +11 -0
  5. package/demo/common/assets.js +12 -12
  6. package/demo/main.js +5 -0
  7. package/dist/demo.compiled.debug.js +13 -13
  8. package/dist/demo.compiled.debug.map +2 -2
  9. package/dist/demo.compiled.js +13 -13
  10. package/dist/demo.compiled.map +2 -2
  11. package/dist/locales.js +33 -33
  12. package/dist/receiver.compiled.debug.js +8 -8
  13. package/dist/receiver.compiled.debug.map +1 -1
  14. package/dist/receiver.compiled.js +8 -8
  15. package/dist/receiver.compiled.map +1 -1
  16. package/dist/shaka-player.compiled.d.ts +2 -2
  17. package/dist/shaka-player.compiled.debug.d.ts +2 -2
  18. package/dist/shaka-player.compiled.debug.js +29 -26
  19. package/dist/shaka-player.compiled.debug.map +3 -3
  20. package/dist/shaka-player.compiled.js +76 -76
  21. package/dist/shaka-player.compiled.map +2 -2
  22. package/dist/shaka-player.ui.d.ts +2 -2
  23. package/dist/shaka-player.ui.debug.d.ts +2 -2
  24. package/dist/shaka-player.ui.debug.js +36 -33
  25. package/dist/shaka-player.ui.debug.map +3 -3
  26. package/dist/shaka-player.ui.js +65 -65
  27. package/dist/shaka-player.ui.map +2 -2
  28. package/externs/shaka/manifest.js +5 -1
  29. package/externs/shaka/offline.js +5 -1
  30. package/karma.conf.js +2 -0
  31. package/lib/ads/client_side_ad_manager.js +14 -2
  32. package/lib/dash/dash_parser.js +1 -0
  33. package/lib/hls/hls_parser.js +1 -0
  34. package/lib/media/media_source_engine.js +6 -5
  35. package/lib/media/streaming_engine.js +2 -2
  36. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  37. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  38. package/lib/offline/manifest_converter.js +1 -0
  39. package/lib/offline/storage.js +1 -0
  40. package/lib/player.js +4 -1
  41. package/lib/util/periods.js +2 -0
  42. package/lib/util/platform.js +8 -0
  43. package/package.json +2 -2
  44. package/test/media/adaptation_set_unit.js +1 -0
  45. package/test/media/media_source_engine_unit.js +1 -1
  46. package/test/offline/manifest_convert_unit.js +5 -0
  47. package/test/player_integration.js +4 -1
  48. package/test/test/util/manifest_generator.js +2 -0
  49. package/test/test/util/offline_utils.js +1 -0
  50. package/test/test/util/streaming_engine_util.js +3 -0
  51. package/test/test/util/ui_utils.js +5 -1
  52. package/ui/externs/ui.js +2 -2
  53. package/ui/seek_bar.js +7 -1
@@ -321,7 +321,8 @@ shaka.extern.FetchCryptoKeysFunction;
321
321
  * tilesLayout: (string|undefined),
322
322
  * matchedStreams:
323
323
  * (!Array.<shaka.extern.Stream>|!Array.<shaka.extern.StreamDB>|
324
- * undefined)
324
+ * undefined),
325
+ * external: boolean
325
326
  * }}
326
327
  *
327
328
  * @description
@@ -434,6 +435,9 @@ shaka.extern.FetchCryptoKeysFunction;
434
435
  * @property {(!Array.<shaka.extern.Stream>|!Array.<shaka.extern.StreamDB>|
435
436
  * undefined)} matchedStreams
436
437
  * The streams in all periods which match the stream. Used for Dash.
438
+ * @property {boolean} external
439
+ * Indicate if the stream was added externally.
440
+ * Eg: external text tracks.
437
441
  *
438
442
  * @exportDoc
439
443
  */
@@ -132,7 +132,8 @@ shaka.extern.ManifestDB;
132
132
  * audioSamplingRate: ?number,
133
133
  * spatialAudio: boolean,
134
134
  * closedCaptions: Map.<string, string>,
135
- * tilesLayout: (string|undefined)
135
+ * tilesLayout: (string|undefined),
136
+ * external: boolean
136
137
  * }}
137
138
  *
138
139
  * @property {number} id
@@ -193,6 +194,9 @@ shaka.extern.ManifestDB;
193
194
  * The value is a grid-item-dimension consisting of two positive decimal
194
195
  * integers in the format: column-x-row ('4x3'). It describes the arrangement
195
196
  * of Images in a Grid. The minimum valid LAYOUT is '1x1'.
197
+ * @property {boolean} external
198
+ * Indicate if the stream was added externally.
199
+ * Eg: external text tracks.
196
200
  */
197
201
  shaka.extern.StreamDB;
198
202
 
package/karma.conf.js CHANGED
@@ -351,6 +351,8 @@ module.exports = (config) => {
351
351
  },
352
352
 
353
353
  babelPreprocessor: {
354
+ // Cache results in .babel-cache
355
+ cachePath: '.babel-cache',
354
356
  options: {
355
357
  presets: ['@babel/preset-env'],
356
358
  // Add source maps so that backtraces refer to the original code.
@@ -33,6 +33,9 @@ shaka.ads.ClientSideAdManager = class {
33
33
  /** @private {HTMLMediaElement} */
34
34
  this.video_ = video;
35
35
 
36
+ /** @private {boolean} */
37
+ this.videoPlayed_ = false;
38
+
36
39
  /** @private {ResizeObserver} */
37
40
  this.resizeObserver_ = null;
38
41
 
@@ -82,6 +85,10 @@ shaka.ads.ClientSideAdManager = class {
82
85
  this.eventManager_.listen(this.video_, 'ended', () => {
83
86
  this.adsLoader_.contentComplete();
84
87
  });
88
+
89
+ this.eventManager_.listenOnce(this.video_, 'play', () => {
90
+ this.videoPlayed_ = true;
91
+ });
85
92
  }
86
93
 
87
94
  /**
@@ -219,9 +226,14 @@ shaka.ads.ClientSideAdManager = class {
219
226
  // seen the ads actually play until requestAds() is called.
220
227
  // Note: We listen for a play event to avoid autoplay issues that might
221
228
  // crash IMA.
222
- this.eventManager_.listenOnce(this.video_, 'play', () => {
229
+ if (this.videoPlayed_) {
223
230
  this.imaAdsManager_.start();
224
- });
231
+ } else {
232
+ this.eventManager_.listenOnce(this.video_, 'play', () => {
233
+ this.videoPlayed_ = true;
234
+ this.imaAdsManager_.start();
235
+ });
236
+ }
225
237
  } catch (adError) {
226
238
  // If there was a problem with the VAST response,
227
239
  // we we won't be getting an ad. Hide ad UI if we showed it already
@@ -1337,6 +1337,7 @@ shaka.dash.DashParser = class {
1337
1337
  hdr,
1338
1338
  tilesLayout,
1339
1339
  matchedStreams: [],
1340
+ external: false,
1340
1341
  };
1341
1342
  }
1342
1343
 
@@ -1757,6 +1757,7 @@ shaka.hls.HlsParser = class {
1757
1757
  closedCaptions,
1758
1758
  hdr: undefined,
1759
1759
  tilesLayout: undefined,
1760
+ external: false,
1760
1761
  };
1761
1762
 
1762
1763
  return {
@@ -354,7 +354,7 @@ shaka.media.MediaSourceEngine = class {
354
354
  let mimeType = shaka.util.MimeUtils.getFullType(
355
355
  stream.mimeType, stream.codecs);
356
356
  if (contentType == ContentType.TEXT) {
357
- this.reinitText(mimeType, sequenceMode);
357
+ this.reinitText(mimeType, sequenceMode, stream.external);
358
358
  } else {
359
359
  if ((forceTransmuxTS || !MediaSource.isTypeSupported(mimeType)) &&
360
360
  shaka.media.Transmuxer.isSupported(mimeType, contentType)) {
@@ -383,13 +383,14 @@ shaka.media.MediaSourceEngine = class {
383
383
  * Reinitialize the TextEngine for a new text type.
384
384
  * @param {string} mimeType
385
385
  * @param {boolean} sequenceMode
386
+ * @param {boolean} external
386
387
  */
387
- reinitText(mimeType, sequenceMode) {
388
+ reinitText(mimeType, sequenceMode, external) {
388
389
  if (!this.textEngine_) {
389
390
  this.textEngine_ = new shaka.text.TextEngine(this.textDisplayer_);
390
391
  }
391
392
  this.textEngine_.initParser(mimeType, sequenceMode,
392
- this.segmentRelativeVttTiming_);
393
+ external || this.segmentRelativeVttTiming_);
393
394
  }
394
395
 
395
396
  /**
@@ -564,7 +565,7 @@ shaka.media.MediaSourceEngine = class {
564
565
  // the video stream, so textEngine may not have been initialized.
565
566
  if (!this.textEngine_) {
566
567
  this.reinitText(shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE,
567
- this.sequenceMode_);
568
+ this.sequenceMode_, /* external= */ false);
568
569
  }
569
570
 
570
571
  if (transmuxedData.metadata) {
@@ -593,7 +594,7 @@ shaka.media.MediaSourceEngine = class {
593
594
  } else if (hasClosedCaptions) {
594
595
  if (!this.textEngine_) {
595
596
  this.reinitText(shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE,
596
- this.sequenceMode_);
597
+ this.sequenceMode_, /* external= */ false);
597
598
  }
598
599
  // If it is the init segment for closed captions, initialize the closed
599
600
  // caption parser.
@@ -240,7 +240,7 @@ shaka.media.StreamingEngine = class {
240
240
  const mimeType = shaka.util.MimeUtils.getFullType(
241
241
  stream.mimeType, stream.codecs);
242
242
  this.playerInterface_.mediaSourceEngine.reinitText(
243
- mimeType, this.manifest_.sequenceMode);
243
+ mimeType, this.manifest_.sequenceMode, stream.external);
244
244
 
245
245
  const textDisplayer =
246
246
  this.playerInterface_.mediaSourceEngine.getTextDisplayer();
@@ -447,7 +447,7 @@ shaka.media.StreamingEngine = class {
447
447
  const fullMimeType = shaka.util.MimeUtils.getFullType(
448
448
  stream.mimeType, stream.codecs);
449
449
  this.playerInterface_.mediaSourceEngine.reinitText(
450
- fullMimeType, this.manifest_.sequenceMode);
450
+ fullMimeType, this.manifest_.sequenceMode, stream.external);
451
451
  }
452
452
 
453
453
  // Releases the segmentIndex of the old stream.
@@ -176,6 +176,7 @@ shaka.offline.indexeddb.V1StorageCell = class
176
176
  spatialAudio: false,
177
177
  closedCaptions: null,
178
178
  tilesLayout: undefined,
179
+ external: false,
179
180
  };
180
181
  }
181
182
 
@@ -125,6 +125,7 @@ shaka.offline.indexeddb.V2StorageCell = class
125
125
  spatialAudio: false,
126
126
  closedCaptions: null,
127
127
  tilesLayout: undefined,
128
+ external: false,
128
129
  };
129
130
  }
130
131
 
@@ -202,6 +202,7 @@ shaka.offline.ManifestConverter = class {
202
202
  spatialAudio: streamDB.spatialAudio,
203
203
  closedCaptions: streamDB.closedCaptions,
204
204
  tilesLayout: streamDB.tilesLayout,
205
+ external: streamDB.external,
205
206
  };
206
207
 
207
208
  return stream;
@@ -1324,6 +1324,7 @@ shaka.offline.Storage = class {
1324
1324
  spatialAudio: stream.spatialAudio,
1325
1325
  closedCaptions: stream.closedCaptions,
1326
1326
  tilesLayout: stream.tilesLayout,
1327
+ external: stream.external,
1327
1328
  };
1328
1329
 
1329
1330
  const startTime =
package/lib/player.js CHANGED
@@ -2233,6 +2233,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2233
2233
  audioSamplingRate: null,
2234
2234
  spatialAudio: false,
2235
2235
  closedCaptions: null,
2236
+ external: false,
2236
2237
  },
2237
2238
  bandwidth: 100,
2238
2239
  allowedByApplication: true,
@@ -4627,6 +4628,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
4627
4628
  audioSamplingRate: null,
4628
4629
  spatialAudio: false,
4629
4630
  closedCaptions: null,
4631
+ external: true,
4630
4632
  };
4631
4633
 
4632
4634
  const fullMimeType = shaka.util.MimeUtils.getFullType(
@@ -5057,6 +5059,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
5057
5059
  audioSamplingRate: null,
5058
5060
  spatialAudio: false,
5059
5061
  closedCaptions: null,
5062
+ external: false,
5060
5063
  };
5061
5064
  manifest.textStreams.push(textStream);
5062
5065
  closedCaptionsSet.add(id);
@@ -6631,7 +6634,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6631
6634
  * @define {string} A version number taken from git at compile time.
6632
6635
  * @export
6633
6636
  */
6634
- shaka.Player.version = 'v4.2.13-uncompiled';
6637
+ shaka.Player.version = 'v4.2.14-uncompiled';
6635
6638
 
6636
6639
  // Initialize the deprecation system using the version string we just set
6637
6640
  // on the player.
@@ -1491,6 +1491,7 @@ shaka.util.PeriodCombiner = class {
1491
1491
  audioSamplingRate: null,
1492
1492
  spatialAudio: false,
1493
1493
  closedCaptions: null,
1494
+ external: false,
1494
1495
  };
1495
1496
  }
1496
1497
 
@@ -1527,6 +1528,7 @@ shaka.util.PeriodCombiner = class {
1527
1528
  audioSamplingRate: null,
1528
1529
  spatialAudio: false,
1529
1530
  closedCaptions: null,
1531
+ external: false,
1530
1532
  };
1531
1533
  }
1532
1534
 
@@ -214,6 +214,7 @@ shaka.util.Platform = class {
214
214
  !shaka.util.Platform.isTizen() &&
215
215
  !shaka.util.Platform.isEOS() &&
216
216
  !shaka.util.Platform.isVirginMedia() &&
217
+ !shaka.util.Platform.isOrange() &&
217
218
  !shaka.util.Platform.isPS4() &&
218
219
  !shaka.util.Platform.isAmazonFireTV();
219
220
  }
@@ -253,6 +254,13 @@ shaka.util.Platform = class {
253
254
  return shaka.util.Platform.userAgentContains_('VirginMedia');
254
255
  }
255
256
 
257
+ /**
258
+ * Check if the current platform is Orange.
259
+ */
260
+ static isOrange() {
261
+ return shaka.util.Platform.userAgentContains_('SOPOpenBrowser');
262
+ }
263
+
256
264
  /**
257
265
  * Check if the current platform is Amazon Fire TV.
258
266
  * https://developer.amazon.com/docs/fire-tv/identify-amazon-fire-tv-devices.html
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": "4.2.13",
4
+ "version": "4.2.14",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -14,6 +14,7 @@
14
14
  "@babel/core": "^7.17.5",
15
15
  "@babel/polyfill": "^7.12.1",
16
16
  "@babel/preset-env": "^7.16.11",
17
+ "@joeyparrish/karma-babel-preprocessor": "^8.2.0",
17
18
  "@teppeis/clutz": "^1.0.29-4c95e12.v20190929",
18
19
  "awesomplete": "^1.1.5",
19
20
  "babel-plugin-istanbul": "^6.1.1",
@@ -38,7 +39,6 @@
38
39
  "js-yaml": "^4.1.0",
39
40
  "jsdoc": "github:joeyparrish/jsdoc#2ca85bb6",
40
41
  "karma": "^6.3.16",
41
- "karma-babel-preprocessor": "^8.0.2",
42
42
  "karma-coverage": "^2.2.0",
43
43
  "karma-jasmine": "^4.0.1",
44
44
  "karma-jasmine-ajax": "^0.1.13",
@@ -218,6 +218,7 @@ describe('AdaptationSet', () => {
218
218
  forced: false,
219
219
  trickModeVideo: null,
220
220
  type: '',
221
+ external: false,
221
222
  };
222
223
  }
223
224
  });
@@ -1258,7 +1258,7 @@ describe('MediaSourceEngine', () => {
1258
1258
  });
1259
1259
 
1260
1260
  it('destroys text engines', async () => {
1261
- mediaSourceEngine.reinitText('text/vtt', false);
1261
+ mediaSourceEngine.reinitText('text/vtt', false, false);
1262
1262
 
1263
1263
  await mediaSourceEngine.destroy();
1264
1264
  expect(mockTextEngine).toBeTruthy();
@@ -316,6 +316,7 @@ describe('ManifestConverter', () => {
316
316
  audioSamplingRate: null,
317
317
  spatialAudio: false,
318
318
  closedCaptions: null,
319
+ external: false,
319
320
  };
320
321
 
321
322
  return streamDB;
@@ -389,6 +390,7 @@ describe('ManifestConverter', () => {
389
390
  spatialAudio: false,
390
391
  closedCaptions: null,
391
392
  tilesLayout: undefined,
393
+ external: false,
392
394
  };
393
395
  }
394
396
 
@@ -438,6 +440,7 @@ describe('ManifestConverter', () => {
438
440
  spatialAudio: false,
439
441
  closedCaptions: null,
440
442
  tilesLayout: undefined,
443
+ external: false,
441
444
  };
442
445
  }
443
446
 
@@ -486,6 +489,7 @@ describe('ManifestConverter', () => {
486
489
  spatialAudio: false,
487
490
  closedCaptions: null,
488
491
  tilesLayout: undefined,
492
+ external: false,
489
493
  };
490
494
  }
491
495
 
@@ -531,6 +535,7 @@ describe('ManifestConverter', () => {
531
535
  spatialAudio: streamDb.spatialAudio,
532
536
  closedCaptions: streamDb.closedCaptions,
533
537
  tilesLayout: streamDb.tilesLayout,
538
+ external: streamDb.external,
534
539
  };
535
540
 
536
541
  expect(stream).toEqual(expectedStream);
@@ -503,7 +503,10 @@ describe('Player', () => {
503
503
  await waiter.timeoutAfter(20).waitUntilPlayheadReaches(video, 5);
504
504
 
505
505
  // Seek the video, and see if it can continue playing from that point.
506
- video.currentTime = 20;
506
+ // If this is a multiple of 10, it tends to flake on Tizen with stall
507
+ // detection disabled. So use 25.
508
+ video.currentTime = 25;
509
+
507
510
  // Expect that we can then reach the end of the video.
508
511
  await waiter.timeoutAfter(40).waitForEnd(video);
509
512
  });
@@ -544,6 +544,8 @@ shaka.test.ManifestGenerator.Stream = class {
544
544
  this.hdr = undefined;
545
545
  /** @type {(string|undefined)} */
546
546
  this.tilesLayout = undefined;
547
+ /** @type {boolean} */
548
+ this.external = false;
547
549
  }
548
550
 
549
551
  /** @type {shaka.extern.Stream} */
@@ -56,6 +56,7 @@ shaka.test.OfflineUtils = class {
56
56
  audioSamplingRate: null,
57
57
  spatialAudio: false,
58
58
  closedCaptions: null,
59
+ external: false,
59
60
  };
60
61
  }
61
62
 
@@ -410,6 +410,7 @@ shaka.test.StreamingEngineUtil = class {
410
410
  roles: [],
411
411
  forced: false,
412
412
  spatialAudio: false,
413
+ external: false,
413
414
  };
414
415
  }
415
416
 
@@ -447,6 +448,7 @@ shaka.test.StreamingEngineUtil = class {
447
448
  roles: [],
448
449
  forced: false,
449
450
  spatialAudio: false,
451
+ external: false,
450
452
  };
451
453
  }
452
454
 
@@ -482,6 +484,7 @@ shaka.test.StreamingEngineUtil = class {
482
484
  roles: [],
483
485
  forced: false,
484
486
  spatialAudio: false,
487
+ external: false,
485
488
  };
486
489
  }
487
490
  };
@@ -169,7 +169,11 @@ shaka.test.UiUtils = class {
169
169
  const video = /** @type {!HTMLVideoElement} */(document.createElement(
170
170
  'video'));
171
171
 
172
- video.muted = true;
172
+ // Tizen has issues with audio-only playbacks on muted video elements.
173
+ // Don't mute Tizen.
174
+ if (!shaka.util.Platform.isTizen()) {
175
+ video.muted = true;
176
+ }
173
177
  video.width = 600;
174
178
  video.height = 400;
175
179
 
package/ui/externs/ui.js CHANGED
@@ -147,8 +147,8 @@ shaka.extern.UIVolumeBarColors;
147
147
  * ROLE means that only the role of the item is shown.
148
148
  * LANGUAGE_ROLE means both language and role are shown, or just language if
149
149
  * there is no role.
150
- * LABEL means the non-standard DASH "label" attribute or the HLS "NAME"
151
- * attribute are shown.
150
+ * LABEL means the non-standard DASH "label" attribute or the standard DASH
151
+ * "Label" element or the HLS "NAME" attribute are shown.
152
152
  * Defaults to LANGUAGE.
153
153
  * @property {number} fadeDelay
154
154
  * The delay (in seconds) before fading out the controls once the user stops
package/ui/seek_bar.js CHANGED
@@ -59,7 +59,13 @@ shaka.ui.SeekBar = class extends shaka.ui.RangeElement {
59
59
  * @private {shaka.util.Timer}
60
60
  */
61
61
  this.seekTimer_ = new shaka.util.Timer(() => {
62
- this.video.currentTime = this.getValue();
62
+ let newCurrentTime = this.getValue();
63
+ if (!this.player.isLive()) {
64
+ if (newCurrentTime == this.video.duration) {
65
+ newCurrentTime -= 0.001;
66
+ }
67
+ }
68
+ this.video.currentTime = newCurrentTime;
63
69
  });
64
70
 
65
71