senza-sdk 4.2.37 → 4.2.38
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/bundle.js +1 -1
- package/package.json +1 -1
- package/src/remotePlayer.js +9 -6
package/package.json
CHANGED
package/src/remotePlayer.js
CHANGED
|
@@ -852,19 +852,22 @@ class RemotePlayer extends EventTarget {
|
|
|
852
852
|
*
|
|
853
853
|
* */
|
|
854
854
|
async load(url, position) {
|
|
855
|
-
return this._load(url, position
|
|
855
|
+
return this._load(url, position);
|
|
856
856
|
}
|
|
857
857
|
|
|
858
858
|
/** Tell the remote player to load the given URL.
|
|
859
859
|
* @param {string} url url to load
|
|
860
860
|
* @param {number} [position] start position in seconds (if not provided, start from beginning (VOD) or current time (LTV))
|
|
861
|
+
* @param {string} [audioTrackId] audio track ID to use for loading with this url
|
|
862
|
+
* @param {string} [textTrackId] text track ID to use for loading with this url
|
|
861
863
|
* @param {boolean} [reset] whether the payer should reset its internal data before calling load
|
|
862
864
|
* @returns {Promise}
|
|
863
865
|
* @throws {RemotePlayerError} error object contains code & msg
|
|
866
|
+
* @private
|
|
864
867
|
*
|
|
865
868
|
* */
|
|
866
869
|
|
|
867
|
-
async _load(url, position, reset = true) {
|
|
870
|
+
async _load(url, position, audioTrackId = undefined, textTrackId = undefined, reset = true) {
|
|
868
871
|
if (!this._isInitialized) {
|
|
869
872
|
throw new RemotePlayerError(6500, "Cannot call load() if remote player is not initialized");
|
|
870
873
|
}
|
|
@@ -891,10 +894,10 @@ class RemotePlayer extends EventTarget {
|
|
|
891
894
|
const FCID = getFCID();
|
|
892
895
|
const playbackPosition = position ?? 0;
|
|
893
896
|
const logger = sdkLogger.withFields({ FCID, loadUrl: url, playbackPosition });
|
|
894
|
-
const audioLanguage = this._selectedAudioTrack || this._config.preferredAudioLanguage || "";
|
|
897
|
+
const audioLanguage = audioTrackId || this._selectedAudioTrack || this._config.preferredAudioLanguage || "";
|
|
895
898
|
let subtitlesLanguage = "";
|
|
896
899
|
if (this._textTrackVisibility) {
|
|
897
|
-
subtitlesLanguage = this._selectedSubtitlesTrack || this._config.preferredSubtitlesLanguage || "";
|
|
900
|
+
subtitlesLanguage = textTrackId || this._selectedSubtitlesTrack || this._config.preferredSubtitlesLanguage || "";
|
|
898
901
|
}
|
|
899
902
|
|
|
900
903
|
const message = {
|
|
@@ -1203,7 +1206,7 @@ class RemotePlayer extends EventTarget {
|
|
|
1203
1206
|
if (this._videoElement) {
|
|
1204
1207
|
position = this._videoElement.currentTime;
|
|
1205
1208
|
}
|
|
1206
|
-
await this._load(this._loadedUrl, position, false);
|
|
1209
|
+
await this._load(this._loadedUrl, position, audioTrackId, undefined, false);
|
|
1207
1210
|
} catch (e) {
|
|
1208
1211
|
// Do NOT reject - just log and revert selection
|
|
1209
1212
|
this._selectedAudioTrack = prevSelectedAudioTrack;
|
|
@@ -1278,7 +1281,7 @@ class RemotePlayer extends EventTarget {
|
|
|
1278
1281
|
if (this._videoElement) {
|
|
1279
1282
|
position = this._videoElement.currentTime;
|
|
1280
1283
|
}
|
|
1281
|
-
await this._load(this._loadedUrl, position, false);
|
|
1284
|
+
await this._load(this._loadedUrl, position, undefined, textTrackId, false);
|
|
1282
1285
|
} catch (e) {
|
|
1283
1286
|
// Do NOT reject - just log and revert selection
|
|
1284
1287
|
this._selectedSubtitlesTrack = prevSelectedTextTrack;
|