senza-sdk 4.2.64-70c0747.0 → 4.2.65-90c49ac.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/dist/bundle.js +1 -1
- package/package.json +7 -15
- package/src/{implementation/alarmManager.js → alarmManager.js} +52 -15
- package/src/api.js +350 -183
- package/src/{implementation/deviceManager.js → deviceManager.js} +65 -4
- package/src/{implementation/lifecycle.js → lifecycle.js} +215 -28
- package/src/{implementation/messageManager.js → messageManager.js} +6 -6
- package/src/{implementation/platformManager.js → platformManager.js} +4 -5
- package/src/{implementation/remotePlayer.js → remotePlayer.js} +22 -18
- package/src/{implementation/senzaShakaPlayer.js → senzaShakaPlayer.js} +28 -18
- package/src/{implementation/utils.js → utils.js} +6 -15
- package/src/implementation/api.js +0 -367
- package/src/interface/alarmManager.js +0 -69
- package/src/interface/api.js +0 -8
- package/src/interface/deviceManager.js +0 -133
- package/src/interface/lifecycle.js +0 -278
- package/src/interface/messageManager.js +0 -46
- package/src/interface/platformManager.js +0 -35
- package/src/interface/remotePlayer.js +0 -441
- package/src/interface/senzaShakaPlayer.js +0 -171
- package/src/interface/utils.js +0 -45
- /package/src/{implementation/SessionInfo.js → SessionInfo.js} +0 -0
- /package/src/{implementation/devHelper.js → devHelper.js} +0 -0
- /package/src/{interface/devSequence.js → devSequence.js} +0 -0
- /package/src/{implementation/eventListenersManager.js → eventListenersManager.js} +0 -0
- /package/src/{implementation/subtitlesUtils.js → subtitlesUtils.js} +0 -0
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { noop } from "./utils";
|
|
2
|
-
/**
|
|
3
|
-
* @class AlarmManager
|
|
4
|
-
* AlarmManager is a singleton class that manages the alarms in the application. It fires events whose types are the names of the alarms.
|
|
5
|
-
* @fires MyAlarm
|
|
6
|
-
*/
|
|
7
|
-
export class AlarmManager extends EventTarget {
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* alarm event
|
|
11
|
-
*
|
|
12
|
-
* @event AlarmManager#MyAlarm
|
|
13
|
-
* @description Fired when time of 'MyAlarm' arrives. If this alarm triggers the application load and the application doesn't call
|
|
14
|
-
* lifecycle.moveToForeground() in the alarm callback (i.e. the application remains in the background after the callback is completed),
|
|
15
|
-
* the application will be unloaded.
|
|
16
|
-
* NOTE: If you perform async operations in the callback (without moving to foreground), you must wait for the async
|
|
17
|
-
* operation to finish before returning from the callback, otherwise the application will be unloaded before the async operation is finished.<br>
|
|
18
|
-
* @example
|
|
19
|
-
* alarmManager.addEventListener("MyAlarm", async (e) => {
|
|
20
|
-
* console.log("alarm MyAlarm arrived with data", e.detail);
|
|
21
|
-
* await fetch("http://www.example.com");
|
|
22
|
-
* });
|
|
23
|
-
* alarmManager.addAlarm("MyAlarm", Date.now() + 60*60*1000, "MyData");
|
|
24
|
-
*/
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
addEventListener(type, callback) {
|
|
30
|
-
noop("AlarmManager.addEventListener", type, callback);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
removeEventListener(type, callback) {
|
|
34
|
-
noop("AlarmManager.removeEventListener", type, callback);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Set alarm to be fired at the specified time, event when ui is released
|
|
38
|
-
* @param {string} alarmName unique name for the alarm
|
|
39
|
-
* @param {number} alarmTime target time for the alarm to be fired, represented by the number of milliseconds elapsed since the epoch
|
|
40
|
-
* @param {string} [data] data to be passed back when the alarm is fired
|
|
41
|
-
* */
|
|
42
|
-
addAlarm(alarmName, alarmTime, data = "", toleranceBefore = 0, toleranceAfter = 0) {
|
|
43
|
-
noop("AlarmManager.addAlarm", alarmName, alarmTime, data, toleranceBefore, toleranceAfter);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Delete the specified alarm
|
|
47
|
-
* @param {string} alarmName name of alarm to be deleted
|
|
48
|
-
*
|
|
49
|
-
* */
|
|
50
|
-
deleteAlarm(alarmName) {
|
|
51
|
-
noop("AlarmManager.deleteAlarm", alarmName);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Delete all alarms
|
|
55
|
-
*
|
|
56
|
-
* */
|
|
57
|
-
deleteAllAlarms() {
|
|
58
|
-
noop("AlarmManager.deleteAllAlarms");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Async function that asks for all active alarms
|
|
62
|
-
* @returns {Promise} when resolved, returns an array of objects containing alarmName and alarmTime fields
|
|
63
|
-
* @throws {string} error string in case of an error
|
|
64
|
-
*
|
|
65
|
-
* */
|
|
66
|
-
getActiveAlarms() {
|
|
67
|
-
return noop("AlarmManager.getActiveAlarms");
|
|
68
|
-
}
|
|
69
|
-
}
|
package/src/interface/api.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Lifecycle } from "./lifecycle.js";
|
|
2
|
-
export { DeviceManager } from "./deviceManager.js";
|
|
3
|
-
export { PlatformManager } from "./platformManager.js";
|
|
4
|
-
export { AlarmManager } from "./alarmManager.js";
|
|
5
|
-
export { MessageManager } from "./messageManager.js";
|
|
6
|
-
export { RemotePlayer } from "./remotePlayer.js";
|
|
7
|
-
export { SenzaShakaPlayer as ShakaPlayer, shaka } from "./senzaShakaPlayer.js";
|
|
8
|
-
export { showSequence, initSequence } from "./devSequence.js";
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { sdkLogger, noop } from "./utils.js";
|
|
2
|
-
|
|
3
|
-
const wifiInfo = {};
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @class DeviceManager
|
|
7
|
-
* DeviceManager is a singleton class that manages the device
|
|
8
|
-
*/
|
|
9
|
-
export class DeviceManager extends EventTarget {
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
wifiInfo.level = 0;
|
|
14
|
-
wifiInfo.quality = 0;
|
|
15
|
-
wifiInfo.ssid = "unknown";
|
|
16
|
-
wifiInfo.bssid = "unknown";
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Instead, call deviceManager.getWifiInfo() periodically
|
|
19
|
-
* @event DeviceManager#wifiInfoUpdated
|
|
20
|
-
* @example
|
|
21
|
-
* deviceManager.addEventListener("wifiInfoUpdated", () => {
|
|
22
|
-
* console.info("Wifi info has been updated to", deviceManager.wifiInfo);
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @property {object} DeviceInfo
|
|
30
|
-
* @property {string} DeviceInfo.deviceId
|
|
31
|
-
* @property {string} DeviceInfo.modelNumber
|
|
32
|
-
* @property {string} DeviceInfo.connectionId
|
|
33
|
-
* @property {string} DeviceInfo.community
|
|
34
|
-
* @property {string} DeviceInfo.tenant
|
|
35
|
-
* @property {string} DeviceInfo.clientIp
|
|
36
|
-
* @property {string} DeviceInfo.countryCode A 2-letter code as defined in ISO_3166-1
|
|
37
|
-
* @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.
|
|
38
|
-
*/
|
|
39
|
-
get deviceInfo() {
|
|
40
|
-
sdkLogger.log("getDeviceInfo running locally, returning dummy info");
|
|
41
|
-
return {
|
|
42
|
-
deviceId: "123456789",
|
|
43
|
-
modelNumber: "ABC",
|
|
44
|
-
connectionId: "dummy",
|
|
45
|
-
community: "LocalDev",
|
|
46
|
-
tenant: "XXXXXX",
|
|
47
|
-
clientIp: "0.0.0.0",
|
|
48
|
-
countryCode: "XX",
|
|
49
|
-
connectionType: "simulator"
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated use deviceManager.getWifiInfo() instead
|
|
56
|
-
* @property {object} WifiInfo
|
|
57
|
-
* @property {number} WifiInfo.level
|
|
58
|
-
* @property {number} WifiInfo.quality
|
|
59
|
-
* @property {string} WifiInfo.ssid
|
|
60
|
-
* @property {string} WifiInfo.bssid
|
|
61
|
-
*/
|
|
62
|
-
get wifiInfo() {
|
|
63
|
-
return wifiInfo;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Reboot the device
|
|
68
|
-
* @return {Promise} Promise which is resolved when the reboot command has been successfully processed.
|
|
69
|
-
* Failure to process the reboot command will result in the promise being rejected.
|
|
70
|
-
*/
|
|
71
|
-
reboot() {
|
|
72
|
-
return noop("DeviceManager.reboot");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Delete current wifi configuration and forget network
|
|
77
|
-
* @return {Promise} Promise which is resolved when the clearWifi command has been successfully processed.
|
|
78
|
-
* Failure to process the clearWifi command will result in the promise being rejected.
|
|
79
|
-
*/
|
|
80
|
-
clearWifi() {
|
|
81
|
-
return noop("DeviceManager.clearWifi");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Send raw data directly to a customer's device via the USB serial connection of a Senza device.
|
|
86
|
-
* This function is specifically designed for customers who have their devices connected to a Senza device.
|
|
87
|
-
* Using this API, these customers can transmit messages or data directly to their connected devices.
|
|
88
|
-
* The transmission occurs through the Senza device's USB serial interface, facilitating direct communication
|
|
89
|
-
* between the customer's web application and their device.
|
|
90
|
-
* @param {String} data raw data to be passed to the device
|
|
91
|
-
* @return {Promise} Promise which is resolved when the command has been successfully processed.
|
|
92
|
-
* Failure to process the command will result in the promise being rejected.
|
|
93
|
-
*/
|
|
94
|
-
sendDataToDevice(data) {
|
|
95
|
-
return noop("DeviceManager.sendDataToDevice", data);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Perform device factory reset.
|
|
100
|
-
* @param {Boolean} [reboot=true] a flag that is passed to the device to indicate whether it should reboot after the factory reset. defaults to true.
|
|
101
|
-
* @return {Promise} Promise which is resolved when factoryReset has been successfully performed
|
|
102
|
-
* Failure to factoryReset for any reason, result in the promise being rejected.
|
|
103
|
-
*/
|
|
104
|
-
async factoryReset(reboot = true) {
|
|
105
|
-
return noop("DeviceManager.factoryReset", reboot);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @typedef {Object} WiFiInfo
|
|
110
|
-
* @property {string} ssid the name of the Wi-Fi network that the device is connected to
|
|
111
|
-
* @property {string} bssid the unique identifier of the Wi-Fi access point
|
|
112
|
-
* @property {string} standard the Wi-Fi standard in use, such as 802.11a/b/g/n/ac/ax
|
|
113
|
-
* @property {string} security the type of security protocol used by the Wi-Fi network, such as WEP, WPA, WPA2, or WPA3
|
|
114
|
-
* @property {string} device-mac the MAC address of the device
|
|
115
|
-
* @property {string} device-ip4 the IPv4 address assigned to the device on the Wi-Fi network
|
|
116
|
-
* @property {string} dhcp-server the IP address of the DHCP server that assigned the device's network configuration
|
|
117
|
-
* @property {string[]} dns-server array of IP addresses of the DNS servers the device uses to resolve domain names
|
|
118
|
-
* @property {number} channel the number of the Wi-Fi channel currently being used
|
|
119
|
-
* @property {number} width width of the Wi-Fi channel in megahertz, e.g. 20MHz or 40 MHz channel
|
|
120
|
-
* @property {number} level a measure of the received signal strength, in the range 0 to 100 (the higher, the better). The level value is 100+RSSI (RSSI is the signal strength, measured in decibels)
|
|
121
|
-
* @property {number} quality a measure of the signal quality, in the range 0 to 100 (the higher, the better). The quality value is derived from the signal EVM.
|
|
122
|
-
* */
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Get Wi-Fi info - access point data and status (the status is cached for 5 seconds)
|
|
126
|
-
* @returns {WiFiInfo} An object containing the Wi-Fi info
|
|
127
|
-
* @alpha API has not yet been released
|
|
128
|
-
* */
|
|
129
|
-
// This api is part of epic HSDEV-4185
|
|
130
|
-
async getWifiInfo() {
|
|
131
|
-
return Promise.resolve({});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-empty-function */
|
|
2
|
-
/* eslint-disable no-unused-vars */
|
|
3
|
-
import {
|
|
4
|
-
sdkLogger,
|
|
5
|
-
noop
|
|
6
|
-
} from "./utils.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Lifecycle is a singleton class that manages the application lifecycle states.<br>
|
|
10
|
-
* @class Lifecycle
|
|
11
|
-
* @fires onstatechange
|
|
12
|
-
* @fires userinactivity
|
|
13
|
-
* @fires userdisconnected
|
|
14
|
-
*/
|
|
15
|
-
export class Lifecycle extends EventTarget {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {Object} ConnectReason - The reason the ui app has been loaded
|
|
19
|
-
* @property {string} UNKNOWN
|
|
20
|
-
* @property {string} INITIAL_CONNECTION - Indicates that ui app has been loaded for the first time
|
|
21
|
-
* @property {string} APPLICATION_RELOAD - Indicates that ui app has been reloaded (e.g. after HOME keypress)
|
|
22
|
-
* @property {string} UI_RELEASE - Indicates that ui app has been reloaded after ui release
|
|
23
|
-
* @property {string} UI_TERMINATION - Indicates that ui app has been reloaded due to ui termination
|
|
24
|
-
* @property {string} WEBRTC_ERROR - Indicates that ui app has been reloaded due to webrtc error
|
|
25
|
-
* @property {string} UI_WATCHDOG - Indicates that ui app has been reloaded due to ui watchdog not receiving ui frames
|
|
26
|
-
*/
|
|
27
|
-
ConnectReason = Object.freeze({
|
|
28
|
-
UNKNOWN: "unknown",
|
|
29
|
-
INITIAL_CONNECTION: "initial_connection",
|
|
30
|
-
APPLICATION_RELOAD: "reload_app",
|
|
31
|
-
UI_RELEASE: "ui_release",
|
|
32
|
-
UI_TERMINATION: "ui_termination",
|
|
33
|
-
WEBRTC_ERROR: "webrtc_error",
|
|
34
|
-
UI_WATCHDOG: "ui_watchdog"
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @typedef {Object} UiState - The ui lifecycle state
|
|
39
|
-
* @property {string} UNKNOWN - state is unknown at this time
|
|
40
|
-
* @property {string} FOREGROUND - ui is displayed
|
|
41
|
-
* @property {string} IN_TRANSITION_TO_FOREGROUND - ui is about to be displayed
|
|
42
|
-
* @property {string} BACKGROUND - remote player is playing (full screen playback is displayed)
|
|
43
|
-
* @property {string} IN_TRANSITION_TO_BACKGROUND - remote player is about to be playing
|
|
44
|
-
*/
|
|
45
|
-
UiState = Object.freeze({
|
|
46
|
-
UNKNOWN: "unknown",
|
|
47
|
-
FOREGROUND: "foreground",
|
|
48
|
-
IN_TRANSITION_TO_FOREGROUND: "inTransitionToForeground",
|
|
49
|
-
BACKGROUND: "background",
|
|
50
|
-
IN_TRANSITION_TO_BACKGROUND: "inTransitionToBackground"
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @event Lifecycle#onstatechange
|
|
55
|
-
* @description Fired after transition from one state to another.<br>
|
|
56
|
-
* The flow is: foreground --> inTransitionToBackground --> background --> inTransitionToForeground --> foreground
|
|
57
|
-
* @property {UiState} state - Indicates the new state.
|
|
58
|
-
* @example
|
|
59
|
-
* lifecycle.addEventListener("onstatechange", (e) => {
|
|
60
|
-
* console.log("new state is", e.state);
|
|
61
|
-
* });
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @event Lifecycle#userinactivity
|
|
66
|
-
* @description Fired after the ui has been inactive (i.e. no key presses) for a configurable number of seconds.<br>
|
|
67
|
-
* @property {number} timeout - the number of seconds after which the application will be unloaded.
|
|
68
|
-
* @example
|
|
69
|
-
* lifecycle.addEventListener("userinactivity", (e) => {
|
|
70
|
-
* console.log(`Application will be unloaded in ${e.timeout} seconds`);
|
|
71
|
-
* });
|
|
72
|
-
* @alpha API has not yet been released
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @event Lifecycle#userdisconnected
|
|
77
|
-
* @description Fired when the user session ends .
|
|
78
|
-
* This event is useful for cleaning up application state or saving data before the application closes. Event callback should return promise to ensure that the event is handled before the application is terminated
|
|
79
|
-
* @example
|
|
80
|
-
* lifecycle.addEventListener("userdisconnected", () => {
|
|
81
|
-
* console.log("User session ended, cleaning up application state");
|
|
82
|
-
* // Perform any necessary cleanup here
|
|
83
|
-
* });
|
|
84
|
-
*/
|
|
85
|
-
constructor() {
|
|
86
|
-
super();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Configure lifecycle settings
|
|
91
|
-
* @param {Object} config - Configuration object
|
|
92
|
-
* @param {Object} [config.autoBackground] - Auto background settings
|
|
93
|
-
* @param {boolean} [config.autoBackground.enabled] - Enable/disable auto background
|
|
94
|
-
* @param {Object} [config.autoBackground.timeout] - Timeout settings
|
|
95
|
-
* @param {number|false} [config.autoBackground.timeout.playing=30] - Timeout in seconds when video is playing, false to disable
|
|
96
|
-
* @param {number|false} [config.autoBackground.timeout.idle=false] - Timeout in seconds when in UI mode, false to disable
|
|
97
|
-
*/
|
|
98
|
-
configure(config) {
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Get the current configuration settings
|
|
103
|
-
* @returns {Object} The current configuration object
|
|
104
|
-
* @example
|
|
105
|
-
* const config = lifecycle.getConfiguration();
|
|
106
|
-
* console.log(config.autoBackground.enabled); // true/false
|
|
107
|
-
* console.log(config.autoBackground.timeout.playing); // 30
|
|
108
|
-
* console.log(config.autoBackground.timeout.idle); // false
|
|
109
|
-
*/
|
|
110
|
-
getConfiguration() {
|
|
111
|
-
return {
|
|
112
|
-
autoBackground: {
|
|
113
|
-
enabled: false,
|
|
114
|
-
timeout: {
|
|
115
|
-
playing: 0,
|
|
116
|
-
idle: 0
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Getter for returning the ui lifecycle state
|
|
124
|
-
* @returns {UiState} the current application lifecycle state
|
|
125
|
-
*/
|
|
126
|
-
get state() {
|
|
127
|
-
this._state = this.UiState.UNKNOWN;
|
|
128
|
-
return this._state;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Getter for returning the application connection reason
|
|
133
|
-
* @returns {ConnectReason} the application connection reason
|
|
134
|
-
*/
|
|
135
|
-
get connectReason() {
|
|
136
|
-
return this.ConnectReason.UNKNOWN;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Getter for returning the event that triggered the reloading of the ui after ui has been released
|
|
141
|
-
* @returns {Object} trigger event
|
|
142
|
-
* @property {string} type - the type of the trigger event (e.g. keyPressEvent, videoPlaybackEvent)
|
|
143
|
-
* @property {object} data - data of the event, dependent on its type (e.g. keyPressEvent has data of keyValue) */
|
|
144
|
-
get triggerEvent() {
|
|
145
|
-
return {};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @deprecated Use `lifecycle.configure()` instead.
|
|
150
|
-
* Controls the autoBackground feature.<br>
|
|
151
|
-
* When enabled, the application will automatically move to the background state after a configurable
|
|
152
|
-
* period of inactivity. Use the `configure` method to set timeouts for video playback and UI states.
|
|
153
|
-
* @type {boolean}
|
|
154
|
-
* @see {@link Lifecycle#configure}
|
|
155
|
-
*/
|
|
156
|
-
set autoBackground(enabled) {
|
|
157
|
-
noop("lifecycle.autoBackground", enabled);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
get autoBackground() {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated Use `lifecycle.configure()` instead.
|
|
166
|
-
* The number of seconds of user inactivity before the application moves to the background state while playing video.
|
|
167
|
-
* Use the `configure` method to set this timeout.
|
|
168
|
-
* @type {integer}
|
|
169
|
-
* @default 30
|
|
170
|
-
* @see {@link Lifecycle#configure}
|
|
171
|
-
*/
|
|
172
|
-
set autoBackgroundDelay(delay) {
|
|
173
|
-
noop("lifecycle.autoBackgroundDelay", delay);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
get autoBackgroundDelay() {
|
|
177
|
-
return 0;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* @deprecated Use `lifecycle.configure()` instead.
|
|
182
|
-
* The number of seconds of user inactivity before the application moves to the background state while in the UI (not playing).
|
|
183
|
-
* Use the `configure` method to set this timeout.
|
|
184
|
-
* @type {integer}
|
|
185
|
-
* @default -1
|
|
186
|
-
* @see {@link Lifecycle#configure}
|
|
187
|
-
*/
|
|
188
|
-
set autoBackgroundOnUIDelay(delay) {
|
|
189
|
-
noop("lifecycle.autoBackgroundOnUIDelay", delay);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
get autoBackgroundOnUIDelay() {
|
|
193
|
-
return 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @deprecated use lifecycle.state instead.
|
|
198
|
-
* Async function that returns the ui lifecycle state
|
|
199
|
-
* @returns {UiState} the current application lifecycle state
|
|
200
|
-
* @example
|
|
201
|
-
* try {
|
|
202
|
-
* const state = await lifecycle.getState();
|
|
203
|
-
* console.log("current state is", state);
|
|
204
|
-
* } catch (e) {
|
|
205
|
-
* console.error("getState failed", e);
|
|
206
|
-
* }
|
|
207
|
-
*/
|
|
208
|
-
getState() {
|
|
209
|
-
sdkLogger.warn("lifecycle getState is not supported if NOT running e2e");
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Once playback starts on the remote player,
|
|
214
|
-
* the application is moved from foreground to inTransitionToBackground and eventually to background.
|
|
215
|
-
* The application will need to call moveToForeground when it receives an event that needs the UI to be displayed again,
|
|
216
|
-
* for example a key press, a playback end-of-file or a playback error.
|
|
217
|
-
* @return {Promise} Promise which is resolved when the moveToForeground command has been successfully processed.
|
|
218
|
-
* Failure to process the moveToForeground command will result in the promise being rejected.
|
|
219
|
-
*/
|
|
220
|
-
moveToForeground() {
|
|
221
|
-
return noop("lifecycle.moveToForeground");
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* This method moves the application to the background.
|
|
226
|
-
* It should be called after remotePlayer.play().
|
|
227
|
-
* As a consequence, remote player playback will be displayed in full screen.
|
|
228
|
-
* @example
|
|
229
|
-
* remotePlayer.load("https://example.com/video.mp4", 0);
|
|
230
|
-
* remotePlayer.play();
|
|
231
|
-
* lifecycle.moveToBackground();
|
|
232
|
-
* @return {Promise} Promise which is resolved when the moveToBackground command has been successfully processed.
|
|
233
|
-
* Failure to process the moveToBackground command will result in the promise being rejected.
|
|
234
|
-
*/
|
|
235
|
-
moveToBackground() {
|
|
236
|
-
return noop("lifecycle.moveToBackground");
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Use this api to switch to another tenant (other than the home tenant) which will launch the application associated with the tenantId. The tenantId must be configured in the
|
|
241
|
-
* Senza platform. Switching to the home tenant should use the exitApplication().
|
|
242
|
-
* @param {string} tenantId The tenantId to switch
|
|
243
|
-
* @return {Promise} Promise which is resolved when the switchTenant command has been successfully processed.
|
|
244
|
-
* Failure to process the switchTenant command will result in the promise being rejected.
|
|
245
|
-
*/
|
|
246
|
-
switchTenant(tenantId) {
|
|
247
|
-
return noop("lifecycle.switchTenant", tenantId);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Use this api to exit the application which will redirect the browser to the home tenant application.
|
|
252
|
-
* @return {Promise} Promise which is resolved when the exitApplication command has been successfully processed.
|
|
253
|
-
* Failure to process the exitApplication command will result in the promise being rejected.
|
|
254
|
-
*/
|
|
255
|
-
exitApplication() {
|
|
256
|
-
return noop("lifecycle.exitApplication");
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Add event listener for lifecycle events
|
|
261
|
-
* @param {string} type - The event type to listen for
|
|
262
|
-
* @param {Function} listener - The callback function. Listeners for 'userdisconnected' events should return a promise to ensure the event is processed before the application exits.
|
|
263
|
-
* @param {Object} options - Event listener options
|
|
264
|
-
*/
|
|
265
|
-
addEventListener(type, listener, options) {
|
|
266
|
-
super.addEventListener(type, listener, options);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Remove event listener
|
|
271
|
-
* @param {string} type - The event type
|
|
272
|
-
* @param {Function} listener - The callback function to remove
|
|
273
|
-
* @param {Object} options - Event listener options
|
|
274
|
-
*/
|
|
275
|
-
removeEventListener(type, listener, options) {
|
|
276
|
-
super.removeEventListener(type, listener, options);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { noop } from "./utils";
|
|
3
|
-
/**
|
|
4
|
-
* MessageManager is a singleton class that manages the external messages received by the application. It fires custom events as "message" with the payload as the content
|
|
5
|
-
* @class MessageManager
|
|
6
|
-
* @fires MessageManager#message
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export class MessageManager extends EventTarget {
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {object} MessageDetails - object which contains the content of the message
|
|
13
|
-
* @property {string} eventName - The name of the event message, a property of MessageDetails
|
|
14
|
-
* @property {object} payload - The payload for this event, a property of MessageDetails
|
|
15
|
-
* @property {string} fcid - The flow context for this message, a property of MessageDetails
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* message event
|
|
20
|
-
*
|
|
21
|
-
* @event MessageManager#message
|
|
22
|
-
* @type {CustomEvent}
|
|
23
|
-
* @property {MessageDetails} detail - object containing data related to the event:
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* @description Fired when an external event arrives. This is a generic handler for all messages received for any registered group <br>
|
|
27
|
-
* @example
|
|
28
|
-
* messageManager.addEventListener("message", (e) => {
|
|
29
|
-
* console.log("message arrived with data", e.detail);
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
constructor() {
|
|
34
|
-
super();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Register to specific group(s). This function replaces the previously registered groups
|
|
38
|
-
* @param {Array<String>} groups group events to receive messages.
|
|
39
|
-
* @return {Promise} Promise which is resolved when the registerGroups command has been successfully processed.
|
|
40
|
-
* Failure to process the registerGroups command will result in the promise being rejected.
|
|
41
|
-
* messageManager.registerGroups(["A","B"]);
|
|
42
|
-
* */
|
|
43
|
-
async registerGroups(groups) {
|
|
44
|
-
return noop("MessageManager.registerGroups", groups);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { noop } from "./utils";
|
|
2
|
-
/**
|
|
3
|
-
* @class PlatformManager
|
|
4
|
-
* PlatformManager is a singleton class that manages the platform
|
|
5
|
-
*/
|
|
6
|
-
export class PlatformManager extends EventTarget {
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @returns {Object} appConfig object
|
|
14
|
-
* @property {String[]} territories - a list of territories configured for the tenant.
|
|
15
|
-
* if the list is undefined or empty - there are no restrictions.
|
|
16
|
-
* @example
|
|
17
|
-
* import { platformManager } from "senza-sdk";
|
|
18
|
-
* const appConfig = platformManager.appConfig
|
|
19
|
-
* */
|
|
20
|
-
get appConfig() {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {string} timezone the timezone to set to
|
|
27
|
-
* the format of the timezone is according to the standard TZ identifier
|
|
28
|
-
* (e.g. America/Los_Angeles, Asia/Tokyo, Europe/Brussels)
|
|
29
|
-
* for a full list of TZ identifiers, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
30
|
-
*/
|
|
31
|
-
setTimezone(timezone) {
|
|
32
|
-
noop("PlatformManager.setTimezone", timezone);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|