@srgssr/pillarbox-web 1.27.0 → 1.29.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.
@@ -93,7 +93,7 @@
93
93
  return "symbol" == typeof i ? i : i + "";
94
94
  }
95
95
 
96
- const version$8 = "1.26.0";
96
+ const version$8 = "1.28.0";
97
97
 
98
98
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
99
99
 
@@ -71091,24 +71091,6 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
71091
71091
  return ranges;
71092
71092
  }
71093
71093
 
71094
- /**
71095
- * Overrides the default `src` behavior to ensure the underlying tech is fully
71096
- * reset before setting a new source.
71097
- *
71098
- * This is a workaround for a Video.js issue where, under certain failure cases the
71099
- * internal `src_` reload logic is not triggered. As a result, the previous media
71100
- * can continue playing in the background even though the new source failed.
71101
- *
71102
- * @see https://docs.videojs.com/player#src
71103
- */
71104
- src(source) {
71105
- if (source) {
71106
- this.poster(null);
71107
- this.techCall_('reset');
71108
- }
71109
- super.src(source);
71110
- }
71111
-
71112
71094
  /**
71113
71095
  * A getter/setter for the media's text track.
71114
71096
  * Activates the text track according to the language and kind properties.
@@ -72784,7 +72766,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
72784
72766
  }
72785
72767
  this.sendEvent('ERROR', _objectSpread2(_objectSpread2({
72786
72768
  audio,
72787
- log: JSON.stringify(error.metadata || pillarbox.log.history().slice(-15)),
72769
+ log: JSON.stringify(error.metadata || {
72770
+ history: pillarbox.log.history().slice(-15),
72771
+ playedRanges: this.player.playedRanges()
72772
+ }),
72788
72773
  message: error.message,
72789
72774
  name: PillarboxMonitoring.errorKeyCode(error.code)
72790
72775
  }, playbackPosition), {}, {
@@ -73240,12 +73225,16 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
73240
73225
  const stream_type = isFinite(this.player.duration()) ? 'On-demand' : 'Live';
73241
73226
  const stall = this.stallInfo();
73242
73227
  const subtitles = this.currentTextTrack();
73228
+ const log = JSON.stringify({
73229
+ playedRanges: this.player.playedRanges()
73230
+ });
73243
73231
  const data = {
73244
73232
  audio,
73245
73233
  bandwidth,
73246
73234
  bitrate,
73247
73235
  buffered_duration,
73248
73236
  frame_drops,
73237
+ log,
73249
73238
  playback_duration,
73250
73239
  position,
73251
73240
  position_timestamp,
@@ -74499,21 +74488,17 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74499
74488
  * @param {Player} player
74500
74489
  * @param {Array<Segment>} [segments=[]]
74501
74490
  */
