@signageos/front-applet 6.2.0 → 6.3.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/CHANGELOG.md +9 -0
- package/README.md +3 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/{js-api/js-applet-basics.md → applet-basics.md} +38 -99
- package/docs/{js-api → content}/js-applet-resources.md +10 -28
- package/docs/{js-api → content}/js-browser.md +24 -36
- package/docs/{js-api → content}/js-command.md +33 -91
- package/docs/{js-api/js-api-debug.md → content/js-debug.md} +2 -3
- package/docs/{js-api → content}/js-device-info.md +4 -5
- package/docs/{js-api → content}/js-display.md +18 -10
- package/docs/{js-api → content}/js-file-system.md +17 -30
- package/docs/{js-api/js-loading-fonts.md → content/js-fonts.md} +21 -44
- package/docs/{js-api → content}/js-hardware.md +6 -9
- package/docs/{js-api → content}/js-iframes.md +3 -3
- package/docs/{js-api → content}/js-input.md +2 -3
- package/docs/{js-api → content}/js-offline-cache-media-files.md +26 -83
- package/docs/{js-api → content}/js-offline-cache-simple-data.md +12 -17
- package/docs/{js-api → content}/js-osd.md +0 -2
- package/docs/{js-api → content}/js-proof-of-play.md +4 -6
- package/docs/{js-api → content}/js-sensors.md +3 -3
- package/docs/{js-api/js-hardware-serial.md → content/js-serial.md} +13 -18
- package/docs/{js-api → content}/js-sync-playback.md +30 -70
- package/docs/{js-api → content}/js-video-inputs-internal-ports.md +16 -34
- package/docs/{js-api → content}/js-video-stream.md +49 -85
- package/docs/{js-api → content}/js-video.md +25 -75
- package/docs/index.md +97 -0
- package/docs/{management-api/10-js-management-application.md → management/js-management-application.md} +16 -32
- package/docs/{management-api/7-js-management-volume.md → management/js-management-audio.md} +4 -6
- package/docs/{management-api/9-js-management-debug.md → management/js-management-debug.md} +5 -18
- package/docs/{management-api/2-js-management-firmware.md → management/js-management-firmware.md} +11 -25
- package/docs/{management-api/1-js-management.md → management/js-management-management.md} +67 -56
- package/docs/{js-api/js-monitoring-commands.md → management/js-management-monitoring-commands.md} +5 -6
- package/docs/{js-api/js-monitors.md → management/js-management-monitors.md} +9 -9
- package/docs/{management-api/11-js-management-network.md → management/js-management-network.md} +17 -43
- package/docs/{management-api/2-js-management-os.md → management/js-management-os.md} +2 -3
- package/docs/{management-api/8-js-management-package.md → management/js-management-package.md} +4 -6
- package/docs/{management-api/4-js-management-power.md → management/js-management-power.md} +10 -15
- package/docs/{management-api/14-js-management-proxy.md → management/js-management-proxy.md} +4 -6
- package/docs/{management-api/3-js-management-remote-control.md → management/js-management-remote-control.md} +5 -20
- package/docs/{management-api/5-js-management-screen.md → management/js-management-screen.md} +27 -81
- package/docs/{management-api/12-js-management-security.md → management/js-management-security.md} +6 -9
- package/docs/{management-api/6-js-management-time.md → management/js-management-time.md} +19 -26
- package/docs/{management-api/13-js-management-wifi.md → management/js-management-wifi.md} +38 -47
- package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +4 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js +1 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
- package/es6/FrontApplet/Input/IInput.d.ts +11 -0
- package/es6/FrontApplet/Input/IInput.js +3 -0
- package/es6/FrontApplet/Input/IInput.js.map +1 -0
- package/es6/FrontApplet/Input/Input.d.ts +5 -1
- package/es6/FrontApplet/Input/Input.js +6 -0
- package/es6/FrontApplet/Input/Input.js.map +1 -1
- package/package.json +7 -4
- package/docs/js-api/js-api-introduction.md +0 -91
|
@@ -11,12 +11,11 @@ tags:
|
|
|
11
11
|
description: "[Content JS API] You can use our Prooof of Play mechanism to log that some content was played on end device successfully or not. Our system includes important metadata about applet and device out-of-box to simplify solution of issues with content. You can use SignageOS to analyze, if, where, when and how long proposed content was playing in front of audience."
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
## All methods
|
|
15
|
+
|
|
16
16
|
| Methods | Description | Supported since |
|
|
17
17
|
| ----------- | ------------ | -----------|
|
|
18
18
|
| `recordItemPlayed()` | Log that content was played successfully | 5.5.1 |
|
|
19
|
-
:::
|
|
20
19
|
|
|
21
20
|
## recordItemPlayed()
|
|
22
21
|
|
|
@@ -24,11 +23,10 @@ Send provided information about played content along with additional metadata ab
|
|
|
24
23
|
|
|
25
24
|
### Parameters
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
| Param | Type | Required | Description |
|
|
29
28
|
| --------- | ------ | :------------------------: | -------------------------------------------------- |
|
|
30
|
-
| `options` | Object | <div class="red">Yes</div> | Object containing information about played content
|
|
31
|
-
:::
|
|
29
|
+
| `options` | Object | <div class="red">Yes</div> | Object containing information about played content
|
|
32
30
|
|
|
33
31
|
### Options
|
|
34
32
|
|
|
@@ -24,7 +24,7 @@ If every implementation implements the same set of interfaces, it's easy to swap
|
|
|
24
24
|
It also requires less code to be written to use various types of hardware.
|
|
25
25
|
If possible, you should always implement these interfaces.
|
|
26
26
|
|
|
27
|
-
:::
|
|
27
|
+
:::info
|
|
28
28
|
Right now, the list of interfaces is very short. We will be adding more types soon.
|
|
29
29
|
If there's any particular type of interfaces you'd like, kindly let us know.
|
|
30
30
|
:::
|
|
@@ -62,9 +62,9 @@ For more information read [this article](https://docs.signageos.io/hc/en-us/arti
|
|
|
62
62
|
|
|
63
63
|
Sometimes you might want to use hardware that we don't support out of the box yet.
|
|
64
64
|
|
|
65
|
-
Firstly, you will need to read the documentation for the [serial API](
|
|
65
|
+
Firstly, you will need to read the documentation for the [serial API](js-serial).
|
|
66
66
|
Most often, the hardware you will decide to use connects to the device via USB and internally uses a serial communication, like RS232.
|
|
67
67
|
In that case you will use the serial API.
|
|
68
68
|
|
|
69
|
-
You can approach this any way you like, but remember that you should always implement the [interfaces defined by us](
|
|
69
|
+
You can approach this any way you like, but remember that you should always implement the [interfaces defined by us](js-sensors#sensors-interfaces).
|
|
70
70
|
That will allow for greater code reusability and readability.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Serial
|
|
2
|
+
title: Serial Port
|
|
3
3
|
author: Michal Artazov
|
|
4
4
|
date: 25.9.2020
|
|
5
5
|
type: js-api
|
|
@@ -19,29 +19,27 @@ This can be leveraged to integrate a wide variety of hardware into your digital
|
|
|
19
19
|
|
|
20
20
|
Such hardware could be, for example, printers, payment terminals or sensors.
|
|
21
21
|
|
|
22
|
-
:::
|
|
22
|
+
:::warning
|
|
23
23
|
* Before using this API, ensure that the display supports serial via `sos.display.supports("SERIAL")`.
|
|
24
|
-
* More info [**HERE**](
|
|
24
|
+
* More info [**HERE**](js-display#supports).
|
|
25
25
|
* Samsung Kiosk serial connection only works over serial ports, not over USB ports
|
|
26
26
|
:::
|
|
27
27
|
|
|
28
28
|
## All methods
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
| Method | Description | Supported since |
|
|
32
32
|
| ------------------ | ---------------------- | :-------------: |
|
|
33
|
-
| `openSerialPort()` | Open a new serial port | 4.4.0
|
|
34
|
-
:::
|
|
33
|
+
| `openSerialPort()` | Open a new serial port | 4.4.0
|
|
35
34
|
|
|
36
35
|
## openSerialPort()
|
|
37
36
|
|
|
38
37
|
Creates a new instance of serial port. You can then use that instance to handle the communication.
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
|
|
41
40
|
| Param | Type | Required | Description |
|
|
42
41
|
| --------- | ------ | :------------------------: | -------------------------------------------------- |
|
|
43
|
-
| `options` | Object | <div class="red">Yes</div> | Object containing configuration of the serial port
|
|
44
|
-
:::
|
|
42
|
+
| `options` | Object | <div class="red">Yes</div> | Object containing configuration of the serial port
|
|
45
43
|
|
|
46
44
|
### Options
|
|
47
45
|
|
|
@@ -71,7 +69,7 @@ const serialPort = await sos.hardware.openSerialPort({
|
|
|
71
69
|
});
|
|
72
70
|
```
|
|
73
71
|
|
|
74
|
-
:::
|
|
72
|
+
:::info
|
|
75
73
|
Device address is different per platform (at least for now). Kindly find the respective device address:
|
|
76
74
|
|
|
77
75
|
| Device type | Default value | Other values for `device` |
|
|
@@ -80,21 +78,19 @@ Device address is different per platform (at least for now). Kindly find the res
|
|
|
80
78
|
| Windows | `COM3` | `COM3` (typically, but check your Win machine if this does not work) |
|
|
81
79
|
| Samsung Kiosk | `PORT1` |`PORT1`, `PORT2`, `PORT3` |
|
|
82
80
|
| Android | `/dev/ttyusb0` | `/dev/ttyusb0` |
|
|
83
|
-
| BrightSign | `0` | `0`, `1`, `USB:A/0`
|
|
84
|
-
:::
|
|
81
|
+
| BrightSign | `0` | `0`, `1`, `USB:A/0`
|
|
85
82
|
|
|
86
83
|
## Serial port methods
|
|
87
84
|
|
|
88
85
|
Once you create a serial port instance using `openSerialPort()` method listed above,
|
|
89
86
|
you can call following methods on it.
|
|
90
87
|
|
|
91
|
-
|
|
88
|
+
|
|
92
89
|
| Method | Description | Supported since |
|
|
93
90
|
| ---------- | ----------------------------------------------------------- | :-------------: |
|
|
94
91
|
| `onData()` | Call a listener callback anytime the opened serial port receiving data. | 4.4.0 |
|
|
95
92
|
| `write()` | Write data to the serial port | 4.4.0 |
|
|
96
|
-
| `close()` | Close serial port | 4.4.0
|
|
97
|
-
:::
|
|
93
|
+
| `close()` | Close serial port | 4.4.0
|
|
98
94
|
|
|
99
95
|
## onData()
|
|
100
96
|
|
|
@@ -148,12 +144,11 @@ await serialPort.close();
|
|
|
148
144
|
Following errors may occur when working with the serial ports. However they don't reflect on actual physical connectivity of the ports due to Samsung b2bapi does not register these events.
|
|
149
145
|
|
|
150
146
|
|
|
151
|
-
|
|
147
|
+
|
|
152
148
|
| Code | Type | Message |
|
|
153
149
|
| ----- | --------------------- | ----------------------------------------- |
|
|
154
150
|
| 50602 | InternalHardwareError | Failed to open serial port |
|
|
155
151
|
| 50603 | InternalHardwareError | Closing serial port that isn't open |
|
|
156
152
|
| 50603 | InternalHardwareError | Failed to close serial port |
|
|
157
153
|
| 50604 | InternalHardwareError | Writing to a serial port that isn't open |
|
|
158
|
-
| 50604 | InternalHardwareError | Failed to write to serial port
|
|
159
|
-
:::
|
|
154
|
+
| 50604 | InternalHardwareError | Failed to write to serial port
|
|
@@ -21,7 +21,6 @@ Sync API enables multiple devices to communicate and coordinate their behavior w
|
|
|
21
21
|
|
|
22
22
|
## All methods
|
|
23
23
|
|
|
24
|
-
::: table-responsive
|
|
25
24
|
| Methods/Events | Description | Supported since |
|
|
26
25
|
| ------------------ | ----------- | :---------------: |
|
|
27
26
|
| `connect()` | Connect to the sync server. | 1.0.32 |
|
|
@@ -35,63 +34,32 @@ Sync API enables multiple devices to communicate and coordinate their behavior w
|
|
|
35
34
|
| `onValue()` | Event called when device receives value broadcasted by another device in the network | 2.0.0 |
|
|
36
35
|
| `onStatus()` | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0 |
|
|
37
36
|
| `onClosed()` | Event called when synchronizer is closed | 5.12.0 |
|
|
38
|
-
:::
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<div>
|
|
45
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
46
|
-
<i class="fab fa-github svg-black"></i>
|
|
47
|
-
</div>
|
|
48
|
-
<div>
|
|
49
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Synchronized video through applets</h3>
|
|
50
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</a>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div class="row d-flex align-content-stretch force-padding-10">
|
|
58
|
-
<div class="col-12 d-flex">
|
|
59
|
-
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/sync-mixed-content">
|
|
60
|
-
<div>
|
|
61
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
62
|
-
<i class="fab fa-github svg-black"></i>
|
|
63
|
-
</div>
|
|
64
|
-
<div>
|
|
65
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Synchronization mixed content</h3>
|
|
66
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</a>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
38
|
+
:::note[GitHub Example]
|
|
39
|
+
- [Synchronized video through applets](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/sync-video)
|
|
40
|
+
- [Synchronization mixed content](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/sync-mixed-content)
|
|
41
|
+
:::
|
|
72
42
|
|
|
73
43
|
## connect()
|
|
74
44
|
Connect to the sync server. This initializes the connection and is mandatory to call, since synchronization is an optional feature and doesn’t get initialized by default to save resources and bandwidth. You can optionally specify a custom sync server URI in case you are running the sync server in a custom location.
|
|
75
45
|
|
|
76
46
|
### Parameters
|
|
77
|
-
|
|
47
|
+
|
|
78
48
|
| Param | Type | Required | Description |
|
|
79
49
|
| -------- | ------ | :--------------------------: | ----------------------------- |
|
|
80
50
|
| `engine` | String | <div class="yellow">No</div> | Synchronization engine to use |
|
|
81
|
-
| `uri` | String | <div class="yellow">No</div> | Address of sync server. Only relevant for `sync-server`. If omitted, the default server will be used.
|
|
82
|
-
:::
|
|
51
|
+
| `uri` | String | <div class="yellow">No</div> | Address of sync server. Only relevant for `sync-server`. If omitted, the default server will be used.
|
|
83
52
|
|
|
84
53
|
### Engine
|
|
85
54
|
|
|
86
|
-
|
|
55
|
+
|
|
87
56
|
| Engine | Description |
|
|
88
57
|
| ------------- | ---------------------------------------------------------------------------------------- |
|
|
89
58
|
| `sync-server` | (**Default**) Use external sync server. Device will connect to the server via websocket. |
|
|
90
59
|
| `p2p-local` | Synchronize directly with other devices in the local network via UDP and TCP. |
|
|
91
|
-
| `udp` | (**Deprecated - use p2p-local**) Synchronize directly with other devices in the local network via UDP.
|
|
92
|
-
:::
|
|
60
|
+
| `udp` | (**Deprecated - use p2p-local**) Synchronize directly with other devices in the local network via UDP.
|
|
93
61
|
|
|
94
|
-
:::
|
|
62
|
+
:::info
|
|
95
63
|
All devices, that should be synchronized together, must select the same engine.
|
|
96
64
|
Otherwise they won't be able to communicate with each other.
|
|
97
65
|
:::
|
|
@@ -147,19 +115,18 @@ await sos.sync.close().then(() => {
|
|
|
147
115
|
```
|
|
148
116
|
|
|
149
117
|
## init()
|
|
150
|
-
:::
|
|
118
|
+
:::warning
|
|
151
119
|
This method is deprecated and will be removed in the future. Use `joinGroup()` instead. These two methods function identically.
|
|
152
120
|
:::
|
|
153
121
|
|
|
154
122
|
Once the user is connected to the server, the initialization of the sync group is required. Before any communication takes place, all participating devices have to be connected and recognize one another. Recommended to call this method early.
|
|
155
123
|
|
|
156
124
|
### Parameters
|
|
157
|
-
|
|
125
|
+
|
|
158
126
|
| Param | Type | Required | Description |
|
|
159
127
|
| -------------- | ------- | :-----: | ---------------------------- |
|
|
160
128
|
| `groupName` | String | <div class="yellow">No</div> | By default, all devices will be synced together. To create Groups of devices, independent from each other, specify group name |
|
|
161
|
-
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
162
|
-
:::
|
|
129
|
+
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
163
130
|
|
|
164
131
|
### Javascript example
|
|
165
132
|
```javascript
|
|
@@ -170,12 +137,11 @@ await sos.sync.init('someRandomNameGroup', 'device1');
|
|
|
170
137
|
Once we're connected, we have to join a sync group. Before any communication takes place, all participating devices have to be connected and recognize one another. Recommended to call this method early.
|
|
171
138
|
|
|
172
139
|
### Parameters
|
|
173
|
-
|
|
140
|
+
|
|
174
141
|
| Param | Type | Required | Description |
|
|
175
142
|
| -------------- | ------- | :-----: | ---------------------------- |
|
|
176
143
|
| `groupName` | String | <div class="yellow">No</div> | By default, all devices will be synced together. To create Groups of devices, independent from each other, specify group name |
|
|
177
|
-
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
178
|
-
:::
|
|
144
|
+
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
179
145
|
|
|
180
146
|
### Javascript example
|
|
181
147
|
```javascript
|
|
@@ -193,13 +159,12 @@ This method returns a promise that resolves once all the devices meet and are re
|
|
|
193
159
|
Sometimes devices might go out of sync due to unpredictable conditions like loss of internet connection. To ensure re-sync of an out of sync device, you can pass some data as the first argument. This can be any data that informs the whole group about what content is about to play next. Once all devices are ready, data from the master device is passed to everyone and the rest of the data is ignored. Therefore, when implementing your applet you should rely on the result data and not the data that is passed to the wait method as an argument.
|
|
194
160
|
|
|
195
161
|
### Parameters
|
|
196
|
-
|
|
162
|
+
|
|
197
163
|
| Param | Type | Required | Description |
|
|
198
164
|
| -------------- | ------- | :-----: | ------- |
|
|
199
165
|
| `data` | Any | <div class="yellow">No</div> | Information about what content is about to play so all the devices display the same content. |
|
|
200
166
|
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed. |
|
|
201
|
-
| `timeout` | Number | <div class="yellow">No</div> | Wait timeout on other devices
|
|
202
|
-
:::
|
|
167
|
+
| `timeout` | Number | <div class="yellow">No</div> | Wait timeout on other devices
|
|
203
168
|
|
|
204
169
|
### Returns
|
|
205
170
|
Promise that resolves to data picked from the first argument of the master device
|
|
@@ -213,11 +178,10 @@ In order to gracefully cleanup any pending activity, use this method.
|
|
|
213
178
|
Any pending wait will be canceled and the promise will be rejected with an error.
|
|
214
179
|
|
|
215
180
|
### Parameters
|
|
216
|
-
|
|
181
|
+
|
|
217
182
|
| Param | Type | Required | Description |
|
|
218
183
|
| ----------- | ------- | :--------------------------: | ------------ |
|
|
219
|
-
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed.
|
|
220
|
-
:::
|
|
184
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed.
|
|
221
185
|
|
|
222
186
|
### Javascript example
|
|
223
187
|
```javascript
|
|
@@ -234,29 +198,27 @@ await sos.sync.cancelWait('someRandomNameGroup');
|
|
|
234
198
|
Another way to synchronize devices is to broadcast some values within the group so, in turn, all devices can react to it. Unlike option wait, this is more useful in use cases when the synchronization is based around the content itself, rather than timing.
|
|
235
199
|
|
|
236
200
|
### All Methods
|
|
237
|
-
|
|
201
|
+
|
|
238
202
|
| Method | Type | Description | Supported since |
|
|
239
203
|
| ------ | ------ | -------- | ------------- |
|
|
240
204
|
| `setValue()` | method | Used for broadcast values for all master devices | 2.0.0 |
|
|
241
205
|
| `onValue()` | event | Event called when device receive any value | 2.0.0 |
|
|
242
|
-
| `onStatus()` | event | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0
|
|
243
|
-
:::
|
|
206
|
+
| `onStatus()` | event | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0
|
|
244
207
|
|
|
245
208
|
## setValue()
|
|
246
|
-
:::
|
|
209
|
+
:::warning
|
|
247
210
|
This method is deprecated and will be removed in the future. Use `broadcastValue()` instead. These two methods function identically.
|
|
248
211
|
:::
|
|
249
212
|
|
|
250
213
|
This method can be called by any device to broadcast a value to the whole group.
|
|
251
214
|
|
|
252
215
|
### Parameters
|
|
253
|
-
|
|
216
|
+
|
|
254
217
|
| Param |Type | Required | Description |
|
|
255
218
|
| -------------- | --------- | :------: | ------------------- |
|
|
256
219
|
| `key` | String | <div class="red">Yes</div> | Values are recognized based their key so different types of values can be broadcasted independently within the group |
|
|
257
220
|
| `value` | Any | <div class="red">Yes</div> | The value to be broadcasted |
|
|
258
|
-
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
259
|
-
:::
|
|
221
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
260
222
|
|
|
261
223
|
### Javascript example
|
|
262
224
|
```javascript
|
|
@@ -267,13 +229,12 @@ await sos.sync.setValue('some-key', 'some-value', 'some-group');
|
|
|
267
229
|
This method can be called by any device to broadcast a value to the whole group.
|
|
268
230
|
|
|
269
231
|
### Parameters
|
|
270
|
-
|
|
232
|
+
|
|
271
233
|
| Param |Type | Required | Description |
|
|
272
234
|
| -------------- | --------- | :------: | ------------------- |
|
|
273
235
|
| `key` | String | <div class="red">Yes</div> | Values are recognized based their key so different types of values can be broadcasted independently within the group |
|
|
274
236
|
| `value` | Any | <div class="red">Yes</div> | The value to be broadcasted |
|
|
275
|
-
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
276
|
-
:::
|
|
237
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
277
238
|
|
|
278
239
|
### Javascript example
|
|
279
240
|
```javascript
|
|
@@ -294,7 +255,7 @@ await sos.sync.onValue((key, value, groupName) => {
|
|
|
294
255
|
});
|
|
295
256
|
```
|
|
296
257
|
|
|
297
|
-
<br
|
|
258
|
+
<br/>
|
|
298
259
|
|
|
299
260
|
## Event onStatus()
|
|
300
261
|
Is used for receiving information about connected device to sync server. Emitted every 30s, or when device connect or disconnect from server.
|
|
@@ -307,9 +268,9 @@ await sos.sync.onStatus((connectedPeers) => {
|
|
|
307
268
|
});
|
|
308
269
|
```
|
|
309
270
|
|
|
310
|
-
<br
|
|
271
|
+
<br/>
|
|
311
272
|
|
|
312
|
-
:::
|
|
273
|
+
:::info
|
|
313
274
|
Since you never know which device is the master at the moment, you should always rely only on the values received by the listener, not the values that the particular device itself is broadcasting.
|
|
314
275
|
:::
|
|
315
276
|
|
|
@@ -371,12 +332,11 @@ onClosed(listener: (
|
|
|
371
332
|
## Errors
|
|
372
333
|
Although we are doing our best, following errors may occur when working with the synchronizer.
|
|
373
334
|
|
|
374
|
-
|
|
335
|
+
|
|
375
336
|
| Code | Type | Message |
|
|
376
337
|
| ---- | ---- | ------- |
|
|
377
338
|
| 51101 | InternalSynchronizerError | Synchronizer couldn't connect to the server. |
|
|
378
339
|
| 51102 | InternalSynchronizerError | The connection wasn't closed correctly. |
|
|
379
340
|
| 51103 | InternalSynchronizerError | The group initialization failed. |
|
|
380
341
|
| 51104 | InternalSynchronizerError | Wait failed for unexpected reason. |
|
|
381
|
-
| 51105 | InternalSynchronizerError | Synchronizer couldn't set the value.
|
|
382
|
-
:::
|
|
342
|
+
| 51105 | InternalSynchronizerError | Synchronizer couldn't set the value.
|
|
@@ -15,60 +15,45 @@ description: "[Content JS API] Display content from another device over HDMI, Di
|
|
|
15
15
|
Display content from another device over HDMI, Display Port, or other port. PIP (Picture in Picture) functionality allows you to display content from the internal port while keeping signageOS on.
|
|
16
16
|
|
|
17
17
|
## All methods
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
| Methods | Description | Supported since |
|
|
20
20
|
| ----------------- | ----------- | :---------------: |
|
|
21
21
|
| `play()` | Method for starting stream | 1.0.18 |
|
|
22
22
|
| `stop()` | Method stops using the internal port. | 1.0.18 |
|
|
23
|
-
:::
|
|
24
23
|
|
|
25
24
|
## play()
|
|
26
|
-
Method uses the same API as [video streams](
|
|
25
|
+
Method uses the same API as [video streams](js-video-stream). Instead of URL (for stream), **specify an URI of the port** to display.
|
|
27
26
|
|
|
28
27
|
### Parameters
|
|
29
|
-
|
|
28
|
+
|
|
30
29
|
| Param | Type | Required |Description |
|
|
31
30
|
| -------------- | -------------------| :----------: | ---------------------------- |
|
|
32
31
|
| `uri` | String | <div class="red">Yes</div> | Internal port URI |
|
|
33
32
|
| `x` | Number | <div class="red">Yes</div> | x-position for video on screen |
|
|
34
33
|
| `y` | Number | <div class="red">Yes</div> | y-position for video on screen |
|
|
35
34
|
| `width` | Number | <div class="red">Yes</div> | Video width on screen |
|
|
36
|
-
| `height` | Number | <div class="red">Yes</div> | Video height on screen
|
|
37
|
-
:::
|
|
35
|
+
| `height` | Number | <div class="red">Yes</div> | Video height on screen
|
|
38
36
|
|
|
39
37
|
### Javascript example
|
|
40
38
|
```javascript
|
|
41
39
|
await sos.stream.play(uri, x, y, width, height);
|
|
42
40
|
```
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<div>
|
|
48
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
49
|
-
<i class="fab fa-github svg-black"></i>
|
|
50
|
-
</div>
|
|
51
|
-
<div>
|
|
52
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Stream HDMI port Applet example</h3>
|
|
53
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</a>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
42
|
+
:::note[GitHub Example]
|
|
43
|
+
[Stream HDMI port Applet example](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/stream-hdmi-port)
|
|
44
|
+
:::
|
|
59
45
|
|
|
60
46
|
## Valid URI values
|
|
61
47
|
|
|
62
|
-
|
|
48
|
+
|
|
63
49
|
| Value | Description |
|
|
64
50
|
| ----------------------- | ------------------------------- |
|
|
65
51
|
| `internal://hdmi<number>` | HDMI |
|
|
66
52
|
| `internal://dp` | DisplayPort |
|
|
67
53
|
| `internal://dvi` | DVI |
|
|
68
|
-
| `internal://pc` | PC or VGA
|
|
69
|
-
:::
|
|
54
|
+
| `internal://pc` | PC or VGA
|
|
70
55
|
|
|
71
|
-
:::
|
|
56
|
+
:::warning
|
|
72
57
|
`<number>` has to be a value between 1 - 4, depending on which of the available HDMI ports you want to use.
|
|
73
58
|
:::
|
|
74
59
|
|
|
@@ -76,15 +61,14 @@ await sos.stream.play(uri, x, y, width, height);
|
|
|
76
61
|
Method stops using the internal port.
|
|
77
62
|
|
|
78
63
|
### Parameters:
|
|
79
|
-
|
|
64
|
+
|
|
80
65
|
| Param | Type | Required |Description |
|
|
81
66
|
| -------------- | -----------------| :------------: | ---------------------------- |
|
|
82
67
|
| `uri` | String | <div class="red">Yes</div> | Internal port URI |
|
|
83
68
|
| `x` | Number | <div class="red">Yes</div> | x-position for video on screen |
|
|
84
69
|
| `y` | Number | <div class="red">Yes</div> | y-position for video on screen |
|
|
85
70
|
| `width` | Number | <div class="red">Yes</div> | Video width on screen |
|
|
86
|
-
| `height` | Number | <div class="red">Yes</div> | Video height on screen
|
|
87
|
-
:::
|
|
71
|
+
| `height` | Number | <div class="red">Yes</div> | Video height on screen
|
|
88
72
|
|
|
89
73
|
### Javascript example
|
|
90
74
|
```javascript
|
|
@@ -94,13 +78,12 @@ await sos.stream.stop(uri, x, y, width, height);
|
|
|
94
78
|
## Internal port events
|
|
95
79
|
API reacts to events related to changes in internal port status. Events are only emitted for a currently playing internal port.
|
|
96
80
|
|
|
97
|
-
|
|
81
|
+
|
|
98
82
|
| Event | Description |
|
|
99
83
|
| ----------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
100
84
|
| `disconnected()` | Emmited when the port is disconnected or does not receive any signal |
|
|
101
85
|
| `connected()` | Emmited when the port is re-connected or starts receiving signal again after being disconnected |
|
|
102
|
-
| `error()` | Emmited when an error occurs, is emmited only once
|
|
103
|
-
:::
|
|
86
|
+
| `error()` | Emmited when an error occurs, is emmited only once
|
|
104
87
|
|
|
105
88
|
## Usage with Typescript
|
|
106
89
|
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
@@ -141,9 +124,8 @@ onError(listener: (event: {
|
|
|
141
124
|
## Errors
|
|
142
125
|
Although we are doing our best, following errors may occur when playing content from the internal ports.
|
|
143
126
|
|
|
144
|
-
|
|
127
|
+
|
|
145
128
|
| Code | Type | Message |
|
|
146
129
|
| ---- | ---- | ------- |
|
|
147
130
|
| 51501 | InternalVideoError | Couldn't play the video. |
|
|
148
|
-
| 51503 | InternalVideoError | Couldn't stop the video.
|
|
149
|
-
:::
|
|
131
|
+
| 51503 | InternalVideoError | Couldn't stop the video.
|