@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.
@@ -90,7 +90,7 @@ function _toPropertyKey(t) {
90
90
  return "symbol" == typeof i ? i : i + "";
91
91
  }
92
92
 
93
- const version = "1.36.0";
93
+ const version = "1.36.1";
94
94
 
95
95
  /** @import VJSPlayer from 'video.js/dist/types/player' */
96
96
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -3975,10 +3975,11 @@ class SrgSsr {
3975
3975
  * @param {Array<Segment>} [segments=[]]
3976
3976
  */
3977
3977
  static addBlockedSegments(_x) {
3978
+ var _this = this;
3978
3979
  return _asyncToGenerator(function* (player, segments = []) {
3979
3980
  const trackId = 'srgssr-blocked-segments';
3980
- const blockedSegmentsToAdd = SrgSsr.getBlockedSegments(segments);
3981
- yield SrgSsr.createTextTrack(player, trackId, blockedSegmentsToAdd);
3981
+ const blockedSegmentsToAdd = _this.getBlockedSegments(segments);
3982
+ yield _this.createTextTrack(player, trackId, blockedSegmentsToAdd);
3982
3983
  }).apply(this, arguments);
3983
3984
  }
3984
3985
 
@@ -4039,7 +4040,7 @@ class SrgSsr {
4039
4040
  static addTextTrackCues(textTrack, cues = []) {
4040
4041
  if (!Array.isArray(cues)) return;
4041
4042
  cues.forEach(cue => {
4042
- SrgSsr.addTextTrackCue(textTrack, cue);
4043
+ this.addTextTrackCue(textTrack, cue);
4043
4044
  });
4044
4045
  }
4045
4046
 
@@ -4052,10 +4053,10 @@ class SrgSsr {
4052
4053
  static addTextTracks(player, {
4053
4054
  mediaData
4054
4055
  }) {
4055
- SrgSsr.addRemoteTextTracks(player, mediaData.subtitles);
4056
- SrgSsr.addChapters(player, mediaData.urn, mediaData.chapters);
4057
- SrgSsr.addBlockedSegments(player, mediaData.blockedSegments);
4058
- SrgSsr.addIntervals(player, mediaData.intervals);
4056
+ this.addRemoteTextTracks(player, mediaData.subtitles);
4057
+ this.addChapters(player, mediaData.urn, mediaData.chapters);
4058
+ this.addBlockedSegments(player, mediaData.blockedSegments);
4059
+ this.addIntervals(player, mediaData.intervals);
4059
4060
  }
4060
4061
 
4061
4062
  /**
@@ -4066,10 +4067,11 @@ class SrgSsr {
4066
4067
  * @param {Array.<Chapter>} [chapters=[]]
4067
4068
  */
4068
4069
  static addChapters(_x2, _x3) {
4070
+ var _this2 = this;
4069
4071
  return _asyncToGenerator(function* (player, chapterUrn, chapters = []) {
4070
4072
  const trackId = 'srgssr-chapters';
4071
- const chaptersToAdd = SrgSsr.getChapters(chapterUrn, chapters);
4072
- yield SrgSsr.createTextTrack(player, trackId, chaptersToAdd);
4073
+ const chaptersToAdd = _this2.getChapters(chapterUrn, chapters);
4074
+ yield _this2.createTextTrack(player, trackId, chaptersToAdd);
4073
4075
  }).apply(this, arguments);
4074
4076
  }
4075
4077
 
@@ -4080,10 +4082,11 @@ class SrgSsr {
4080
4082
  * @param {Array.<TimeInterval>} [intervals=[]]
4081
4083
  */
4082
4084
  static addIntervals(_x4) {
4085
+ var _this3 = this;
4083
4086
  return _asyncToGenerator(function* (player, intervals = []) {
4084
4087
  const trackId = 'srgssr-intervals';
4085
- const instervalsToAdd = SrgSsr.getIntervals(intervals);
4086
- yield SrgSsr.createTextTrack(player, trackId, instervalsToAdd);
4088
+ const instervalsToAdd = _this3.getIntervals(intervals);
4089
+ yield _this3.createTextTrack(player, trackId, instervalsToAdd);
4087
4090
  }).apply(this, arguments);
4088
4091
  }
4089
4092
 
@@ -4099,7 +4102,7 @@ class SrgSsr {
4099
4102
  static blockingReason(player, srcMediaObj) {
4100
4103
  if (!srcMediaObj.mediaData.blockReason) return;
4101
4104
  const message = player.localize(srcMediaObj.mediaData.blockReason);
4102
- SrgSsr.error(player, {
4105
+ this.error(player, {
4103
4106
  code: MediaError.MEDIA_ERR_ABORTED,
4104
4107
  message,
4105
4108
  metadata: {
@@ -4153,7 +4156,7 @@ class SrgSsr {
4153
4156
  * @returns {Promise<Array.<MainResourceWithKeySystems>>}
4154
4157
  */
4155
4158
  static composeMainResources(mediaComposition) {
4156
- return SrgSsr.composeAkamaiResources(SrgSsr.composeKeySystemsResources(SrgSsr.filterIncompatibleResources(mediaComposition.getMainResources())));
4159
+ return this.composeAkamaiResources(this.composeKeySystemsResources(this.filterIncompatibleResources(mediaComposition.getMainResources())));
4157
4160
  }
4158
4161
 
4159
4162
  /**
@@ -4203,6 +4206,7 @@ class SrgSsr {
4203
4206
  * @returns {Promise<TextTrack>}
4204
4207
  */
4205
4208
  static createTextTrack(_x5, _x6) {
4209
+ var _this4 = this;
4206
4210
  return _asyncToGenerator(function* (player, trackId, cues = []) {
4207
4211
  const removeTrack = player.remoteTextTracks().getTrackById(trackId);
4208
4212
  if (removeTrack) {
@@ -4219,7 +4223,7 @@ class SrgSsr {
4219
4223
 
4220
4224
  // See https://github.com/videojs/video.js/issues/8519
4221
4225
  yield new Promise(resolve => setTimeout(resolve, 100));
4222
- SrgSsr.addTextTrackCues(textTrack.track, cues);
4226
+ _this4.addTextTrackCues(textTrack.track, cues);
4223
4227
  return textTrack.track;
4224
4228
  }).apply(this, arguments);
4225
4229
  }
@@ -4280,7 +4284,7 @@ class SrgSsr {
4280
4284
  static dataProviderError(player, error) {
4281
4285
  if (!error) return;
4282
4286
  const statusText = error.statusText ? error.statusText : error.message;
4283
- SrgSsr.error(player, {
4287
+ this.error(player, {
4284
4288
  code: 0,
4285
4289
  message: player.localize('UNKNOWN'),
4286
4290
  metadata: {
@@ -4350,7 +4354,7 @@ class SrgSsr {
4350
4354
  * @returns {VTTCue|undefined} The VTT cue of a blocked segment, or undefined
4351
4355
  */
4352
4356
  static getBlockedSegmentByTime(player, currentTime) {
4353
- const blockedSegment = SrgSsr.getBlockedSegment(player);
4357
+ const blockedSegment = this.getBlockedSegment(player);
4354
4358
  if (!blockedSegment) return;
4355
4359
  const isBlocked = currentTime >= blockedSegment.startTime && currentTime < blockedSegment.endTime;
4356
4360
  return isBlocked ? blockedSegment : undefined;
@@ -4434,24 +4438,25 @@ class SrgSsr {
4434
4438
  * @returns {Promise<ComposedSrcMediaData>} - The composed source media data.
4435
4439
  */
4436
4440
  static getSrcMediaObj(player, srcObj) {
4441
+ var _this5 = this;
4437
4442
  return _asyncToGenerator(function* () {
4438
- if (SrgSsr.pillarboxMonitoring(player)) {
4439
- SrgSsr.pillarboxMonitoring(player).sessionStart();
4443
+ if (_this5.pillarboxMonitoring(player)) {
4444
+ _this5.pillarboxMonitoring(player).sessionStart();
4440
4445
  }
4441
4446
  const {
4442
4447
  src: urn
4443
4448
  } = srcObj,
4444
4449
  srcOptions = _objectWithoutProperties(srcObj, _excluded2);
4445
- const mediaComposition = yield SrgSsr.getMediaComposition(urn, SrgSsr.dataProvider(player));
4446
- const mainResources = yield SrgSsr.composeMainResources(mediaComposition);
4447
- let mediaData = SrgSsr.getMediaData(mainResources);
4450
+ const mediaComposition = yield _this5.getMediaComposition(urn, _this5.dataProvider(player));
4451
+ const mainResources = yield _this5.composeMainResources(mediaComposition);
4452
+ let mediaData = _this5.getMediaData(mainResources);
4448
4453
  if (!mediaData) {
4449
4454
  mediaData = {
4450
4455
  blockReason: mediaComposition.getMainChapter().blockReason,
4451
4456
  imageUrl: mediaComposition.getMainChapterImageUrl()
4452
4457
  };
4453
4458
  }
4454
- return SrgSsr.composeSrcMediaData(srcOptions, mediaData);
4459
+ return _this5.composeSrcMediaData(srcOptions, mediaData);
4455
4460
  })();
4456
4461
  }
4457
4462
 
@@ -4524,17 +4529,18 @@ class SrgSsr {
4524
4529
  * @returns {Promise<any>}
4525
4530
  */
4526
4531
  static handleSetSource(player, srcObj, next) {
4532
+ var _this6 = this;
4527
4533
  return _asyncToGenerator(function* () {
4528
4534
  try {
4529
- const srcMediaObj = yield SrgSsr.getSrcMediaObj(player, srcObj);
4530
- SrgSsr.srgAnalytics(player);
4531
- SrgSsr.updateTitleBar(player, srcMediaObj);
4532
- SrgSsr.updatePoster(player, srcMediaObj);
4533
- if (SrgSsr.blockingReason(player, srcMediaObj)) return;
4534
- SrgSsr.addTextTracks(player, srcMediaObj);
4535
+ const srcMediaObj = yield _this6.getSrcMediaObj(player, srcObj);
4536
+ _this6.srgAnalytics(player);
4537
+ _this6.updateTitleBar(player, srcMediaObj);
4538
+ _this6.updatePoster(player, srcMediaObj);
4539
+ if (_this6.blockingReason(player, srcMediaObj)) return;
4540
+ _this6.addTextTracks(player, srcMediaObj);
4535
4541
  return next(null, srcMediaObj);
4536
4542
  } catch (error) {
4537
- if (SrgSsr.dataProviderError(player, error)) return;
4543
+ if (_this6.dataProviderError(player, error)) return;
4538
4544
  return next(error);
4539
4545
  }
4540
4546
  })();
@@ -4621,14 +4627,15 @@ class SrgSsr {
4621
4627
  * @returns {Object}
4622
4628
  */
4623
4629
  static middleware(player) {
4624
- SrgSsr.pillarboxMonitoring(player);
4625
- SrgSsr.cuechangeEventProxy(player);
4630
+ var _this7 = this;
4631
+ this.pillarboxMonitoring(player);
4632
+ this.cuechangeEventProxy(player);
4626
4633
  return {
4627
- currentTime: currentTime => SrgSsr.handleCurrentTime(player, currentTime),
4628
- setCurrentTime: currentTime => SrgSsr.handleSetCurrentTime(player, currentTime),
4634
+ currentTime: currentTime => this.handleCurrentTime(player, currentTime),
4635
+ setCurrentTime: currentTime => this.handleSetCurrentTime(player, currentTime),
4629
4636
  setSource: function () {
4630
4637
  var _ref = _asyncToGenerator(function* (srcObj, next) {
4631
- return SrgSsr.handleSetSource(player, srcObj, next);
4638
+ return _this7.handleSetSource(player, srcObj, next);
4632
4639
  });
4633
4640
  return function setSource(_x8, _x9) {
4634
4641
  return _ref.apply(this, arguments);
@@ -4637,7 +4644,7 @@ class SrgSsr {
4637
4644
  };
4638
4645
  }
4639
4646
  }
4640
- pillarbox.use('srgssr/urn', SrgSsr.middleware);
4647
+ pillarbox.use('srgssr/urn', player => SrgSsr.middleware(player));
4641
4648
 
4642
4649
  // Add Middleware specific options
4643
4650
  pillarbox.options.srgOptions = {