senza-sdk 4.3.6 → 4.4.1-daf0312.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.3.6",
3
+ "version": "4.4.1-daf0312.0",
4
4
  "main": "./src/api.js",
5
5
  "description": "API for Senza application",
6
6
  "license": "MIT",
@@ -54,9 +54,9 @@
54
54
  },
55
55
  "src/interface": {
56
56
  "branches": 68.42,
57
- "functions": 39.63,
57
+ "functions": 39.63,
58
58
  "lines": 64.94,
59
- "statements": 65.32
59
+ "statements": 65.32
60
60
  }
61
61
  }
62
62
  },
package/src/api.js CHANGED
@@ -370,31 +370,6 @@ export function setTimezone(timezone) {
370
370
  }
371
371
  }
372
372
 
373
- /**
374
- * @deprecated use deviceManager.deviceInfo instead.
375
- * Returns the device information, including device id, connection id, community, tenant and client ip
376
- * */
377
- export function getDeviceInfo() {
378
- // STOP DO NOT CHANGE THIS FUNCTION AS IT IS DEPRECATED!!!!
379
- if (isRunningE2E()) {
380
- return {
381
- deviceId: deviceManager.deviceInfo.deviceId,
382
- connectionId: deviceManager.deviceInfo.connectionId,
383
- community: deviceManager.deviceInfo.community,
384
- tenant: deviceManager.deviceInfo.tenant,
385
- clientIp: deviceManager.deviceInfo.clientIp
386
- };
387
- }
388
- sdkLogger.log("getDeviceInfo running locally, returning dummy info");
389
- return {
390
- deviceId: "123456789",
391
- connectionId: "dummy",
392
- community: "LocalDev",
393
- tenant: "XXXXXX",
394
- clientIp: "0.0.0.0"
395
- };
396
- }
397
-
398
373
  export { lifecycle, remotePlayer, alarmManager, deviceManager, platformManager, messageManager, ShakaPlayerImplementation as ShakaPlayer, shakaImplementation as shaka, showSequence, initSequence };
399
374
 
400
375
  // Assign the senza library to the old name (hs) for backward compatibility
