senza-sdk 4.2.39-d033ed2.0 → 4.2.40
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 +6 -3
- package/src/SessionInfo.js +2 -2
- package/src/api.js +1 -1
- package/src/deviceManager.js +5 -2
- package/src/remotePlayer.js +13 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "senza-sdk",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.40",
|
|
4
4
|
"main": "./src/api.js",
|
|
5
5
|
"description": "API for Senza application",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,9 +21,12 @@
|
|
|
21
21
|
"@babel/core": "7.18.6",
|
|
22
22
|
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
|
|
23
23
|
"@babel/preset-env": "^7.14.1",
|
|
24
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
25
|
+
"@eslint/js": "^9.22.0",
|
|
24
26
|
"babel-jest": "^27.5.1",
|
|
25
|
-
"eslint": "^
|
|
26
|
-
"eslint-plugin-jest": "^
|
|
27
|
+
"eslint": "^9.22.0",
|
|
28
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
29
|
+
"globals": "^16.0.0",
|
|
27
30
|
"jest": "^27.5.1",
|
|
28
31
|
"jsdoc-to-markdown": "^7.1.1",
|
|
29
32
|
"webpack": "^5.72.1",
|
package/src/SessionInfo.js
CHANGED
|
@@ -7,7 +7,7 @@ class SessionInfo {
|
|
|
7
7
|
try {
|
|
8
8
|
return JSON.parse(this.sessionInfoStr);
|
|
9
9
|
} catch (e) {
|
|
10
|
-
sdkLogger.warn("Failed to
|
|
10
|
+
sdkLogger.warn("Failed to parse sessionInfo " + e.message);
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ class SessionInfo {
|
|
|
16
16
|
try {
|
|
17
17
|
JSON.parse(objStr); // Performing parse just as a validation that this is a valid json
|
|
18
18
|
} catch (e) {
|
|
19
|
-
throw Error("Failed to parse sessionInfo");
|
|
19
|
+
throw Error("Failed to parse sessionInfo " + e.message);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
this.sessionInfoStr = objStr;
|
package/src/api.js
CHANGED
|
@@ -484,7 +484,7 @@ export function getClientAssertion() {
|
|
|
484
484
|
sdkLogger.log(`client_assertion request successfully returned ${response}`);
|
|
485
485
|
resolve(json_response);
|
|
486
486
|
} catch (e) {
|
|
487
|
-
sdkLogger.error(`Failed to parse client assertion ${response}`);
|
|
487
|
+
sdkLogger.error(`Failed to parse client assertion ${response}: ${e.message}`);
|
|
488
488
|
reject(new ClientAssertionError(0, "Failed to parse client assertion"));
|
|
489
489
|
}
|
|
490
490
|
|
package/src/deviceManager.js
CHANGED
|
@@ -74,6 +74,7 @@ class DeviceManager extends EventTarget {
|
|
|
74
74
|
* @property {string} DeviceInfo.tenant
|
|
75
75
|
* @property {string} DeviceInfo.clientIp
|
|
76
76
|
* @property {string} DeviceInfo.countryCode A 2-letter code as defined in ISO_3166-1
|
|
77
|
+
* @property {string} DeviceInfo.connectionType The type of device used during the current connection. Possible values are "device" which mean real device, "simulator" - simulated device - that used during development.
|
|
77
78
|
*/
|
|
78
79
|
get deviceInfo() {
|
|
79
80
|
const sessionInfoObj = sessionInfo.sessionInfoObj;
|
|
@@ -84,7 +85,8 @@ class DeviceManager extends EventTarget {
|
|
|
84
85
|
community: sessionInfoObj.community,
|
|
85
86
|
tenant: sessionInfoObj.tenant,
|
|
86
87
|
clientIp: sessionInfoObj.clientIp,
|
|
87
|
-
countryCode: sessionInfoObj.general?.location?.["x-country-code"]
|
|
88
|
+
countryCode: sessionInfoObj.general?.location?.["x-country-code"],
|
|
89
|
+
connectionType: (!sessionInfoObj.connectionType || sessionInfoObj.connectionType === "direct") ? "device" : sessionInfoObj.connectionType
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
sdkLogger.log("getDeviceInfo running locally, returning dummy info");
|
|
@@ -94,7 +96,8 @@ class DeviceManager extends EventTarget {
|
|
|
94
96
|
community: "LocalDev",
|
|
95
97
|
tenant: "XXXXXX",
|
|
96
98
|
clientIp: "0.0.0.0",
|
|
97
|
-
countryCode: "XX"
|
|
99
|
+
countryCode: "XX",
|
|
100
|
+
connectionType: "simulator"
|
|
98
101
|
};
|
|
99
102
|
}
|
|
100
103
|
|
package/src/remotePlayer.js
CHANGED
|
@@ -45,7 +45,7 @@ function getPlaybackInfo() {
|
|
|
45
45
|
try {
|
|
46
46
|
playbackInfo = JSON.parse(playbackInfoStr);
|
|
47
47
|
} catch (e) {
|
|
48
|
-
sdkLogger.error(`Playback Info parse failed. playbackStr = ${playbackInfoStr}`);
|
|
48
|
+
sdkLogger.error(`Playback Info parse failed. playbackStr = ${playbackInfoStr} error = ${e.message}`);
|
|
49
49
|
playbackInfo = { playbackPosition: 0, assetDuration: 0 };
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -59,7 +59,7 @@ function setPlaybackInfo(playbackInfo) {
|
|
|
59
59
|
window.setPlaybackInfo(playbackInfoStr);
|
|
60
60
|
}
|
|
61
61
|
} catch (e) {
|
|
62
|
-
sdkLogger.error("Playback Info to json string failed");
|
|
62
|
+
sdkLogger.error("Playback Info to json string failed: ", e.message);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -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
|
-
|
|
773
|
+
message.streamType = isAudioSyncEnabled() && isForegroundState ? StreamType.AUDIO : StreamType.AUDIO | StreamType.VIDEO | StreamType.SUBTITLE;
|
|
770
774
|
}
|
|
771
|
-
this.
|
|
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;
|
|
@@ -859,10 +863,11 @@ class RemotePlayer extends EventTarget {
|
|
|
859
863
|
* @param {string} url url to load
|
|
860
864
|
* @param {number} [position] start position in seconds (if not provided, start from beginning (VOD) or current time (LTV))
|
|
861
865
|
* @param {string} [audioTrackId] audio track ID to use for loading with this url
|
|
862
|
-
* @param {string} [textTrackId]
|
|
866
|
+
* @param {string} [textTrackId] text track ID to use for loading with this url
|
|
863
867
|
* @param {boolean} [reset] whether the payer should reset its internal data before calling load
|
|
864
868
|
* @returns {Promise}
|
|
865
869
|
* @throws {RemotePlayerError} error object contains code & msg
|
|
870
|
+
* @private
|
|
866
871
|
*
|
|
867
872
|
* */
|
|
868
873
|
|