@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.
@@ -107,7 +107,7 @@ function _objectWithoutProperties(source, excluded) {
107
107
  return target;
108
108
  }
109
109
 
110
- const version = "1.19.0";
110
+ const version = "1.20.0";
111
111
 
112
112
  /** @import VJSPlayer from 'video.js/dist/types/player' */
113
113
  /** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
@@ -1839,6 +1839,17 @@ class PillarboxMonitoring {
1839
1839
  return PillarboxMonitoring.secondsToMilliseconds(bufferDuration);
1840
1840
  }
1841
1841
 
1842
+ /**
1843
+ * Gets the language of the current audio track.
1844
+ *
1845
+ * @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.
1846
+ */
1847
+ currentAudioTrack() {
1848
+ const audioTrack = this.player.audioTrack();
1849
+ if (!audioTrack || !audioTrack.language) return;
1850
+ return audioTrack.language;
1851
+ }
1852
+
1842
1853
  /**
1843
1854
  * Get the current representation when playing a Dash or Hls media.
1844
1855
  *
@@ -1904,22 +1915,37 @@ class PillarboxMonitoring {
1904
1915
  return this.player.currentSource().mediaData;
1905
1916
  }
1906
1917
 
1918
+ /**
1919
+ * Gets the language of the current text track (subtitles or captions).
1920
+ *
1921
+ * @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.
1922
+ */
1923
+ currentTextTrack() {
1924
+ const textTrack = this.player.textTrack();
1925
+ if (!textTrack || !textTrack.language) return;
1926
+ return textTrack.language;
1927
+ }
1928
+
1907
1929
  /**
1908
1930
  * Handles player errors by sending an `ERROR` event, then resets the session.
1909
1931
  */
