senza-sdk 4.2.37-5a2f3f6.0 → 4.2.38-2f9abc6.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-5a2f3f6.0",
3
+ "version": "4.2.38-2f9abc6.0",
4
4
  "main": "./src/api.js",
5
5
  "description": "API for Senza application",
6
6
  "license": "MIT",
@@ -891,7 +891,6 @@ class RemotePlayer extends EventTarget {
891
891
  const FCID = getFCID();
892
892
  const playbackPosition = position ?? 0;
893
893
  const logger = sdkLogger.withFields({ FCID, loadUrl: url, playbackPosition });
894
- logger.log(`remotePlayer load: sending setPlayableUri request. remotePlayer._isPlaying: ${this._isPlaying}`);
895
894
  const audioLanguage = this._selectedAudioTrack || this._config.preferredAudioLanguage || "";
896
895
  let subtitlesLanguage = "";
897
896
  if (this._textTrackVisibility) {
@@ -914,6 +913,7 @@ class RemotePlayer extends EventTarget {
914
913
  } else {
915
914
  message.type = "setPlayableUri";
916
915
  }
916
+ logger.log(`remotePlayer load: sending ${message.type} request. remotePlayer._isPlaying: ${this._isPlaying}`);
917
917
  const request = { target: "TC", waitForResponse: true, message: JSON.stringify(message) };
918
918
  let timerId = 0;
919
919
  const timeBeforeSendingRequest = Date.now();
@@ -922,7 +922,7 @@ class RemotePlayer extends EventTarget {
922
922
  persistent: false,
923
923
  onSuccess: () => {
924
924
  const duration = Date.now() - timeBeforeSendingRequest;
925
- logger.withFields({ duration }).log(`setPlayableUri completed successfully after ${duration} ms`);
925
+ logger.withFields({ duration }).log(`${message.type} completed successfully after ${duration} ms`);
926
926
  if (position > 0) {
927
927
  setPlaybackInfo({ playbackPosition: position });
928
928
  }
@@ -934,7 +934,7 @@ class RemotePlayer extends EventTarget {
934
934
  },
935
935
  onFailure: (code, msg) => {
936
936
  const duration = Date.now() - timeBeforeSendingRequest;
937
- logger.withFields({ duration }).log(`setPlayableUri failed after ${duration} ms. Error code: ${code}, error message: ${msg}`);
937
+ logger.withFields({ duration }).log(`${message.type} failed after ${duration} ms. Error code: ${code}, error message: ${msg}`);
938
938
  timerId = clearTimer(timerId);
939
939
  // If setPlayableUri failed because the request was invalid, we want to retain the previous load mode
940
940
  if (code === INVALID_SET_PLAYABLE_URI_CODE) {
@@ -946,10 +946,10 @@ class RemotePlayer extends EventTarget {
946
946
  reject(new RemotePlayerError(code, msg));
947
947
  }
948
948
  });
949
- logger.log(`window.cefQuery for setPlayableUri returned query id ${queryId}`);
949
+ logger.log(`window.cefQuery for ${message.type} returned query id ${queryId}`);
950
950
  const loadTimeout = this._remotePlayerConfirmationTimeout + 1000;
951
951
  timerId = setTimeout(() => {
952
- logger.log(`setPlayableUri reached timeout of ${loadTimeout} ms, canceling query id ${queryId}`);
952
+ logger.log(`${message.type} reached timeout of ${loadTimeout} ms, canceling query id ${queryId}`);
953
953
  window.cefQueryCancel(queryId);
954
954
  this._changeLoadMode(this.LoadMode.NOT_LOADED);
955
955
  this._loadedUrl = "";
@@ -1198,7 +1198,11 @@ class RemotePlayer extends EventTarget {
1198
1198
  const prevIsPlaying = this._isPlaying;
1199
1199
  try {
1200
1200
  if (this._isPlaying) await this.pause();
1201
- await this._load(this._loadedUrl, this._videoElement.currentTime, false);
1201
+ let position = this.currentTime;
1202
+ if (this._videoElement) {
1203
+ position = this._videoElement.currentTime;
1204
+ }
1205
+ await this._load(this._loadedUrl, position, false);
1202
1206
  } catch (e) {
1203
1207
  // Do NOT reject - just log and revert selection
1204
1208
  this._selectedAudioTrack = prevSelectedAudioTrack;
@@ -1269,7 +1273,11 @@ class RemotePlayer extends EventTarget {
1269
1273
 
1270
1274
  try {
1271
1275
  if (this._isPlaying) await this.pause();
1272
- await this._load(this._loadedUrl, this._videoElement.currentTime, false);
1276
+ let position = this.currentTime;
1277
+ if (this._videoElement) {
1278
+ position = this._videoElement.currentTime;
1279
+ }
1280
+ await this._load(this._loadedUrl, position, false);
1273
1281
  } catch (e) {
1274
1282
  // Do NOT reject - just log and revert selection
1275
1283
  this._selectedSubtitlesTrack = prevSelectedTextTrack;