@srgssr/pillarbox-web 1.19.1 → 1.21.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.
@@ -3,7 +3,7 @@
3
3
  const videojs = require('video.js');
4
4
  require('videojs-contrib-eme');
5
5
 
6
- const version = "1.19.0";
6
+ const version = "1.20.0";
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.19.0";
4
+ const version = "1.20.0";
5
5
 
6
6
  /** @import VJSPlayer from 'video.js/dist/types/player' */
7
7
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -109,7 +109,7 @@ function _objectWithoutProperties(source, excluded) {
109
109
  return target;
110
110
  }
111
111
 
112
- const version = "1.19.0";
112
+ const version = "1.20.0";
113
113
 
114
114
  /** @import VJSPlayer from 'video.js/dist/types/player' */
115
115
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -1841,6 +1841,17 @@ class PillarboxMonitoring {
1841
1841
  return PillarboxMonitoring.secondsToMilliseconds(bufferDuration);
1842
1842
  }
1843
1843
 
1844
+ /**
1845
+ * Gets the language of the current audio track.
1846
+ *
1847
+ * @returns {string|undefined} The language of the current audio track, or undefined if no audio track is available or if the language is not set.
1848
+ */
1849
+ currentAudioTrack() {
1850
+ const audioTrack = this.player.audioTrack();
1851
+ if (!audioTrack || !audioTrack.language) return;
1852
+ return audioTrack.language;
1853
+ }
1854
+
1844
1855
  /**
1845
1856
  * Get the current representation when playing a Dash or Hls media.
1846
1857
  *
@@ -1906,22 +1917,37 @@ class PillarboxMonitoring {
1906
1917
  return this.player.currentSource().mediaData;
1907
1918
  }
1908
1919
 
1920
+ /**
1921
+ * Gets the language of the current text track (subtitles or captions).
1922
+ *
1923
+ * @returns {string|undefined} The language of the current text track, or undefined if no text track is available or if the language is not set.
1924
+ */
1925
+ currentTextTrack() {
1926
+ const textTrack = this.player.textTrack();
1927
+ if (!textTrack || !textTrack.language) return;
1928
+ return textTrack.language;
1929
+ }
1930
+
1909
1931
  /**
1910
1932
  * Handles player errors by sending an `ERROR` event, then resets the session.
1911
1933
  */
