senza-sdk 4.2.37 → 4.2.39-d033ed2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "senza-sdk",
3
- "version": "4.2.37",
3
+ "version": "4.2.39-d033ed2.0",
4
4
  "main": "./src/api.js",
5
5
  "description": "API for Senza application",
6
6
  "license": "MIT",
@@ -852,19 +852,21 @@ class RemotePlayer extends EventTarget {
852
852
  *
853
853
  * */
854
854
  async load(url, position) {
855
- return this._load(url, position, true);
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] audio 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
864
866
  *
865
867
  * */
866
868
 
867
- async _load(url, position, reset = true) {
869
+ async _load(url, position, audioTrackId = undefined, textTrackId = undefined, reset = true) {
868
870
  if (!this._isInitialized) {
869
871
  throw new RemotePlayerError(6500, "Cannot call load() if remote player is not initialized");
870
872
  }
@@ -891,10 +893,10 @@ class RemotePlayer extends EventTarget {
891
893
  const FCID = getFCID();
892
894
  const playbackPosition = position ?? 0;
893
895
  const logger = sdkLogger.withFields({ FCID, loadUrl: url, playbackPosition });
894
- const audioLanguage = this._selectedAudioTrack || this._config.preferredAudioLanguage || "";
896
+ const audioLanguage = audioTrackId || this._selectedAudioTrack || this._config.preferredAudioLanguage || "";
895
897
  let subtitlesLanguage = "";
896
898
  if (this._textTrackVisibility) {
897
- subtitlesLanguage = this._selectedSubtitlesTrack || this._config.preferredSubtitlesLanguage || "";
899
+ subtitlesLanguage = textTrackId || this._selectedSubtitlesTrack || this._config.preferredSubtitlesLanguage || "";
898
900
  }
899
901
 
900
902
  const message = {
@@ -1203,7 +1205,7 @@ class RemotePlayer extends EventTarget {
1203
1205
  if (this._videoElement) {
1204
1206
  position = this._videoElement.currentTime;
1205
1207
  }
1206
- await this._load(this._loadedUrl, position, false);
1208
+ await this._load(this._loadedUrl, position, audioTrackId, undefined, false);
1207
1209
  } catch (e) {
1208
1210
  // Do NOT reject - just log and revert selection
1209
1211
  this._selectedAudioTrack = prevSelectedAudioTrack;
@@ -1278,7 +1280,7 @@ class RemotePlayer extends EventTarget {
1278
1280
  if (this._videoElement) {
1279
1281
  position = this._videoElement.currentTime;
1280
1282
  }
1281
- await this._load(this._loadedUrl, position, false);
1283
+ await this._load(this._loadedUrl, position, undefined, textTrackId, false);
1282
1284
  } catch (e) {
1283
1285
  // Do NOT reject - just log and revert selection
1284
1286
  this._selectedSubtitlesTrack = prevSelectedTextTrack;