senza-sdk 4.2.63-8d2e60f.0 → 4.2.63
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 +2 -2
- package/src/alarmManager.js +1 -1
- package/src/lifecycle.js +1 -1
- package/src/senzaShakaPlayer.js +19 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "senza-sdk",
|
|
3
|
-
"version": "4.2.63
|
|
3
|
+
"version": "4.2.63",
|
|
4
4
|
"main": "./src/api.js",
|
|
5
5
|
"description": "API for Senza application",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"eslint": "eslint --max-warnings 0 src test",
|
|
16
16
|
"build": "npx webpack --config webpack.config.js",
|
|
17
17
|
"test": "jest --coverage --verbose",
|
|
18
|
-
"testall": "jest --coverage --verbose && npm run eslint --fix"
|
|
18
|
+
"testall" : "jest --coverage --verbose && npm run eslint --fix"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/cli": "^7.13.16",
|
package/src/alarmManager.js
CHANGED
|
@@ -66,7 +66,7 @@ class AlarmManager extends EventTarget {
|
|
|
66
66
|
if (isTriggering) {
|
|
67
67
|
if (!this._moveToForegroundHasBeenCalled && window.cefQuery) {
|
|
68
68
|
logger.log("Application is about to be terminated since didn't move to foreground");
|
|
69
|
-
const message = { type: "
|
|
69
|
+
const message = { type: "terminating" };
|
|
70
70
|
const request = { target:"TC", waitForResponse: false, message: JSON.stringify(message) };
|
|
71
71
|
window.cefQuery({
|
|
72
72
|
request: JSON.stringify(request),
|
package/src/lifecycle.js
CHANGED
|
@@ -914,7 +914,7 @@ class Lifecycle extends EventTarget {
|
|
|
914
914
|
if (window.cefQuery) {
|
|
915
915
|
const FCID = getFCID();
|
|
916
916
|
const message = {
|
|
917
|
-
type: "
|
|
917
|
+
type: "terminating",
|
|
918
918
|
fcid: FCID
|
|
919
919
|
};
|
|
920
920
|
const request = { target: "TC", waitForResponse: false, message: JSON.stringify(message) };
|
package/src/senzaShakaPlayer.js
CHANGED
|
@@ -78,7 +78,7 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
78
78
|
* @description Timeout in milliseconds to wait for playing event
|
|
79
79
|
* @default 3000
|
|
80
80
|
*/
|
|
81
|
-
_playingTimeout =
|
|
81
|
+
_playingTimeout = 4000;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* @private
|
|
@@ -93,7 +93,7 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
93
93
|
* @description Whether to stop remote player on error
|
|
94
94
|
* @default false
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
_shouldStopOnRemotePlayerError = false;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* @private
|
|
@@ -284,13 +284,15 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
284
284
|
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
|
-
* Handles errors
|
|
287
|
+
* Handles errors received by remote player while waiting for the playing event.
|
|
288
|
+
* The promise returned to the call for video element play will be rejected.
|
|
288
289
|
* @private
|
|
289
290
|
* @param {Error} error - The error object.
|
|
290
291
|
*/
|
|
291
292
|
_handlePlayPromiseError(error) {
|
|
292
293
|
|
|
293
294
|
sdkLogger.error("Error while waiting for playing event:", error);
|
|
295
|
+
|
|
294
296
|
if (this._playPromiseReject) {
|
|
295
297
|
this._playPromiseReject(error);
|
|
296
298
|
this._playPromiseResolve = null;
|
|
@@ -300,6 +302,7 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
300
302
|
clearTimeout(this._playTimeoutId);
|
|
301
303
|
this._playTimeoutId = null;
|
|
302
304
|
}
|
|
305
|
+
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
/**
|
|
@@ -560,11 +563,12 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
560
563
|
const isCritical = this._isErrorCritical(remotePlayerErrorCode);
|
|
561
564
|
const error = this._createSenzaError(remotePlayerErrorCode, message, isCritical);
|
|
562
565
|
const errorMap = new Map();
|
|
566
|
+
const shouldStopPlayback = this._shouldStopOnRemotePlayerError && this.videoElement && isCritical;
|
|
563
567
|
errorMap.set("detail", error);
|
|
564
568
|
|
|
565
569
|
// Check if we should stop playback - only for critical errors when configured
|
|
566
|
-
|
|
567
|
-
|
|
570
|
+
|
|
571
|
+
if (shouldStopPlayback) {
|
|
568
572
|
try {
|
|
569
573
|
sdkLogger.warn("Stopping local player playback due to critical error");
|
|
570
574
|
// Stop only local playback
|
|
@@ -572,9 +576,11 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
572
576
|
} catch (stopError) {
|
|
573
577
|
sdkLogger.error("Error while trying to stop video element playback:", stopError);
|
|
574
578
|
}
|
|
579
|
+
// Handle error while waiting for play event. If the error is not critical or the system is configured not to stop remote player on error,
|
|
580
|
+
// the playback timeout will start the local playback
|
|
581
|
+
this._handlePlayPromiseError(error);
|
|
575
582
|
}
|
|
576
|
-
|
|
577
|
-
this._handlePlayPromiseError(error);
|
|
583
|
+
|
|
578
584
|
this.dispatchEvent(new shaka.util.FakeEvent("error", errorMap));
|
|
579
585
|
}
|
|
580
586
|
|
|
@@ -684,14 +690,14 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
684
690
|
/**
|
|
685
691
|
* Override the configure method to add custom configuration handling
|
|
686
692
|
* Supports the following additional configuration options:
|
|
687
|
-
* -
|
|
693
|
+
* - shouldStopOnRemotePlayerError: boolean - If true, local player will be stopped on remote player error
|
|
688
694
|
*
|
|
689
695
|
* @override
|
|
690
696
|
* @param {Object} config - Configuration object to be merged with existing config
|
|
691
|
-
* @param {boolean} [config.
|
|
697
|
+
* @param {boolean} [config.shouldStopOnRemotePlayerError=true] - Whether to stop local player on remote player error
|
|
692
698
|
* @example
|
|
693
699
|
* player.configure({
|
|
694
|
-
*
|
|
700
|
+
* shouldStopOnRemotePlayerError: false, // Don't stop local playback on remote player error
|
|
695
701
|
* // ... other shaka configurations
|
|
696
702
|
* });
|
|
697
703
|
*/
|
|
@@ -699,12 +705,12 @@ export class SenzaShakaPlayer extends shaka.Player {
|
|
|
699
705
|
sdkLogger.log("configure player with: ", JSON.stringify(config));
|
|
700
706
|
|
|
701
707
|
// Handle custom configuration
|
|
702
|
-
if (config.
|
|
703
|
-
this.
|
|
708
|
+
if (config.shouldStopOnRemotePlayerError !== undefined) {
|
|
709
|
+
this._shouldStopOnRemotePlayerError = !!config.shouldStopOnRemotePlayerError;
|
|
704
710
|
// Remove our custom config so it doesn't get passed to parent
|
|
705
711
|
// Use rest operator without creating a named variable for the removed property
|
|
706
712
|
// eslint-disable-next-line no-unused-vars
|
|
707
|
-
const {
|
|
713
|
+
const { shouldStopOnRemotePlayerError, ...shakaConfig } = config;
|
|
708
714
|
config = shakaConfig;
|
|
709
715
|
}
|
|
710
716
|
|