@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.cjs.js
CHANGED
|
@@ -109,7 +109,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
109
109
|
return target;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const version = "1.19.
|
|
112
|
+
const version = "1.19.1";
|
|
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;
|