@srgssr/pillarbox-web 1.36.1 → 1.36.2

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.36.0";
96
+ const version$8 = "1.36.1";
97
97
 
98
98
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
99
99
 
@@ -75003,10 +75003,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75003
75003
  * @param {Array<Segment>} [segments=[]]
75004
75004
  */
75005
75005
  static addBlockedSegments(_x) {
75006
+ var _this = this;
75006
75007
  return _asyncToGenerator(function* (player, segments = []) {
75007
75008
  const trackId = 'srgssr-blocked-segments';
75008
- const blockedSegmentsToAdd = SrgSsr.getBlockedSegments(segments);
75009
- yield SrgSsr.createTextTrack(player, trackId, blockedSegmentsToAdd);
75009
+ const blockedSegmentsToAdd = _this.getBlockedSegments(segments);
75010
+ yield _this.createTextTrack(player, trackId, blockedSegmentsToAdd);
75010
75011
  }).apply(this, arguments);
75011
75012
  }
75012
75013
 
@@ -75067,7 +75068,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75067
75068
  static addTextTrackCues(textTrack, cues = []) {
75068
75069
  if (!Array.isArray(cues)) return;
75069
75070
  cues.forEach(cue => {
75070
- SrgSsr.addTextTrackCue(textTrack, cue);
75071
+ this.addTextTrackCue(textTrack, cue);
75071
75072
  });
75072
75073
  }
75073
75074
 
@@ -75080,10 +75081,10 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75080
75081
  static addTextTracks(player, {
75081
75082
  mediaData
75082
75083
  }) {
75083
- SrgSsr.addRemoteTextTracks(player, mediaData.subtitles);
75084
- SrgSsr.addChapters(player, mediaData.urn, mediaData.chapters);
75085
- SrgSsr.addBlockedSegments(player, mediaData.blockedSegments);
75086
- SrgSsr.addIntervals(player, mediaData.intervals);
75084
+ this.addRemoteTextTracks(player, mediaData.subtitles);
75085
+ this.addChapters(player, mediaData.urn, mediaData.chapters);
75086
+ this.addBlockedSegments(player, mediaData.blockedSegments);
75087
+ this.addIntervals(player, mediaData.intervals);
75087
75088
  }
75088
75089
 
75089
75090
  /**
@@ -75094,10 +75095,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75094
75095
  * @param {Array.<Chapter>} [chapters=[]]
75095
75096
  */
75096
75097
  static addChapters(_x2, _x3) {
75098
+ var _this2 = this;
75097
75099
  return _asyncToGenerator(function* (player, chapterUrn, chapters = []) {
75098
75100
  const trackId = 'srgssr-chapters';
75099
- const chaptersToAdd = SrgSsr.getChapters(chapterUrn, chapters);
75100
- yield SrgSsr.createTextTrack(player, trackId, chaptersToAdd);
75101
+ const chaptersToAdd = _this2.getChapters(chapterUrn, chapters);
75102
+ yield _this2.createTextTrack(player, trackId, chaptersToAdd);
75101
75103
  }).apply(this, arguments);
75102
75104
  }
75103
75105
 
@@ -75108,10 +75110,11 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75108
75110
  * @param {Array.<TimeInterval>} [intervals=[]]
75109
75111
  */
75110
75112
  static addIntervals(_x4) {
75113
+ var _this3 = this;
75111
75114
  return _asyncToGenerator(function* (player, intervals = []) {
75112
75115
  const trackId = 'srgssr-intervals';
75113
- const instervalsToAdd = SrgSsr.getIntervals(intervals);
75114
- yield SrgSsr.createTextTrack(player, trackId, instervalsToAdd);
75116
+ const instervalsToAdd = _this3.getIntervals(intervals);
75117
+ yield _this3.createTextTrack(player, trackId, instervalsToAdd);
75115
75118
  }).apply(this, arguments);
75116
75119
  }
75117
75120
 