@@ -63,21 +63,21 @@ class AlarmManager extends AlarmManagerInterface {
63
63
  const alarmHandlingDuration = Date.now() - timeBeforeAlarmHandling;
64
64
  logger.log(`All callbacks for alarm '${e.detail.alarmName}' are finished within ${alarmHandlingDuration}ms`);
65
65
  // If this alarm triggered the application, and moveToForeground has not been called as a result of the alarm
66
- // (i.e. the application is still in the background), we want to intentionally terminate the ui in order to save resources.
66
+ // (i.e. the application is still in the background), we want to intentionally disconnect the ui in order to save resources.
67
67
  const isTriggering = lifecycle.triggerEvent.type === "alarmFiredEvent" && lifecycle._triggerEventFcid && lifecycle._triggerEventFcid === e.detail.fcid;
68
68
  if (isTriggering) {
69
69
  if (!this._moveToForegroundHasBeenCalled && window.cefQuery) {
70
- logger.log("Application is about to be terminated since didn't move to foreground");
71
- const message = { type: "terminating" };
70
+ logger.log("Application is about to be disconnected since didn't move to foreground");
71
+ const message = { type: "disconnect" };
72
72
  const request = { target: "TC", waitForResponse: false, message: JSON.stringify(message) };
73
73
  window.cefQuery({
74
74
  request: JSON.stringify(request),
75
75
  persistent: false,
76
76
  onSuccess: () => {
77
- logger.log("terminating request successfully sent");
77
+ logger.log("disconnect request successfully sent");
78
78
  },
79
79
  onFailure: (code, msg) => {
80
- logger.error(`terminating request failed: ${code} ${msg}`);
80
+ logger.error(`disconnect request failed: ${code} ${msg}`);
81
81
  }
82
82
  });
83
83
  }
@@ -192,7 +192,7 @@ class Lifecycle extends LifecycleInterface {
192
192
  // Use the event manager to dispatch the event and wait for all listeners
193
193
  await this._eventManager.dispatch("userdisconnected", event);
194
194
 
195
- this._sendTerminatingMessage();
195
+ this._sendDisconnectMessage();
196
196
  });
197
197
 
198
198
  typeof document !== "undefined" && document.addEventListener("keydown", () => {
@@ -313,7 +313,7 @@ class Lifecycle extends LifecycleInterface {
313
313
  this._inTransition = true;
314
314
  return new Promise((resolve, reject) => {
315
315
  const FCID = getFCID();
316
- const request = { target: "TC", waitForResponse: false, internalAction: "uiExit", message: JSON.stringify({ type: "uiStandbyRequest", fcid: FCID }) };
316
+ const request = { target: "TC", waitForResponse: false, internalAction: "uiExit", message: JSON.stringify({ type: "uiStandbyRequest", autoPlay: remotePlayer._autoPlay, fcid: FCID }) };
317
317
  const logger = sdkLogger.withFields({ FCID });
318
318
  logger.log("lifecycle moveToUiStandby: sending uiStandbyRequest");
319
319
  window.cefQuery({
@@ -555,6 +555,7 @@ class Lifecycle extends LifecycleInterface {
555
555
  message.class = "remotePlayer";
556
556
  message.switchMode = remotePlayer._isAudioSyncEnabled() ? SwitchMode.SEAMLESS : SwitchMode.NON_SEAMLESS;
557
557
  message.streamType = remotePlayer.textTrackVisibility ? (StreamType.AUDIO | StreamType.VIDEO | StreamType.SUBTITLE) : (StreamType.AUDIO | StreamType.VIDEO);
558
+ message.autoPlay = remotePlayer._autoPlay;
558
559
  request = {
559
560
  target: "TC",
560
561
  waitForResponse: true,
@@ -777,14 +778,14 @@ class Lifecycle extends LifecycleInterface {
777
778
  }
778
779
 
779
780
  /**
780
- * Sends the terminating message to the platform
781
+ * Sends the disconnect message to the platform
781
782
  * @private
782
783
  */
783
- _sendTerminatingMessage() {
784
+ _sendDisconnectMessage() {
784
785
  if (window.cefQuery) {
785
786
  const FCID = getFCID();
786
787
  const message = {
787
- type: "terminating",
788
+ type: "disconnect",
788
789
  fcid: FCID
789
790
  };
790
791
  const request = { target: "TC", waitForResponse: false, message: JSON.stringify(message) };
@@ -793,10 +794,10 @@ class Lifecycle extends LifecycleInterface {
793
794
  request: JSON.stringify(request),
794
795
  persistent: false,
795
796
  onSuccess: () => {
796
- sdkLogger.log("Terminating signal sent after userdisconnected event was processed");
797
+ sdkLogger.log("Disconnect signal sent after userdisconnected event was processed");
797
798
  },
798
799
  onFailure: (code, msg) => {
799
- sdkLogger.error(`Failed to send terminating signal: ${code} ${msg}`);
800
+ sdkLogger.error(`Failed to send disconnect signal: ${code} ${msg}`);
800
801
  }
801
802
  });
802
803
  }
@@ -180,6 +180,7 @@ class RemotePlayer extends RemotePlayerInterface {
180
180
  }
181
181
  }
182
182
  this._loadMode = playerState?.isLoaded ? this.LoadMode.LOADED : this.LoadMode.NOT_LOADED;
183
+ this._autoPlay = false;
183
184
 
184
185
  this._isPlaying = window?.sessionStorage?.getItem("senzaSdk_isPlaying") === "true";
185
186
 
@@ -922,7 +923,7 @@ class RemotePlayer extends RemotePlayerInterface {
922
923
  * @returns {Promise}
923
924
  * @throws {RemotePlayerError} error object contains code & msg
924
925
  */
925
- play() {
926
+ play(autoPlay = false) {
926
927
  if (!this._isInitialized) {
927
928
  throw new RemotePlayerError(6500, "Cannot call play() if remote player is not initialized");
928
929
  }
@@ -933,6 +934,7 @@ class RemotePlayer extends RemotePlayerInterface {
933
934
  }
934
935
 
935
936
  this._changePlayMode(true);
937
+ this._autoPlay = autoPlay;
936
938
 
937
939
  if (this._isSetAudioInProgress) {
938
940
  sdkLogger.info("application requesting play during setAudioLanguage");
@@ -16,7 +16,7 @@ export class DeviceManager extends EventTarget {
16
16
  * @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.
17
17
  */
18
18
  get deviceInfo() {
19
- sdkLogger.log("getDeviceInfo running locally, returning dummy info");
19
+ sdkLogger.log("get of deviceInfo running locally, returning dummy info");
20
20
  return {
21
21
  deviceId: "123456789",
22
22
  modelNumber: "ABC",
@@ -280,8 +280,8 @@ class RemotePlayer extends EventTarget {
280
280
  * @returns {Promise}
281
281
  * @throws {RemotePlayerError} error object contains code & msg
282
282
  */
283
- async play() {
284
- return noop("RemotePlayer.play");
283
+ async play(autoPlay = false) {
284
+ return noop("RemotePlayer.play", autoPlay);
285
285
  }
286
286
 
287
287
  /** Pauses the currently playing audio or video
@@ -1 +1 @@
1
- export const version = "4.3.6";
1
+ export const version = "4.4.1-daf0312.0";