senza-sdk 4.2.39 → 4.2.41-b3ff4c0.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.39",
3
+ "version": "4.2.41-b3ff4c0.0",
4
4
  "main": "./src/api.js",
5
5
  "description": "API for Senza application",
6
6
  "license": "MIT",
@@ -754,6 +754,12 @@ class RemotePlayer extends EventTarget {
754
754
 
755
755
  _pause() {
756
756
  if (window.cefQuery) {
757
+ this._changePlayMode(false);
758
+ const isForegroundState = lifecycle.state === lifecycle.UiState.FOREGROUND || lifecycle.state === lifecycle.UiState.IN_TRANSITION_TO_FOREGROUND;
759
+ if (this._remotePlayerApiVersion >= 2 && !isAudioSyncEnabled() && isForegroundState) {
760
+ sdkLogger.info("remotePlayer pause: application in foreground, remote player is not playing.");
761
+ return Promise.resolve();
762
+ }
757
763
  const FCID = getFCID();
758
764
  const logger = sdkLogger.withFields({ FCID });
759
765
  logger.log("remotePlayer pause: sending pause request");
@@ -761,14 +767,12 @@ class RemotePlayer extends EventTarget {
761
767
  type: "remotePlayer.pause",
762
768
  class: "remotePlayer",
763
769
  action: "pause",
764
- fcid: FCID,
765
- streamType: isAudioSyncEnabled() ? StreamType.AUDIO : StreamType.AUDIO | StreamType.VIDEO | StreamType.SUBTITLE
770
+ fcid: FCID
766
771
  };
767
- let waitForResponse = false;
768
772
  if (this._remotePlayerApiVersion >= 2) {
769
- waitForResponse = true;
773
+ message.streamType = isAudioSyncEnabled() && isForegroundState ? StreamType.AUDIO : StreamType.AUDIO | StreamType.VIDEO | StreamType.SUBTITLE;
770
774
  }
771
- this._changePlayMode(false);
775
+ const waitForResponse = this._remotePlayerApiVersion >= 2;
772
776
  const request = { target: "TC", waitForResponse: waitForResponse, message: JSON.stringify(message) };
773
777
  return new Promise((resolve, reject) => {
774
778
  let timerId = 0;