@@ -75127,7 +75130,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75127
75130
  static blockingReason(player, srcMediaObj) {
75128
75131
  if (!srcMediaObj.mediaData.blockReason) return;
75129
75132
  const message = player.localize(srcMediaObj.mediaData.blockReason);
75130
- SrgSsr.error(player, {
75133
+ this.error(player, {
75131
75134
  code: MediaError.MEDIA_ERR_ABORTED,
75132
75135
  message,
75133
75136
  metadata: {
@@ -75181,7 +75184,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75181
75184
  * @returns {Promise<Array.<MainResourceWithKeySystems>>}
75182
75185
  */
75183
75186
  static composeMainResources(mediaComposition) {
75184
- return SrgSsr.composeAkamaiResources(SrgSsr.composeKeySystemsResources(SrgSsr.filterIncompatibleResources(mediaComposition.getMainResources())));
75187
+ return this.composeAkamaiResources(this.composeKeySystemsResources(this.filterIncompatibleResources(mediaComposition.getMainResources())));
75185
75188
  }
75186
75189
 
75187
75190
  /**
@@ -75231,6 +75234,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75231
75234
  * @returns {Promise<TextTrack>}
75232
75235
  */
75233
75236
  static createTextTrack(_x5, _x6) {
75237
+ var _this4 = this;
75234
75238
  return _asyncToGenerator(function* (player, trackId, cues = []) {
75235
75239
  const removeTrack = player.remoteTextTracks().getTrackById(trackId);
75236
75240
  if (removeTrack) {
@@ -75247,7 +75251,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75247
75251
 
75248
75252
  // See https://github.com/videojs/video.js/issues/8519
75249
75253
  yield new Promise(resolve => setTimeout(resolve, 100));
75250
- SrgSsr.addTextTrackCues(textTrack.track, cues);
75254
+ _this4.addTextTrackCues(textTrack.track, cues);
75251
75255
  return textTrack.track;
75252
75256
  }).apply(this, arguments);
75253
75257
  }
@@ -75308,7 +75312,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75308
75312
  static dataProviderError(player, error) {
75309
75313
  if (!error) return;
75310
75314
  const statusText = error.statusText ? error.statusText : error.message;
75311
- SrgSsr.error(player, {
75315
+ this.error(player, {
75312
75316
  code: 0,
75313
75317
  message: player.localize('UNKNOWN'),
75314
75318
  metadata: {
@@ -75378,7 +75382,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75378
75382
  * @returns {VTTCue|undefined} The VTT cue of a blocked segment, or undefined
75379
75383
  */
75380
75384
  static getBlockedSegmentByTime(player, currentTime) {
75381
- const blockedSegment = SrgSsr.getBlockedSegment(player);
75385
+ const blockedSegment = this.getBlockedSegment(player);
75382
75386
  if (!blockedSegment) return;
75383
75387
  const isBlocked = currentTime >= blockedSegment.startTime && currentTime < blockedSegment.endTime;
75384
75388
  return isBlocked ? blockedSegment : undefined;
@@ -75462,24 +75466,25 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75462
75466
  * @returns {Promise<ComposedSrcMediaData>} - The composed source media data.
75463
75467
  */
75464
75468
  static getSrcMediaObj(player, srcObj) {
75469
+ var _this5 = this;
75465
75470
  return _asyncToGenerator(function* () {
75466
- if (SrgSsr.pillarboxMonitoring(player)) {
75467
- SrgSsr.pillarboxMonitoring(player).sessionStart();
75471
+ if (_this5.pillarboxMonitoring(player)) {
75472
+ _this5.pillarboxMonitoring(player).sessionStart();
75468
75473
  }
75469
75474
  const {
75470
75475
  src: urn
75471
75476
  } = srcObj,
75472
75477
  srcOptions = _objectWithoutProperties(srcObj, _excluded2);
75473
- const mediaComposition = yield SrgSsr.getMediaComposition(urn, SrgSsr.dataProvider(player));
75474
- const mainResources = yield SrgSsr.composeMainResources(mediaComposition);
75475
- let mediaData = SrgSsr.getMediaData(mainResources);
75478
+ const mediaComposition = yield _this5.getMediaComposition(urn, _this5.dataProvider(player));
75479
+ const mainResources = yield _this5.composeMainResources(mediaComposition);
75480
+ let mediaData = _this5.getMediaData(mainResources);
75476
75481
  if (!mediaData) {
75477
75482
  mediaData = {
75478
75483
  blockReason: mediaComposition.getMainChapter().blockReason,
75479
75484
  imageUrl: mediaComposition.getMainChapterImageUrl()
75480
75485
  };
75481
75486
  }
75482
- return SrgSsr.composeSrcMediaData(srcOptions, mediaData);
75487
+ return _this5.composeSrcMediaData(srcOptions, mediaData);
75483
75488
  })();
75484
75489
  }
75485
75490
 
@@ -75552,17 +75557,18 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75552
75557
  * @returns {Promise<any>}
75553
75558
  */
75554
75559
  static handleSetSource(player, srcObj, next) {
75560
+ var _this6 = this;
75555
75561
  return _asyncToGenerator(function* () {
75556
75562
  try {
75557
- const srcMediaObj = yield SrgSsr.getSrcMediaObj(player, srcObj);
75558
- SrgSsr.srgAnalytics(player);
75559
- SrgSsr.updateTitleBar(player, srcMediaObj);
75560
- SrgSsr.updatePoster(player, srcMediaObj);
75561
- if (SrgSsr.blockingReason(player, srcMediaObj)) return;
75562
- SrgSsr.addTextTracks(player, srcMediaObj);
75563
+ const srcMediaObj = yield _this6.getSrcMediaObj(player, srcObj);
75564
+ _this6.srgAnalytics(player);
75565
+ _this6.updateTitleBar(player, srcMediaObj);
75566
+ _this6.updatePoster(player, srcMediaObj);
75567
+ if (_this6.blockingReason(player, srcMediaObj)) return;
75568
+ _this6.addTextTracks(player, srcMediaObj);
75563
75569
  return next(null, srcMediaObj);
75564
75570
  } catch (error) {
75565
- if (SrgSsr.dataProviderError(player, error)) return;
75571
+ if (_this6.dataProviderError(player, error)) return;
75566
75572
  return next(error);
75567
75573
  }
75568
75574
  })();
@@ -75649,14 +75655,15 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75649
75655
  * @returns {Object}
75650
75656
  */
75651
75657
  static middleware(player) {
75652
- SrgSsr.pillarboxMonitoring(player);
75653
- SrgSsr.cuechangeEventProxy(player);
75658
+ var _this7 = this;
75659
+ this.pillarboxMonitoring(player);
75660
+ this.cuechangeEventProxy(player);
75654
75661
  return {
75655
- currentTime: currentTime => SrgSsr.handleCurrentTime(player, currentTime),
75656
- setCurrentTime: currentTime => SrgSsr.handleSetCurrentTime(player, currentTime),
75662
+ currentTime: currentTime => this.handleCurrentTime(player, currentTime),
75663
+ setCurrentTime: currentTime => this.handleSetCurrentTime(player, currentTime),
75657
75664
  setSource: function () {
75658
75665
  var _ref = _asyncToGenerator(function* (srcObj, next) {
75659
- return SrgSsr.handleSetSource(player, srcObj, next);
75666
+ return _this7.handleSetSource(player, srcObj, next);
75660
75667
  });
75661
75668
  return function setSource(_x8, _x9) {
75662
75669
  return _ref.apply(this, arguments);
@@ -75665,7 +75672,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75665
75672
  };
75666
75673
  }
75667
75674
  }
75668
- pillarbox.use('srgssr/urn', SrgSsr.middleware);
75675
+ pillarbox.use('srgssr/urn', player => SrgSsr.middleware(player));
75669
75676
 
75670
75677
  // Add Middleware specific options
75671
75678
  pillarbox.options.srgOptions = {