1912
1934
  error() {
1935
+ const audio = this.currentAudioTrack();
1913
1936
  const error = this.player.error();
1914
1937
  const playbackPosition = this.playbackPosition();
1915
1938
  const representation = this.currentRepresentation();
1916
1939
  const url = representation ? representation.uri : this.player.currentSource().src;
1940
+ const subtitles = this.currentTextTrack();
1917
1941
  if (!this.player.hasStarted()) {
1918
1942
  this.sendEvent('START', this.startEventData());
1919
1943
  }
1920
1944
  this.sendEvent('ERROR', _objectSpread2(_objectSpread2({
1945
+ audio,
1921
1946
  log: JSON.stringify(error.metadata || pillarbox.log.history().slice(-15)),
1922
1947
  message: error.message,
1923
1948
  name: PillarboxMonitoring.errorKeyCode(error.code)
1924
1949
  }, playbackPosition), {}, {
1950
+ subtitles,
1925
1951
  url
1926
1952
  }));
1927
1953
  this.reset();
@@ -2355,6 +2381,7 @@ class PillarboxMonitoring {
2355
2381
  * @returns {StatusEventData} The current event data
2356
2382
  */
2357
2383
  statusEventData() {
2384
+ const audio = this.currentAudioTrack();
2358
2385
  const bandwidth = this.bandwidth();
2359
2386
  const buffered_duration = this.bufferDuration();
2360
2387
  const {
@@ -2371,7 +2398,9 @@ class PillarboxMonitoring {
2371
2398
  } = this.playbackPosition();
2372
2399
  const stream_type = isFinite(this.player.duration()) ? 'On-demand' : 'Live';
2373
2400
  const stall = this.stallInfo();
2401
+ const subtitles = this.currentTextTrack();
2374
2402
  const data = {
2403
+ audio,
2375
2404
  bandwidth,
2376
2405
  bitrate,
2377
2406
  buffered_duration,
@@ -2381,6 +2410,7 @@ class PillarboxMonitoring {
2381
2410
  position_timestamp,
2382
2411
  stall,
2383
2412
  stream_type,
2413
+ subtitles,
2384
2414
  url
2385
2415
  };
2386
2416
  return data;
@@ -2967,6 +2997,7 @@ const GEOBLOCK$4 = "Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.";
2967
2997
  const JOURNALISTIC$4 = "Dieser Inhalt steht aus publizistischen Gründen vorübergehend nicht zur Verfügung.";
2968
2998
  const LEGAL$4 = "Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.";
2969
2999
  const STARTDATE$4 = "Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.";
3000
+ const VPNORPROXYDETECTED$4 = "Dieser Inhalt ist mit VPN oder Proxy nicht abspielbar.";
2970
3001
  const UNKNOWN$4 = "Dieser Inhalt ist nicht verfügbar.";
2971
3002
  const pillarboxLang$4 = {
2972
3003
  AGERATING12: AGERATING12$4,
@@ -2977,6 +3008,7 @@ const pillarboxLang$4 = {
2977
3008
  JOURNALISTIC: JOURNALISTIC$4,
2978
3009
  LEGAL: LEGAL$4,
2979
3010
  STARTDATE: STARTDATE$4,
3011
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$4,
2980
3012
  UNKNOWN: UNKNOWN$4
2981
3013
  };
2982
3014
 
@@ -3126,6 +3158,7 @@ const GEOBLOCK$3 = "This content is not available outside Switzerland.";
3126
3158
  const JOURNALISTIC$3 = "This content is temporarily unavailable for journalistic reasons.";
3127
3159
  const LEGAL$3 = "This content is not available due to legal restrictions.";
3128
3160
  const STARTDATE$3 = "This content is not available yet.";
3161
+ const VPNORPROXYDETECTED$3 = "This content cannot be played while using a VPN or a proxy.";
3129
3162
  const UNKNOWN$3 = "This content is not available.";
3130
3163
  const pillarboxLang$3 = {
3131
3164
  AGERATING12: AGERATING12$3,
@@ -3136,6 +3169,7 @@ const pillarboxLang$3 = {
3136
3169
  JOURNALISTIC: JOURNALISTIC$3,
3137
3170
  LEGAL: LEGAL$3,
3138
3171
  STARTDATE: STARTDATE$3,
3172
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$3,
3139
3173
  UNKNOWN: UNKNOWN$3
3140
3174
  };
3141
3175
 
@@ -3284,6 +3318,7 @@ const GEOBLOCK$2 = "La RTS ne dispose pas des droits de diffusion en dehors de l
3284
3318
  const JOURNALISTIC$2 = "Ce contenu est temporairement indisponible pour des raisons éditoriales.";
3285
3319
  const LEGAL$2 = "Pour des raisons juridiques, ce contenu n'est pas disponible.";
3286
3320
  const STARTDATE$2 = "Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.";
3321
+ const VPNORPROXYDETECTED$2 = "Ce contenu ne peut pas être lu avec un VPN ou un proxy.";
3287
3322
  const UNKNOWN$2 = "Ce contenu n'est actuellement pas disponible.";
3288
3323
  const pillarboxLang$2 = {
3289
3324
  AGERATING12: AGERATING12$2,
@@ -3294,6 +3329,7 @@ const pillarboxLang$2 = {
3294
3329
  JOURNALISTIC: JOURNALISTIC$2,
3295
3330
  LEGAL: LEGAL$2,
3296
3331
  STARTDATE: STARTDATE$2,
3332
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$2,
3297
3333
  UNKNOWN: UNKNOWN$2
3298
3334
  };
3299
3335
 
@@ -3431,6 +3467,7 @@ const GEOBLOCK$1 = "Questo media non è disponibile fuori dalla Svizzera.";
3431
3467
  const JOURNALISTIC$1 = "Questo contenuto è temporaneamente non disponibile per motivi editoriali.";
3432
3468
  const LEGAL$1 = "Il contenuto non è fruibile a causa di restrizioni legali.";
3433
3469
  const STARTDATE$1 = "Il contenuto non è ancora disponibile. Per cortesia prova più tardi.";
3470
+ const VPNORPROXYDETECTED$1 = "Questo contenuto non può essere riprodotto con VPN o proxy.";
3434
3471
  const UNKNOWN$1 = "Questo media non è disponibile.";
3435
3472
  const pillarboxLang$1 = {
3436
3473
  AGERATING12: AGERATING12$1,
@@ -3441,6 +3478,7 @@ const pillarboxLang$1 = {
3441
3478
  JOURNALISTIC: JOURNALISTIC$1,
3442
3479
  LEGAL: LEGAL$1,
3443
3480
  STARTDATE: STARTDATE$1,
3481
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$1,
3444
3482
  UNKNOWN: UNKNOWN$1
3445
3483
  };
3446
3484
 
@@ -3491,6 +3529,7 @@ const GEOBLOCK = "Quest cuntegn n'è betg disponibel ordaifer la Svizra.";
3491
3529
  const JOURNALISTIC = "Quest cuntegn na stat ad interim betg a disposiziun per motivs publicistics.";
3492
3530
  const LEGAL = "Quest cuntegn n'è betg disponibel perquai ch'el è scadì.";
3493
3531
  const STARTDATE = "Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.";
3532
+ const VPNORPROXYDETECTED = "Quest cuntegn na po betg vegnir reproducì cun VPN ni proxy activà.";
3494
3533
  const UNKNOWN = "Quest cuntegn n'è betg disponibel.";
3495
3534
  const pillarboxLang = {
3496
3535
  "Audio Player": "Audio-Player",
@@ -3583,6 +3622,7 @@ const pillarboxLang = {
3583
3622
  JOURNALISTIC: JOURNALISTIC,
3584
3623
  LEGAL: LEGAL,
3585
3624
  STARTDATE: STARTDATE,
3625
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED,
3586
3626
  UNKNOWN: UNKNOWN
3587
3627
  };
3588
3628