74502
- static addBlockedSegments(player, segments = []) {
74503
- const trackId = 'srgssr-blocked-segments';
74504
- const removeTrack = player.textTracks().getTrackById(trackId);
74505
- if (removeTrack) {
74506
- player.textTracks().removeTrack(removeTrack);
74507
- }
74508
- if (!Array.isArray(segments) || !segments.length) return;
74509
- const blockedSegments = segments.filter(segment => segment.blockReason);
74510
- if (!blockedSegments.length) return;
74511
- SrgSsr.createTextTrack(player, trackId).then(segmentTrack => {
74491
+ static addBlockedSegments(_x) {
74492
+ return _asyncToGenerator(function* (player, segments = []) {
74493
+ const trackId = 'srgssr-blocked-segments';
74494
+ const segmentTrack = yield SrgSsr.createTextTrack(player, trackId);
74495
+ if (!Array.isArray(segments) || !segments.length) return;
74496
+ const blockedSegments = segments.filter(segment => segment.blockReason);
74497
+ if (!blockedSegments.length) return;
74512
74498
  blockedSegments.forEach(segment => {
74513
74499
  SrgSsr.addTextTrackCue(segmentTrack, segment);
74514
74500
  });
74515
- player.textTracks().addTrack(segmentTrack);
74516
- });
74501
+ }).apply(this, arguments);
74517
74502
  }
74518
74503
 
74519
74504
  /**
@@ -74577,20 +74562,16 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74577
74562
  * @param {string} chapterUrn The URN of the main chapter.
74578
74563
  * @param {Array.<Chapter>} [chapters=[]]
74579
74564
  */
74580
- static addChapters(player, chapterUrn, chapters = []) {
74581
- const trackId = 'srgssr-chapters';
74582
- const removeTrack = player.textTracks().getTrackById(trackId);
74583
- if (removeTrack) {
74584
- player.textTracks().removeTrack(removeTrack);
74585
- }
74586
- if (!Array.isArray(chapters) || !chapters.length) return;
74587
- SrgSsr.createTextTrack(player, trackId).then(chapterTrack => {
74565
+ static addChapters(_x2, _x3) {
74566
+ return _asyncToGenerator(function* (player, chapterUrn, chapters = []) {
74567
+ const trackId = 'srgssr-chapters';
74568
+ const chapterTrack = yield SrgSsr.createTextTrack(player, trackId);
74569
+ if (!Array.isArray(chapters) || !chapters.length) return;
74588
74570
  chapters.forEach(chapter => {
74589
74571
  if (chapterUrn !== chapter.fullLengthUrn) return;
74590
74572
  SrgSsr.addTextTrackCue(chapterTrack, chapter);
74591
74573
  });
74592
- player.textTracks().addTrack(chapterTrack);
74593
- });
74574
+ }).apply(this, arguments);
74594
74575
  }
74595
74576
 
74596
74577
  /**
@@ -74599,19 +74580,15 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74599
74580
  * @param {Player} player
74600
74581
  * @param {Array.<TimeInterval>} [intervals=[]]
74601
74582
  */
74602
- static addIntervals(player, intervals = []) {
74603
- const trackId = 'srgssr-intervals';
74604
- const removeTrack = player.textTracks().getTrackById(trackId);
74605
- if (removeTrack) {
74606
- player.textTracks().removeTrack(removeTrack);
74607
- }
74608
- if (!Array.isArray(intervals) || !intervals.length) return;
74609
- SrgSsr.createTextTrack(player, trackId).then(intervalTrack => {
74583
+ static addIntervals(_x4) {
74584
+ return _asyncToGenerator(function* (player, intervals = []) {
74585
+ const trackId = 'srgssr-intervals';
74586
+ const intervalTrack = yield SrgSsr.createTextTrack(player, trackId);
74587
+ if (!Array.isArray(intervals) || !intervals.length) return;
74610
74588
  intervals.forEach(interval => {
74611
74589
  SrgSsr.addTextTrackCue(intervalTrack, interval);
74612
74590
  });
74613
- player.textTracks().addTrack(intervalTrack);
74614
- });
74591
+ }).apply(this, arguments);
74615
74592
  }
74616
74593
 
74617
74594
  /**
@@ -74715,7 +74692,9 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74715
74692
  }
74716
74693
 
74717
74694
  /**
74718
- * Create a new metadata text track.
74695
+ * Create a new metadata text track and add it to the player.
74696
+ *
74697
+ * If a text track with the same trackId exists, it is deleted beforehand.
74719
74698
  *
74720
74699
  * @param {Player} player
74721
74700
  * @param {String} trackId Text track unique ID
@@ -74723,17 +74702,26 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74723
74702
  * @returns {Promise<TextTrack>}
74724
74703
  */
74725
74704
  static createTextTrack(player, trackId) {
74726
- // See https://github.com/videojs/video.js/issues/8519
74727
- return new Promise(resolve => {
74728
- setTimeout(() => {
74729
- resolve(new pillarbox.TextTrack({
74730
- id: trackId,
74731
- kind: 'metadata',
74732
- label: trackId,
74733
- tech: player.tech(true)
74734
- }));
74735
- }, 100);
74736
- });
74705
+ return _asyncToGenerator(function* () {
74706
+ const removeTrack = player.textTracks().getTrackById(trackId);
74707
+ if (removeTrack) {
74708
+ player.textTracks().removeTrack(removeTrack);
74709
+ }
74710
+
74711
+ // See https://github.com/videojs/video.js/issues/8519
74712
+ const textTrack = yield new Promise(resolve => {
74713
+ setTimeout(() => {
74714
+ resolve(new pillarbox.TextTrack({
74715
+ id: trackId,
74716
+ kind: 'metadata',
74717
+ label: trackId,
74718
+ tech: player.tech(true)
74719
+ }));
74720
+ }, 100);
74721
+ });
74722
+ player.textTracks().addTrack(textTrack);
74723
+ return textTrack;
74724
+ })();
74737
74725
  }
74738
74726
 
74739
74727
  /**
@@ -74876,7 +74864,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
74876
74864
  *
74877
74865
  * @returns {Promise<MediaComposition>}
74878
74866
  */
74879
- static getMediaComposition(_x) {
74867
+ static getMediaComposition(_x5) {
74880
74868
  return _asyncToGenerator(function* (urn, handleRequest = new DataProvider().handleRequest()) {
74881
74869
  const data = yield handleRequest(urn);
74882
74870
  return Object.assign(new MediaComposition(), data);
@@ -75103,7 +75091,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75103
75091
  var _ref = _asyncToGenerator(function* (srcObj, next) {
75104
75092
  return SrgSsr.handleSetSource(player, srcObj, next);
75105
75093
  });
75106
- return function setSource(_x2, _x3) {
75094
+ return function setSource(_x6, _x7) {
75107
75095
  return _ref.apply(this, arguments);
75108
75096
  };
75109
75097
  }()