1910
1932
  error() {
1933
+ const audio = this.currentAudioTrack();
1911
1934
  const error = this.player.error();
1912
1935
  const playbackPosition = this.playbackPosition();
1913
1936
  const representation = this.currentRepresentation();
1914
1937
  const url = representation ? representation.uri : this.player.currentSource().src;
1938
+ const subtitles = this.currentTextTrack();
1915
1939
  if (!this.player.hasStarted()) {
1916
1940
  this.sendEvent('START', this.startEventData());
1917
1941
  }
1918
1942
  this.sendEvent('ERROR', _objectSpread2(_objectSpread2({
1943
+ audio,
1919
1944
  log: JSON.stringify(error.metadata || pillarbox.log.history().slice(-15)),
1920
1945
  message: error.message,
1921
1946
  name: PillarboxMonitoring.errorKeyCode(error.code)
1922
1947
  }, playbackPosition), {}, {
1948
+ subtitles,
1923
1949
  url
1924
1950
  }));
1925
1951
  this.reset();
@@ -2353,6 +2379,7 @@ class PillarboxMonitoring {
2353
2379
  * @returns {StatusEventData} The current event data
2354
2380
  */
2355
2381
  statusEventData() {
2382
+ const audio = this.currentAudioTrack();
2356
2383
  const bandwidth = this.bandwidth();
2357
2384
  const buffered_duration = this.bufferDuration();
2358
2385
  const {
@@ -2369,7 +2396,9 @@ class PillarboxMonitoring {
2369
2396
  } = this.playbackPosition();
2370
2397
  const stream_type = isFinite(this.player.duration()) ? 'On-demand' : 'Live';
2371
2398
  const stall = this.stallInfo();
2399
+ const subtitles = this.currentTextTrack();
2372
2400
  const data = {
2401
+ audio,
2373
2402
  bandwidth,
2374
2403
  bitrate,
2375
2404
  buffered_duration,
@@ -2379,6 +2408,7 @@ class PillarboxMonitoring {
2379
2408
  position_timestamp,
2380
2409
  stall,
2381
2410
  stream_type,
2411
+ subtitles,
2382
2412
  url
2383
2413
  };
2384
2414
  return data;
@@ -2965,6 +2995,7 @@ const GEOBLOCK$4 = "Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.";
2965
2995
  const JOURNALISTIC$4 = "Dieser Inhalt steht aus publizistischen Gründen vorübergehend nicht zur Verfügung.";
2966
2996
  const LEGAL$4 = "Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.";
2967
2997
  const STARTDATE$4 = "Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.";
2998
+ const VPNORPROXYDETECTED$4 = "Dieser Inhalt ist mit VPN oder Proxy nicht abspielbar.";
2968
2999
  const UNKNOWN$4 = "Dieser Inhalt ist nicht verfügbar.";
2969
3000
  const pillarboxLang$4 = {
2970
3001
  AGERATING12: AGERATING12$4,
@@ -2975,6 +3006,7 @@ const pillarboxLang$4 = {
2975
3006
  JOURNALISTIC: JOURNALISTIC$4,
2976
3007
  LEGAL: LEGAL$4,
2977
3008
  STARTDATE: STARTDATE$4,
3009
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$4,
2978
3010
  UNKNOWN: UNKNOWN$4
2979
3011
  };
2980
3012
 
@@ -3124,6 +3156,7 @@ const GEOBLOCK$3 = "This content is not available outside Switzerland.";
3124
3156
  const JOURNALISTIC$3 = "This content is temporarily unavailable for journalistic reasons.";
3125
3157
  const LEGAL$3 = "This content is not available due to legal restrictions.";
3126
3158
  const STARTDATE$3 = "This content is not available yet.";
3159
+ const VPNORPROXYDETECTED$3 = "This content cannot be played while using a VPN or a proxy.";
3127
3160
  const UNKNOWN$3 = "This content is not available.";
3128
3161
  const pillarboxLang$3 = {
3129
3162
  AGERATING12: AGERATING12$3,
@@ -3134,6 +3167,7 @@ const pillarboxLang$3 = {
3134
3167
  JOURNALISTIC: JOURNALISTIC$3,
3135
3168
  LEGAL: LEGAL$3,
3136
3169
  STARTDATE: STARTDATE$3,
3170
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$3,
3137
3171
  UNKNOWN: UNKNOWN$3
3138
3172
  };
3139
3173
 
@@ -3282,6 +3316,7 @@ const GEOBLOCK$2 = "La RTS ne dispose pas des droits de diffusion en dehors de l
3282
3316
  const JOURNALISTIC$2 = "Ce contenu est temporairement indisponible pour des raisons éditoriales.";
3283
3317
  const LEGAL$2 = "Pour des raisons juridiques, ce contenu n'est pas disponible.";
3284
3318
  const STARTDATE$2 = "Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.";
3319
+ const VPNORPROXYDETECTED$2 = "Ce contenu ne peut pas être lu avec un VPN ou un proxy.";
3285
3320
  const UNKNOWN$2 = "Ce contenu n'est actuellement pas disponible.";
3286
3321
  const pillarboxLang$2 = {
3287
3322
  AGERATING12: AGERATING12$2,
@@ -3292,6 +3327,7 @@ const pillarboxLang$2 = {
3292
3327
  JOURNALISTIC: JOURNALISTIC$2,
3293
3328
  LEGAL: LEGAL$2,
3294
3329
  STARTDATE: STARTDATE$2,
3330
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$2,
3295
3331
  UNKNOWN: UNKNOWN$2
3296
3332
  };
3297
3333
 
@@ -3429,6 +3465,7 @@ const GEOBLOCK$1 = "Questo media non è disponibile fuori dalla Svizzera.";
3429
3465
  const JOURNALISTIC$1 = "Questo contenuto è temporaneamente non disponibile per motivi editoriali.";
3430
3466
  const LEGAL$1 = "Il contenuto non è fruibile a causa di restrizioni legali.";
3431
3467
  const STARTDATE$1 = "Il contenuto non è ancora disponibile. Per cortesia prova più tardi.";
3468
+ const VPNORPROXYDETECTED$1 = "Questo contenuto non può essere riprodotto con VPN o proxy.";
3432
3469
  const UNKNOWN$1 = "Questo media non è disponibile.";
3433
3470
  const pillarboxLang$1 = {
3434
3471
  AGERATING12: AGERATING12$1,
@@ -3439,6 +3476,7 @@ const pillarboxLang$1 = {
3439
3476
  JOURNALISTIC: JOURNALISTIC$1,
3440
3477
  LEGAL: LEGAL$1,
3441
3478
  STARTDATE: STARTDATE$1,
3479
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED$1,
3442
3480
  UNKNOWN: UNKNOWN$1
3443
3481
  };
3444
3482
 
@@ -3489,6 +3527,7 @@ const GEOBLOCK = "Quest cuntegn n'è betg disponibel ordaifer la Svizra.";
3489
3527
  const JOURNALISTIC = "Quest cuntegn na stat ad interim betg a disposiziun per motivs publicistics.";
3490
3528
  const LEGAL = "Quest cuntegn n'è betg disponibel perquai ch'el è scadì.";
3491
3529
  const STARTDATE = "Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.";
3530
+ const VPNORPROXYDETECTED = "Quest cuntegn na po betg vegnir reproducì cun VPN ni proxy activà.";
3492
3531
  const UNKNOWN = "Quest cuntegn n'è betg disponibel.";
3493
3532
  const pillarboxLang = {
3494
3533
  "Audio Player": "Audio-Player",
@@ -3581,6 +3620,7 @@ const pillarboxLang = {
3581
3620
  JOURNALISTIC: JOURNALISTIC,
3582
3621
  LEGAL: LEGAL,
3583
3622
  STARTDATE: STARTDATE,
3623
+ VPNORPROXYDETECTED: VPNORPROXYDETECTED,
3584
3624
  UNKNOWN: UNKNOWN
3585
3625
  };
3586
3626