@srgssr/pillarbox-web 1.36.1 → 1.36.3

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.2";
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) {
@@ -75242,12 +75246,15 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75242
75246
  label: trackId
75243
75247
  });
75244
75248
 
75249
+ // See https://github.com/videojs/video.js/issues/8519
75250
+ yield new Promise(resolve => setTimeout(resolve, 100));
75251
+
75245
75252
  // Safari
75246
75253
  textTrack.track.mode = 'hidden';
75247
75254
 
75248
75255
  // See https://github.com/videojs/video.js/issues/8519
75249
75256
  yield new Promise(resolve => setTimeout(resolve, 100));
75250
- SrgSsr.addTextTrackCues(textTrack.track, cues);
75257
+ _this4.addTextTrackCues(textTrack.track, cues);
75251
75258
  return textTrack.track;
75252
75259
  }).apply(this, arguments);
75253
75260
  }
@@ -75308,7 +75315,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75308
75315
  static dataProviderError(player, error) {
75309
75316
  if (!error) return;
75310
75317
  const statusText = error.statusText ? error.statusText : error.message;
75311
- SrgSsr.error(player, {
75318
+ this.error(player, {
75312
75319
  code: 0,
75313
75320
  message: player.localize('UNKNOWN'),
75314
75321
  metadata: {
@@ -75378,7 +75385,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75378
75385
  * @returns {VTTCue|undefined} The VTT cue of a blocked segment, or undefined
75379
75386
  */
75380
75387
  static getBlockedSegmentByTime(player, currentTime) {
75381
- const blockedSegment = SrgSsr.getBlockedSegment(player);
75388
+ const blockedSegment = this.getBlockedSegment(player);
75382
75389
  if (!blockedSegment) return;
75383
75390
  const isBlocked = currentTime >= blockedSegment.startTime && currentTime < blockedSegment.endTime;
75384
75391
  return isBlocked ? blockedSegment : undefined;
@@ -75462,24 +75469,25 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75462
75469
  * @returns {Promise<ComposedSrcMediaData>} - The composed source media data.
75463
75470
  */
75464
75471
  static getSrcMediaObj(player, srcObj) {
75472
+ var _this5 = this;
75465
75473
  return _asyncToGenerator(function* () {
75466
- if (SrgSsr.pillarboxMonitoring(player)) {
75467
- SrgSsr.pillarboxMonitoring(player).sessionStart();
75474
+ if (_this5.pillarboxMonitoring(player)) {
75475
+ _this5.pillarboxMonitoring(player).sessionStart();
75468
75476
  }
75469
75477
  const {
75470
75478
  src: urn
75471
75479
  } = srcObj,
75472
75480
  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);
75481
+ const mediaComposition = yield _this5.getMediaComposition(urn, _this5.dataProvider(player));
75482
+ const mainResources = yield _this5.composeMainResources(mediaComposition);
75483
+ let mediaData = _this5.getMediaData(mainResources);
75476
75484
  if (!mediaData) {
75477
75485
  mediaData = {
75478
75486
  blockReason: mediaComposition.getMainChapter().blockReason,
75479
75487
  imageUrl: mediaComposition.getMainChapterImageUrl()
75480
75488
  };
75481
75489
  }
75482
- return SrgSsr.composeSrcMediaData(srcOptions, mediaData);
75490
+ return _this5.composeSrcMediaData(srcOptions, mediaData);
75483
75491
  })();
75484
75492
  }
75485
75493
 
@@ -75552,17 +75560,18 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75552
75560
  * @returns {Promise<any>}
75553
75561
  */
75554
75562
  static handleSetSource(player, srcObj, next) {
75563
+ var _this6 = this;
75555
75564
  return _asyncToGenerator(function* () {
75556
75565
  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);
75566
+ const srcMediaObj = yield _this6.getSrcMediaObj(player, srcObj);
75567
+ _this6.srgAnalytics(player);
75568
+ _this6.updateTitleBar(player, srcMediaObj);
75569
+ _this6.updatePoster(player, srcMediaObj);
75570
+ if (_this6.blockingReason(player, srcMediaObj)) return;
75571
+ _this6.addTextTracks(player, srcMediaObj);
75563
75572
  return next(null, srcMediaObj);
75564
75573
  } catch (error) {
75565
- if (SrgSsr.dataProviderError(player, error)) return;
75574
+ if (_this6.dataProviderError(player, error)) return;
75566
75575
  return next(error);
75567
75576
  }
75568
75577
  })();
@@ -75649,14 +75658,15 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75649
75658
  * @returns {Object}
75650
75659
  */
75651
75660
  static middleware(player) {
75652
- SrgSsr.pillarboxMonitoring(player);
75653
- SrgSsr.cuechangeEventProxy(player);
75661
+ var _this7 = this;
75662
+ this.pillarboxMonitoring(player);
75663
+ this.cuechangeEventProxy(player);
75654
75664
  return {
75655
- currentTime: currentTime => SrgSsr.handleCurrentTime(player, currentTime),
75656
- setCurrentTime: currentTime => SrgSsr.handleSetCurrentTime(player, currentTime),
75665
+ currentTime: currentTime => this.handleCurrentTime(player, currentTime),
75666
+ setCurrentTime: currentTime => this.handleSetCurrentTime(player, currentTime),
75657
75667
  setSource: function () {
75658
75668
  var _ref = _asyncToGenerator(function* (srcObj, next) {
75659
- return SrgSsr.handleSetSource(player, srcObj, next);
75669
+ return _this7.handleSetSource(player, srcObj, next);
75660
75670
  });
75661
75671
  return function setSource(_x8, _x9) {
75662
75672
  return _ref.apply(this, arguments);
@@ -75665,7 +75675,7 @@ ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated wi
75665
75675
  };
75666
75676
  }
75667
75677
  }
75668
- pillarbox.use('srgssr/urn', SrgSsr.middleware);
75678
+ pillarbox.use('srgssr/urn', player => SrgSsr.middleware(player));
75669
75679
 
75670
75680
  // Add Middleware specific options
75671
75681
  pillarbox.options.srgOptions = {