@srgssr/pillarbox-web 1.19.1 → 1.20.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.
- package/dist/pillarbox-core.cjs.js +1 -1
- package/dist/pillarbox-core.es.js +1 -1
- package/dist/pillarbox.cjs.js +31 -1
- package/dist/pillarbox.cjs.js.map +1 -1
- package/dist/pillarbox.es.js +31 -1
- package/dist/pillarbox.es.js.map +1 -1
- package/dist/pillarbox.umd.js +31 -1
- package/dist/pillarbox.umd.js.map +1 -1
- package/dist/pillarbox.umd.min.js +1 -1
- package/dist/pillarbox.umd.min.js.map +1 -1
- package/dist/types/src/trackers/PillarboxMonitoring.d.ts +12 -0
- package/dist/types/src/trackers/PillarboxMonitoring.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/pillarbox.es.js
CHANGED
|
@@ -107,7 +107,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
107
107
|
return target;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const version = "1.19.
|
|
110
|
+
const version = "1.19.1";
|
|
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;
|