@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.
@@ -3,7 +3,7 @@
3
3
  const videojs = require('video.js');
4
4
  require('videojs-contrib-eme');
5
5
 
6
- const version = "1.36.0";
6
+ const version = "1.36.1";
7
7
 
8
8
  /** @import VJSPlayer from 'video.js/dist/types/player' */
9
9
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -1,7 +1,7 @@
1
1
  import videojs from 'video.js';
2
2
  import 'videojs-contrib-eme';
3
3
 
4
- const version = "1.36.0";
4
+ const version = "1.36.1";
5
5
 
6
6
  /** @import VJSPlayer from 'video.js/dist/types/player' */
7
7
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -94,7 +94,7 @@ function _toPropertyKey(t) {
94
94
  return "symbol" == typeof i ? i : i + "";
95
95
  }
96
96
 
97
- const version = "1.36.0";
97
+ const version = "1.36.1";
98
98
 
99
99
  /** @import VJSPlayer from 'video.js/dist/types/player' */
100
100
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -3979,10 +3979,11 @@ class SrgSsr {
3979
3979
  * @param {Array<Segment>} [segments=[]]
3980
3980
  */
3981
3981
  static addBlockedSegments(_x) {
3982
+ var _this = this;
3982
3983
  return _asyncToGenerator(function* (player, segments = []) {
3983
3984
  const trackId = 'srgssr-blocked-segments';
3984
- const blockedSegmentsToAdd = SrgSsr.getBlockedSegments(segments);
3985
- yield SrgSsr.createTextTrack(player, trackId, blockedSegmentsToAdd);
3985
+ const blockedSegmentsToAdd = _this.getBlockedSegments(segments);
3986
+ yield _this.createTextTrack(player, trackId, blockedSegmentsToAdd);
3986
3987
  }).apply(this, arguments);
3987
3988
  }
3988
3989
 
@@ -4043,7 +4044,7 @@ class SrgSsr {
4043
4044
  static addTextTrackCues(textTrack, cues = []) {
4044
4045
  if (!Array.isArray(cues)) return;
4045
4046
  cues.forEach(cue => {
4046
- SrgSsr.addTextTrackCue(textTrack, cue);
4047
+ this.addTextTrackCue(textTrack, cue);
4047
4048
  });
4048
4049
  }
4049
4050
 
@@ -4056,10 +4057,10 @@ class SrgSsr {
4056
4057
  static addTextTracks(player, {
4057
4058
  mediaData
4058
4059
  }) {
4059
- SrgSsr.addRemoteTextTracks(player, mediaData.subtitles);
4060
- SrgSsr.addChapters(player, mediaData.urn, mediaData.chapters);
4061
- SrgSsr.addBlockedSegments(player, mediaData.blockedSegments);
4062
- SrgSsr.addIntervals(player, mediaData.intervals);
4060
+ this.addRemoteTextTracks(player, mediaData.subtitles);
4061
+ this.addChapters(player, mediaData.urn, mediaData.chapters);
4062
+ this.addBlockedSegments(player, mediaData.blockedSegments);
4063
+ this.addIntervals(player, mediaData.intervals);
4063
4064
  }
4064
4065
 
4065
4066
  /**
@@ -4070,10 +4071,11 @@ class SrgSsr {
4070
4071
  * @param {Array.<Chapter>} [chapters=[]]
4071
4072
  */
4072
4073
  static addChapters(_x2, _x3) {
4074
+ var _this2 = this;
4073
4075
  return _asyncToGenerator(function* (player, chapterUrn, chapters = []) {
4074
4076
  const trackId = 'srgssr-chapters';
4075
- const chaptersToAdd = SrgSsr.getChapters(chapterUrn, chapters);
4076
- yield SrgSsr.createTextTrack(player, trackId, chaptersToAdd);
4077
+ const chaptersToAdd = _this2.getChapters(chapterUrn, chapters);
4078
+ yield _this2.createTextTrack(player, trackId, chaptersToAdd);
4077
4079
  }).apply(this, arguments);
4078
4080
  }
4079
4081
 
@@ -4084,10 +4086,11 @@ class SrgSsr {
4084
4086
  * @param {Array.<TimeInterval>} [intervals=[]]
4085
4087
  */
4086
4088
  static addIntervals(_x4) {
4089
+ var _this3 = this;
4087
4090
  return _asyncToGenerator(function* (player, intervals = []) {
4088
4091
  const trackId = 'srgssr-intervals';
4089
- const instervalsToAdd = SrgSsr.getIntervals(intervals);
4090
- yield SrgSsr.createTextTrack(player, trackId, instervalsToAdd);
4092
+ const instervalsToAdd = _this3.getIntervals(intervals);
4093
+ yield _this3.createTextTrack(player, trackId, instervalsToAdd);
4091
4094
  }).apply(this, arguments);
4092
4095
  }
4093
4096
 
@@ -4103,7 +4106,7 @@ class SrgSsr {
4103
4106
  static blockingReason(player, srcMediaObj) {
4104
4107
  if (!srcMediaObj.mediaData.blockReason) return;
4105
4108
  const message = player.localize(srcMediaObj.mediaData.blockReason);
4106
- SrgSsr.error(player, {
4109
+ this.error(player, {
4107
4110
  code: MediaError.MEDIA_ERR_ABORTED,
4108
4111
  message,
4109
4112
  metadata: {
@@ -4157,7 +4160,7 @@ class SrgSsr {
4157
4160
  * @returns {Promise<Array.<MainResourceWithKeySystems>>}
4158
4161
  */
4159
4162
  static composeMainResources(mediaComposition) {
4160
- return SrgSsr.composeAkamaiResources(SrgSsr.composeKeySystemsResources(SrgSsr.filterIncompatibleResources(mediaComposition.getMainResources())));
4163
+ return this.composeAkamaiResources(this.composeKeySystemsResources(this.filterIncompatibleResources(mediaComposition.getMainResources())));
4161
4164
  }
4162
4165
 
4163
4166
  /**
@@ -4207,6 +4210,7 @@ class SrgSsr {
4207
4210
  * @returns {Promise<TextTrack>}
4208
4211
  */
4209
4212
  static createTextTrack(_x5, _x6) {
4213
+ var _this4 = this;
4210
4214
  return _asyncToGenerator(function* (player, trackId, cues = []) {
4211
4215
  const removeTrack = player.remoteTextTracks().getTrackById(trackId);
4212
4216
  if (removeTrack) {
@@ -4223,7 +4227,7 @@ class SrgSsr {
4223
4227
 
4224
4228
  // See https://github.com/videojs/video.js/issues/8519
4225
4229
  yield new Promise(resolve => setTimeout(resolve, 100));
4226
- SrgSsr.addTextTrackCues(textTrack.track, cues);
4230
+ _this4.addTextTrackCues(textTrack.track, cues);
4227
4231
  return textTrack.track;
4228
4232
  }).apply(this, arguments);
4229
4233
  }
@@ -4284,7 +4288,7 @@ class SrgSsr {
4284
4288
  static dataProviderError(player, error) {
4285
4289
  if (!error) return;
4286
4290
  const statusText = error.statusText ? error.statusText : error.message;
4287
- SrgSsr.error(player, {
4291
+ this.error(player, {
4288
4292
  code: 0,
4289
4293
  message: player.localize('UNKNOWN'),
4290
4294
  metadata: {
@@ -4354,7 +4358,7 @@ class SrgSsr {
4354
4358
  * @returns {VTTCue|undefined} The VTT cue of a blocked segment, or undefined
4355
4359
  */
4356
4360
  static getBlockedSegmentByTime(player, currentTime) {
4357
- const blockedSegment = SrgSsr.getBlockedSegment(player);
4361
+ const blockedSegment = this.getBlockedSegment(player);
4358
4362
  if (!blockedSegment) return;
4359
4363
  const isBlocked = currentTime >= blockedSegment.startTime && currentTime < blockedSegment.endTime;
4360
4364
  return isBlocked ? blockedSegment : undefined;
@@ -4438,24 +4442,25 @@ class SrgSsr {
4438
4442
  * @returns {Promise<ComposedSrcMediaData>} - The composed source media data.
4439
4443
  */
4440
4444
  static getSrcMediaObj(player, srcObj) {
4445
+ var _this5 = this;
4441
4446
  return _asyncToGenerator(function* () {
4442
- if (SrgSsr.pillarboxMonitoring(player)) {
4443
- SrgSsr.pillarboxMonitoring(player).sessionStart();
4447
+ if (_this5.pillarboxMonitoring(player)) {
4448
+ _this5.pillarboxMonitoring(player).sessionStart();
4444
4449
  }
4445
4450
  const {
4446
4451
  src: urn
4447
4452
  } = srcObj,
4448
4453
  srcOptions = _objectWithoutProperties(srcObj, _excluded2);
4449
- const mediaComposition = yield SrgSsr.getMediaComposition(urn, SrgSsr.dataProvider(player));
4450
- const mainResources = yield SrgSsr.composeMainResources(mediaComposition);
4451
- let mediaData = SrgSsr.getMediaData(mainResources);
4454
+ const mediaComposition = yield _this5.getMediaComposition(urn, _this5.dataProvider(player));
4455
+ const mainResources = yield _this5.composeMainResources(mediaComposition);
4456
+ let mediaData = _this5.getMediaData(mainResources);
4452
4457
  if (!mediaData) {
4453
4458
  mediaData = {
4454
4459
  blockReason: mediaComposition.getMainChapter().blockReason,
4455
4460
  imageUrl: mediaComposition.getMainChapterImageUrl()
4456
4461
  };
4457
4462
  }
4458
- return SrgSsr.composeSrcMediaData(srcOptions, mediaData);
4463
+ return _this5.composeSrcMediaData(srcOptions, mediaData);
4459
4464
  })();
4460
4465
  }
4461
4466
 
@@ -4528,17 +4533,18 @@ class SrgSsr {
4528
4533
  * @returns {Promise<any>}
4529
4534
  */
4530
4535
  static handleSetSource(player, srcObj, next) {
4536
+ var _this6 = this;
4531
4537
  return _asyncToGenerator(function* () {
4532
4538
  try {
4533
- const srcMediaObj = yield SrgSsr.getSrcMediaObj(player, srcObj);
4534
- SrgSsr.srgAnalytics(player);
4535
- SrgSsr.updateTitleBar(player, srcMediaObj);
4536
- SrgSsr.updatePoster(player, srcMediaObj);
4537
- if (SrgSsr.blockingReason(player, srcMediaObj)) return;
4538
- SrgSsr.addTextTracks(player, srcMediaObj);
4539
+ const srcMediaObj = yield _this6.getSrcMediaObj(player, srcObj);
4540
+ _this6.srgAnalytics(player);
4541
+ _this6.updateTitleBar(player, srcMediaObj);
4542
+ _this6.updatePoster(player, srcMediaObj);
4543
+ if (_this6.blockingReason(player, srcMediaObj)) return;
4544
+ _this6.addTextTracks(player, srcMediaObj);
4539
4545
  return next(null, srcMediaObj);
4540
4546
  } catch (error) {
4541
- if (SrgSsr.dataProviderError(player, error)) return;
4547
+ if (_this6.dataProviderError(player, error)) return;
4542
4548
  return next(error);
4543
4549
  }
4544
4550
  })();
@@ -4625,14 +4631,15 @@ class SrgSsr {
4625
4631
  * @returns {Object}
4626
4632
  */
4627
4633
  static middleware(player) {
4628
- SrgSsr.pillarboxMonitoring(player);
4629
- SrgSsr.cuechangeEventProxy(player);
4634
+ var _this7 = this;
4635
+ this.pillarboxMonitoring(player);
4636
+ this.cuechangeEventProxy(player);
4630
4637
  return {
4631
- currentTime: currentTime => SrgSsr.handleCurrentTime(player, currentTime),
4632
- setCurrentTime: currentTime => SrgSsr.handleSetCurrentTime(player, currentTime),
4638
+ currentTime: currentTime => this.handleCurrentTime(player, currentTime),
4639
+ setCurrentTime: currentTime => this.handleSetCurrentTime(player, currentTime),
4633
4640
  setSource: function () {
4634
4641
  var _ref = _asyncToGenerator(function* (srcObj, next) {
4635
- return SrgSsr.handleSetSource(player, srcObj, next);
4642
+ return _this7.handleSetSource(player, srcObj, next);
4636
4643
  });
4637
4644
  return function setSource(_x8, _x9) {
4638
4645
  return _ref.apply(this, arguments);
@@ -4641,7 +4648,7 @@ class SrgSsr {
4641
4648
  };
4642
4649
  }
4643
4650
  }
4644
- pillarbox.use('srgssr/urn', SrgSsr.middleware);
4651
+ pillarbox.use('srgssr/urn', player => SrgSsr.middleware(player));
4645
4652
 
4646
4653
  // Add Middleware specific options
4647
4654
  pillarbox.options.srgOptions = {