@signageos/front-applet 5.0.0-beta.7 → 5.0.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 +78 -1
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -1
- package/docs/js-api/js-api-introduction.md +16 -12
- package/docs/js-api/js-applet-basics.md +162 -1
- package/docs/js-api/js-browser.md +35 -7
- package/docs/js-api/js-command.md +61 -21
- package/docs/js-api/js-display.md +48 -0
- package/docs/js-api/js-file-system.md +106 -7
- package/docs/js-api/js-hardware-serial.md +2 -2
- package/docs/js-api/js-input.md +27 -2
- package/docs/js-api/js-offline-cache-media-files.md +19 -7
- package/docs/js-api/js-video-stream.md +66 -24
- package/docs/management-api/10-js-management-application.md +18 -1
- package/docs/management-api/11-js-management-network.md +122 -3
- package/docs/management-api/13-js-management-wifi.md +4 -0
- package/docs/management-api/2-js-management-firmware.md +21 -0
- package/docs/management-api/5-js-management-screen.md +8 -4
- package/docs/management-api/6-js-management-time.md +17 -1
- package/es6/FrontApplet/Browser/Browser.d.ts +16 -6
- package/es6/FrontApplet/Browser/Browser.js +39 -12
- package/es6/FrontApplet/Browser/Browser.js.map +1 -1
- package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +8 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js +4 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
- package/es6/FrontApplet/Browser/events.d.ts +15 -0
- package/es6/FrontApplet/Browser/events.js +14 -0
- package/es6/FrontApplet/Browser/events.js.map +1 -0
- package/es6/FrontApplet/Browser/messages.d.ts +5 -0
- package/es6/FrontApplet/Browser/messages.js +3 -0
- package/es6/FrontApplet/Browser/messages.js.map +1 -0
- package/es6/FrontApplet/Debug/Debug.d.ts +22 -0
- package/es6/FrontApplet/Debug/Debug.js +35 -0
- package/es6/FrontApplet/Debug/Debug.js.map +1 -0
- package/es6/FrontApplet/Exchange/Exchange.d.ts +7 -0
- package/es6/FrontApplet/Exchange/Exchange.js +28 -0
- package/es6/FrontApplet/Exchange/Exchange.js.map +1 -0
- package/es6/FrontApplet/FileSystem/FileSystem.d.ts +1 -0
- package/es6/FrontApplet/FileSystem/FileSystem.js +10 -0
- package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
- package/es6/FrontApplet/FrontApplet.d.ts +4 -2
- package/es6/FrontApplet/FrontApplet.js +20 -7
- package/es6/FrontApplet/FrontApplet.js.map +1 -1
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.d.ts +30 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js +92 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js.map +1 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.d.ts +5 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.js +3 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.js.map +1 -0
- package/es6/FrontApplet/Hardware/Hardware.d.ts +4 -1
- package/es6/FrontApplet/Hardware/Hardware.js +3 -0
- package/es6/FrontApplet/Hardware/Hardware.js.map +1 -1
- package/es6/FrontApplet/Management/Firmware.d.ts +2 -0
- package/es6/FrontApplet/Management/Firmware.js +8 -0
- package/es6/FrontApplet/Management/Firmware.js.map +1 -1
- package/es6/FrontApplet/Management/FirmwareType.d.ts +4 -0
- package/es6/FrontApplet/Management/FirmwareType.js +8 -0
- package/es6/FrontApplet/Management/FirmwareType.js.map +1 -0
- package/es6/FrontApplet/Management/INetworkInfo.d.ts +26 -2
- package/es6/FrontApplet/Management/INetworkInfo.js +7 -1
- package/es6/FrontApplet/Management/INetworkInfo.js.map +1 -1
- package/es6/FrontApplet/Management/Network.d.ts +18 -2
- package/es6/FrontApplet/Management/Network.js +51 -9
- package/es6/FrontApplet/Management/Network.js.map +1 -1
- package/es6/FrontApplet/Management/Time.d.ts +18 -0
- package/es6/FrontApplet/Management/Time.js +16 -4
- package/es6/FrontApplet/Management/Time.js.map +1 -1
- package/es6/FrontApplet/Management/Wifi.d.ts +13 -1
- package/es6/FrontApplet/Management/Wifi.js +12 -1
- package/es6/FrontApplet/Management/Wifi.js.map +1 -1
- package/es6/FrontApplet/Management/helpers/SecurityHelper.js +1 -1
- package/es6/FrontApplet/Stream/Stream.d.ts +1 -0
- package/es6/FrontApplet/Stream/Stream.js +7 -0
- package/es6/FrontApplet/Stream/Stream.js.map +1 -1
- package/es6/FrontApplet/Validate/Validate.js +1 -1
- package/es6/FrontApplet/Validate/Validate.js.map +1 -1
- package/es6/Monitoring/Montoring.js +1 -1
- package/es6/Monitoring/Montoring.js.map +1 -1
- package/package.json +6 -33
- package/docs/js-api/js-timing.md +0 -54
|
@@ -69,10 +69,12 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
69
69
|
| `isDirectory()` | Returns true if existing path is directory | 2.1.0 |
|
|
70
70
|
| `copyFile()` | Copy file or directory to a new location | 3.3.0 |
|
|
71
71
|
| `writeFile()` | Write string to a file | 3.2.0 |
|
|
72
|
+
| `appendFile()` | Write string to a file | 4.13.0 |
|
|
72
73
|
| `readFile()` | Read a text file | 3.3.0 |
|
|
73
74
|
:::
|
|
74
75
|
|
|
75
76
|
## listStorageUnits()
|
|
77
|
+
|
|
76
78
|
Return list of storage units /internal, external/ from the device. Capacity values are in bytes.
|
|
77
79
|
|
|
78
80
|
::: alert alert--info
|
|
@@ -85,6 +87,7 @@ This is a mandatory method that is required for all the other File System APIs.
|
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
### Javascript Example
|
|
90
|
+
|
|
88
91
|
```javascript
|
|
89
92
|
// Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
|
|
90
93
|
const storageUnits = await sos.fileSystem.listStorageUnits();
|
|
@@ -94,6 +97,7 @@ const internalStorageUnit = storageUnits.find((storageUnit) => !storageUnit.remo
|
|
|
94
97
|
|
|
95
98
|
console.log(storageUnits);
|
|
96
99
|
```
|
|
100
|
+
|
|
97
101
|
### Returns
|
|
98
102
|
|
|
99
103
|
```json
|
|
@@ -115,14 +119,15 @@ console.log(storageUnits);
|
|
|
115
119
|
]
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
|
|
119
122
|
## listFiles()
|
|
123
|
+
|
|
120
124
|
List files and folders located in the internal/external storage.
|
|
121
125
|
* SUCCESS: Return list of files of existing directory
|
|
122
126
|
* FAIL: When listing not existing directory
|
|
123
127
|
* FAIL: When listing existing file (not a directory)
|
|
124
128
|
|
|
125
129
|
### Javascript Example
|
|
130
|
+
|
|
126
131
|
```javascript
|
|
127
132
|
// Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
|
|
128
133
|
const storageUnits = await sos.fileSystem.listStorageUnits();
|
|
@@ -203,16 +208,19 @@ console.log(testDirDirectoryFilePaths);
|
|
|
203
208
|
```
|
|
204
209
|
|
|
205
210
|
## getFile()
|
|
211
|
+
|
|
206
212
|
Return a file from an internal storage
|
|
207
213
|
* OK: Returns local uri of existing file
|
|
208
214
|
* OK: Returns NULL of not existing file
|
|
209
215
|
|
|
210
216
|
### Parameters
|
|
217
|
+
|
|
211
218
|
| Param | Type | Required | Description |
|
|
212
219
|
| -------------- | ------ | :-------: | ----- |
|
|
213
220
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
214
221
|
|
|
215
222
|
### Javascript Example
|
|
223
|
+
|
|
216
224
|
```javascript
|
|
217
225
|
// always pass storageUnit to tell the JS API where to look
|
|
218
226
|
// get properties of file (at least localUri) or null when not exist
|
|
@@ -243,6 +251,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
|
|
|
243
251
|
```
|
|
244
252
|
|
|
245
253
|
## exists()
|
|
254
|
+
|
|
246
255
|
* OK: Returns true of existing directory or file
|
|
247
256
|
* OK: Returns false of not existing directory nor file
|
|
248
257
|
|
|
@@ -253,6 +262,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
|
|
|
253
262
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
254
263
|
|
|
255
264
|
### Javascript Example
|
|
265
|
+
|
|
256
266
|
```javascript
|
|
257
267
|
// always pass storageUnit to tell the JS API where to look
|
|
258
268
|
// check if there is such a file
|
|
@@ -262,9 +272,11 @@ console.log(fileExists);
|
|
|
262
272
|
```
|
|
263
273
|
|
|
264
274
|
### Returns
|
|
275
|
+
|
|
265
276
|
Boolean value
|
|
266
277
|
|
|
267
278
|
## downloadFile()
|
|
279
|
+
|
|
268
280
|
Download file to path within existing directory or **overrides existing file** in a path when successfully downloaded
|
|
269
281
|
|
|
270
282
|
* OK: Download file to path within existing directory
|
|
@@ -285,6 +297,7 @@ Download file to path within existing directory or **overrides existing file** i
|
|
|
285
297
|
:::
|
|
286
298
|
|
|
287
299
|
### Javascript Example
|
|
300
|
+
|
|
288
301
|
```javascript
|
|
289
302
|
// You can download file to specific existing directory
|
|
290
303
|
await sos.fileSystem.downloadFile(
|
|
@@ -294,7 +307,39 @@ await sos.fileSystem.downloadFile(
|
|
|
294
307
|
);
|
|
295
308
|
```
|
|
296
309
|
|
|
310
|
+
#### Encoding
|
|
311
|
+
|
|
312
|
+
All downloads respect a standard of `Encoding` with optional compression of files. See [Mozilla standard Accept Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) and [Content Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding).
|
|
313
|
+
|
|
314
|
+
Download file method is always sending optional following headers:
|
|
315
|
+
```
|
|
316
|
+
Accept-Encoding: gzip
|
|
317
|
+
Accept-Encoding: compress
|
|
318
|
+
Accept-Encoding: deflate
|
|
319
|
+
Accept-Encoding: br
|
|
320
|
+
Accept-Encoding: identity
|
|
321
|
+
Accept-Encoding: *
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
If the server understands the `Encoding` standard, it compresses files using `gzip` algorithm before the files are sent to the client. If so, the response will contain the following headers:
|
|
325
|
+
```
|
|
326
|
+
Content-Encoding: gzip
|
|
327
|
+
Content-Encoding: compress
|
|
328
|
+
Content-Encoding: deflate
|
|
329
|
+
Content-Encoding: br
|
|
330
|
+
```
|
|
331
|
+
So the data communication is compressed under the hood. The client will automatically decompress data before it's saved to a specified location path. So from JS API point of view, there is no requirement to decompress data by itself.
|
|
332
|
+
|
|
333
|
+
The standard is supported on all following platforms:
|
|
334
|
+
|
|
335
|
+
- WebOS 3+
|
|
336
|
+
- Tizen 2.4+
|
|
337
|
+
- Brightsign
|
|
338
|
+
- Raspberry Pi
|
|
339
|
+
- Windows
|
|
340
|
+
|
|
297
341
|
## deleteFile()
|
|
342
|
+
|
|
298
343
|
Delete a file or directory from the path.
|
|
299
344
|
|
|
300
345
|
* OK: (not recursive) Deletes an existing file or existing empty directory
|
|
@@ -310,6 +355,7 @@ Delete a file or directory from the path.
|
|
|
310
355
|
| `recursive`| boolean | <div class="yellow">No</div> | `TRUE` for recursive delete of all content from a directory |
|
|
311
356
|
|
|
312
357
|
### Javascript Example
|
|
358
|
+
|
|
313
359
|
```javascript
|
|
314
360
|
// Delete directory and all files inside
|
|
315
361
|
//// First check, if there is such a directory
|
|
@@ -327,7 +373,9 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
|
|
|
327
373
|
```
|
|
328
374
|
|
|
329
375
|
## moveFile()
|
|
376
|
+
|
|
330
377
|
Move file OR directory to destination path or Move directory to destination path.
|
|
378
|
+
|
|
331
379
|
* OK: Move file to destination path
|
|
332
380
|
* OK: Move directory to destination path
|
|
333
381
|
* FAIL: When destination path exists (is file or directory)
|
|
@@ -341,6 +389,7 @@ Move file OR directory to destination path or Move directory to destination path
|
|
|
341
389
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
342
390
|
|
|
343
391
|
### Javascript Example
|
|
392
|
+
|
|
344
393
|
```javascript
|
|
345
394
|
// Move file to a different directory
|
|
346
395
|
//// First check, if there is such a file and directory
|
|
@@ -356,6 +405,7 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
|
|
|
356
405
|
```
|
|
357
406
|
|
|
358
407
|
## getFileChecksum()
|
|
408
|
+
|
|
359
409
|
Returns checksum of existing file in a path.
|
|
360
410
|
* OK: Returns checksum of existing file in path
|
|
361
411
|
* FAIL: When file path doesn't exist
|
|
@@ -373,17 +423,20 @@ Does not work on Samsung Tizen display - [read more here](knowledge-base/md5-tiz
|
|
|
373
423
|
| `hashFunction` | string | <div class="red">Yes</div> | Available function is `md5` |
|
|
374
424
|
|
|
375
425
|
### Javascript Example
|
|
426
|
+
|
|
376
427
|
```javascript
|
|
377
428
|
const md5Checksum = await sos.fileSystem.getFileChecksum({ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt.backup' }, 'md5');
|
|
378
429
|
console.log(md5Checksum);
|
|
379
430
|
```
|
|
380
431
|
|
|
381
432
|
### Returns
|
|
433
|
+
|
|
382
434
|
```json
|
|
383
435
|
"b3c6930b9306b8e35a978d342cf5a01e" // string
|
|
384
436
|
```
|
|
385
437
|
|
|
386
438
|
## extractFile()
|
|
439
|
+
|
|
387
440
|
Extract ZIPed all files (recursively) to destination path and override existing files or merge existing directories.
|
|
388
441
|
|
|
389
442
|
* OK: Extract ZIPed all files (recursively) to destination path
|
|
@@ -405,6 +458,7 @@ The directory/folder you are extracting your ZIP file into has to be created BEF
|
|
|
405
458
|
| `archiveMethod` | string | <div class="red">Yes</div> | Available method is `zip` |
|
|
406
459
|
|
|
407
460
|
### Javascript Example
|
|
461
|
+
|
|
408
462
|
```javascript
|
|
409
463
|
// Create directory 'test-dir' in a root directory
|
|
410
464
|
await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
@@ -418,6 +472,7 @@ await sos.fileSystem.extractFile(
|
|
|
418
472
|
```
|
|
419
473
|
|
|
420
474
|
## createDirectory()
|
|
475
|
+
|
|
421
476
|
Creates a directory in a path.
|
|
422
477
|
|
|
423
478
|
* OK: Creates directory in path
|
|
@@ -425,7 +480,8 @@ Creates a directory in a path.
|
|
|
425
480
|
* FAIL: When creating directory in not existing containing (parent) directory
|
|
426
481
|
|
|
427
482
|
::: alert alert--warning
|
|
428
|
-
Never start OR end the `filePath` with a slash - `/`. It will cause error *50512*
|
|
483
|
+
- Never start OR end the `filePath` with a slash - `/`. It will cause error *50512*
|
|
484
|
+
- It is a good practice to check if directory exists - `isDirectory()` prior creating it
|
|
429
485
|
:::
|
|
430
486
|
|
|
431
487
|
### Parameters
|
|
@@ -435,12 +491,30 @@ Never start OR end the `filePath` with a slash - `/`. It will cause error *50512
|
|
|
435
491
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
436
492
|
|
|
437
493
|
### Javascript Example
|
|
494
|
+
|
|
438
495
|
```javascript
|
|
439
496
|
// Create directory 'test-dir' in a root directory
|
|
440
497
|
await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
441
498
|
```
|
|
442
499
|
|
|
500
|
+
```javascript
|
|
501
|
+
// Create multiple directories
|
|
502
|
+
const myDirs = [
|
|
503
|
+
'dir1',
|
|
504
|
+
'dir2',
|
|
505
|
+
'dir1/dir3',
|
|
506
|
+
];
|
|
507
|
+
await Promise.all(myDirs.map(async (dirname) => {
|
|
508
|
+
const fp = { storageUnit: internalStorageUnit, filePath: `uploads/${dirname}` };
|
|
509
|
+
if (!await sos.fileSystem.exists(fp)) {
|
|
510
|
+
await sos.fileSystem.createDirectory(fp);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
// All dirs created
|
|
514
|
+
```
|
|
515
|
+
|
|
443
516
|
## isDirectory()
|
|
517
|
+
|
|
444
518
|
Returns true if existing path is directory.
|
|
445
519
|
|
|
446
520
|
* OK: Returns true if existing path is directory
|
|
@@ -454,11 +528,13 @@ Returns true if existing path is directory.
|
|
|
454
528
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
455
529
|
|
|
456
530
|
### Javascript Example
|
|
531
|
+
|
|
457
532
|
```javascript
|
|
458
533
|
await sos.fileSystem.isDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
459
534
|
```
|
|
460
535
|
|
|
461
536
|
## copyFile()
|
|
537
|
+
|
|
462
538
|
Copy file OR directory to a new location.
|
|
463
539
|
|
|
464
540
|
### Parameters
|
|
@@ -469,6 +545,7 @@ Copy file OR directory to a new location.
|
|
|
469
545
|
| `destinationFilePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
470
546
|
|
|
471
547
|
### Javascript Example
|
|
548
|
+
|
|
472
549
|
```javascript
|
|
473
550
|
await sos.fileSystem.copyFile(
|
|
474
551
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt' },
|
|
@@ -477,16 +554,13 @@ await sos.fileSystem.copyFile(
|
|
|
477
554
|
```
|
|
478
555
|
|
|
479
556
|
## writeFile()
|
|
557
|
+
|
|
480
558
|
Write into file directly:
|
|
559
|
+
|
|
481
560
|
- string support only
|
|
482
561
|
- override only
|
|
483
562
|
- no append
|
|
484
563
|
|
|
485
|
-
::: alert alert--warning
|
|
486
|
-
**LG webOS limitation**:
|
|
487
|
-
It's possible to handle only files up to **~10KB** on webOS devices. At the moment we are working on the solution regarding the file/s 'manipulation' on LG devices.
|
|
488
|
-
:::
|
|
489
|
-
|
|
490
564
|
### Parameters
|
|
491
565
|
|
|
492
566
|
| Param | Type | Required | Description |
|
|
@@ -496,6 +570,7 @@ It's possible to handle only files up to **~10KB** on webOS devices. At the mome
|
|
|
496
570
|
|
|
497
571
|
|
|
498
572
|
### Javascript Example
|
|
573
|
+
|
|
499
574
|
```javascript
|
|
500
575
|
await sos.fileSystem.writeFile(
|
|
501
576
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
|
|
@@ -503,6 +578,30 @@ await sos.fileSystem.writeFile(
|
|
|
503
578
|
);
|
|
504
579
|
```
|
|
505
580
|
|
|
581
|
+
## appendFile()
|
|
582
|
+
|
|
583
|
+
Append content into file directly:
|
|
584
|
+
|
|
585
|
+
- string support only
|
|
586
|
+
- append only
|
|
587
|
+
|
|
588
|
+
### Parameters
|
|
589
|
+
|
|
590
|
+
| Param | Type | Required | Description |
|
|
591
|
+
| ------ | -------- | :------: | ---- |
|
|
592
|
+
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
593
|
+
| `content` | String | <div class="red">Yes</div> | Parsed content as string |
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
### Javascript Example
|
|
597
|
+
|
|
598
|
+
```javascript
|
|
599
|
+
await sos.fileSystem.appendFile(
|
|
600
|
+
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
|
|
601
|
+
'My awesome log line\n',
|
|
602
|
+
);
|
|
603
|
+
```
|
|
604
|
+
|
|
506
605
|
## readFile()
|
|
507
606
|
Read a text file.
|
|
508
607
|
|
|
@@ -20,8 +20,8 @@ This can be leveraged to integrate a wide variety of hardware into your digital
|
|
|
20
20
|
Such hardware could be, for example, printers, payment terminals or sensors.
|
|
21
21
|
|
|
22
22
|
::: alert alert--warning
|
|
23
|
-
* Before using this API, ensure that the
|
|
24
|
-
* More info
|
|
23
|
+
* Before using this API, ensure that the display supports serial via `sos.display.supports("SERIAL")`.
|
|
24
|
+
* More info [**HERE**](/api/js/content/js-display#supports).
|
|
25
25
|
:::
|
|
26
26
|
|
|
27
27
|
## All methods
|
package/docs/js-api/js-input.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Input
|
|
2
|
+
title: IR Remote Control Input
|
|
3
3
|
author: Miroslav Behina
|
|
4
4
|
date: 22.11.2018
|
|
5
5
|
type: js-api
|
|
@@ -11,11 +11,13 @@ tags:
|
|
|
11
11
|
description: "[Content JS API] For the specific logic of an application (games for example), binding the remote control inputs can be helpful."
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
# Input
|
|
14
|
+
# IR Remote Control Input
|
|
15
15
|
For the specific logic of an application (games for example), binding the remote control inputs can be helpful.
|
|
16
16
|
Only a subset of all remote control keys is supported on the specific device. Only numerical digits are guaranteed to be supported.
|
|
17
17
|
This feature must be tested by users on real devices.
|
|
18
18
|
|
|
19
|
+
## Event onKeyUp()
|
|
20
|
+
|
|
19
21
|
### Parameters
|
|
20
22
|
|
|
21
23
|
::: table-responsive
|
|
@@ -24,6 +26,13 @@ This feature must be tested by users on real devices.
|
|
|
24
26
|
| event (in listener) | Object | <div class="red">Yes</div> | Plain JS object containing keyCode as number and keyName as string and type of event (always keyup string) | 1.3.0 |
|
|
25
27
|
:::
|
|
26
28
|
|
|
29
|
+
### Javascript syntax
|
|
30
|
+
```javascript
|
|
31
|
+
await sos.input.onKeyUp((keyUpEvent) => {
|
|
32
|
+
console.log(`Pressed: ${keyUpEvent.keyCode} (${keyUpEvent.keyName})`);
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
27
36
|
## Map of keyCodes:
|
|
28
37
|
| Name | Key code | Name | Key Code |
|
|
29
38
|
| ---- | :----: | ----- | :----: |
|
|
@@ -57,3 +66,19 @@ interface IKeyUpEventListener {
|
|
|
57
66
|
}
|
|
58
67
|
onKeyUp(listener: IKeyUpEventListener): void;
|
|
59
68
|
```
|
|
69
|
+
|
|
70
|
+
<div class="row d-flex align-content-stretch force-padding-20">
|
|
71
|
+
<div class="col-12 d-flex">
|
|
72
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/remote-control">
|
|
73
|
+
<div>
|
|
74
|
+
<div class="wide-box__image d-flex align-items-center">
|
|
75
|
+
<i class="fab fa-github svg-black"></i>
|
|
76
|
+
</div>
|
|
77
|
+
<div>
|
|
78
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">IR Input handling</h3>
|
|
79
|
+
<div class="wide-box__description">Working example on our Github</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</a>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
@@ -66,10 +66,14 @@ Method `saveFile()` is used to save files from remote a destination into the dev
|
|
|
66
66
|
`headers` has to be a JSON object. If you are passing the value, make sure you use `JSON.parse()`.
|
|
67
67
|
:::
|
|
68
68
|
|
|
69
|
+
::: alert alert--warning
|
|
70
|
+
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
71
|
+
:::
|
|
72
|
+
|
|
69
73
|
### Javascript example
|
|
70
74
|
```javascript
|
|
71
75
|
// Example saving files into internal memory, unique id could be salted md5 hash, uri directs to our CDN
|
|
72
|
-
await sos.offline.cache.saveFile('9d66725ba2105f1833731ade5b7f334e', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
|
|
76
|
+
await sos.offline.cache.saveFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
|
|
73
77
|
.then(() => { console.log('Saved'); })
|
|
74
78
|
.catch((error) => { console.error(error); });
|
|
75
79
|
```
|
|
@@ -87,15 +91,19 @@ Method `loadFile()` is used for individual file retrieval from internal memory.
|
|
|
87
91
|
| --------- | ------------ | :---------: | --------------- |
|
|
88
92
|
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
89
93
|
|
|
94
|
+
::: alert alert--warning
|
|
95
|
+
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
96
|
+
:::
|
|
97
|
+
|
|
90
98
|
### Javascript Example
|
|
91
99
|
```javascript
|
|
92
|
-
await sos.offline.cache.loadFile('9d66725ba2105f1833731ade5b7f334e')
|
|
100
|
+
await sos.offline.cache.loadFile('9d66725ba2105f1833731ade5b7f334e.mp4')
|
|
93
101
|
.then((file) => { console.log('Loaded', file); })
|
|
94
102
|
.catch((error) => { console.error(error); });
|
|
95
103
|
|
|
96
104
|
// Logs into console
|
|
97
105
|
{
|
|
98
|
-
filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e',
|
|
106
|
+
filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e.mp4',
|
|
99
107
|
}
|
|
100
108
|
```
|
|
101
109
|
|
|
@@ -124,15 +132,19 @@ To get file from internal memory & save it when not yet exists we prepared `load
|
|
|
124
132
|
| `uri` | string | <div class="red">Yes</div> | URL address where to get the file |
|
|
125
133
|
| `headers` | object | <div class="yellow">No</div> | Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any other specific headers are needed to access it. |
|
|
126
134
|
|
|
135
|
+
::: alert alert--warning
|
|
136
|
+
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
137
|
+
:::
|
|
138
|
+
|
|
127
139
|
### Javascript Example
|
|
128
140
|
```javascript
|
|
129
|
-
await sos.offline.cache.loadOrSaveFile('9d66725ba2105f1833731ade5b7f334e', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
|
|
141
|
+
await sos.offline.cache.loadOrSaveFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
|
|
130
142
|
.then((file) => { console.log('Loaded or Saved', file); })
|
|
131
143
|
.catch((error) => { console.error(error); });
|
|
132
144
|
|
|
133
145
|
// Logs into console
|
|
134
146
|
{
|
|
135
|
-
filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e',
|
|
147
|
+
filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e.mp4',
|
|
136
148
|
}
|
|
137
149
|
```
|
|
138
150
|
|
|
@@ -187,7 +199,7 @@ Method `deleteFile()` is used for deleting previously saved file from internal m
|
|
|
187
199
|
|
|
188
200
|
### Javascript example
|
|
189
201
|
```javascript
|
|
190
|
-
await sos.offline.cache.deleteFile('9d66725ba2105f1833731ade5b7f334e')
|
|
202
|
+
await sos.offline.cache.deleteFile('9d66725ba2105f1833731ade5b7f334e.mp4')
|
|
191
203
|
.then(() => { console.log('Deleted'); })
|
|
192
204
|
.catch((error) => { console.error(error); });
|
|
193
205
|
```
|
|
@@ -203,7 +215,7 @@ Method `getChecksumFile()` is used for getting the checksum of file from interna
|
|
|
203
215
|
|
|
204
216
|
### Javascript example
|
|
205
217
|
```javascript
|
|
206
|
-
await sos.offline.cache.getChecksumFile('9d66725ba2105f1833731ade5b7f334e', 'md5')
|
|
218
|
+
await sos.offline.cache.getChecksumFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'md5')
|
|
207
219
|
.then((checksum) => { console.log('MD5 checksum is ' + checksum); })
|
|
208
220
|
.catch((error) => { console.error(error); });
|
|
209
221
|
```
|
|
@@ -8,18 +8,19 @@ tags:
|
|
|
8
8
|
- applet_api
|
|
9
9
|
- api
|
|
10
10
|
- js_api
|
|
11
|
-
description: "[Content JS API] Methods to play or stop
|
|
11
|
+
description: "[Content JS API] Methods to play or stop video streams."
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Video streams
|
|
15
|
-
Methods to play or stop
|
|
15
|
+
Methods to play or stop video streams.
|
|
16
16
|
|
|
17
17
|
## All methods
|
|
18
18
|
::: table-responsive
|
|
19
|
-
| Methods
|
|
19
|
+
| Methods | Description | Supported since |
|
|
20
20
|
| ------------------ | ---------------------------------------------------------------- | --------------- |
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
21
|
+
| `prepare()` | Prepare video stream in the background | 4.7.0 |
|
|
22
|
+
| `play()` | Start playing video stream | 1.0.18 |
|
|
23
|
+
| `stop()` | Stop video stream | 1.0.18 |
|
|
23
24
|
| `onConnected()` | Calls a listener callback when stream connects | 1.0.20 |
|
|
24
25
|
| `onDisconnected()` | Calls a listener callback when stream disconnects | 1.0.20 |
|
|
25
26
|
| `onError()` | Calls a listener callback when an unexpected stream error occurs | 1.0.20 |
|
|
@@ -29,23 +30,64 @@ Methods to play or stop stream on displays.
|
|
|
29
30
|
Are you using **Samsung Tizen** to play streams? [Read more about limitation and Tizen-specific details](knowledge-base/stream-playback-on-tizen).
|
|
30
31
|
:::
|
|
31
32
|
|
|
33
|
+
## prepare()
|
|
34
|
+
Calls the internal player and prepares a video stream in memory, so it can later start playing instantaneously.
|
|
35
|
+
|
|
36
|
+
::: alert alert--info
|
|
37
|
+
If you want to play a video stream in full screen mode, use x = y = 0 and width = document.documentElement.clientWidth and height = document.documentElement.clientHeight as setup parameters.
|
|
38
|
+
:::
|
|
39
|
+
|
|
40
|
+
### Parameters
|
|
41
|
+
::: table-responsive
|
|
42
|
+
| Param | Type | Required | Description |
|
|
43
|
+
| -------------- | --------------------------- | :--------------------------: | --------------------------------------------- |
|
|
44
|
+
| `uri` | String | <div class="red">Yes</div> | Network address where the stream is available |
|
|
45
|
+
| `x` | Number | <div class="red">Yes</div> | Stream x-position on the screen |
|
|
46
|
+
| `y` | Number | <div class="red">Yes</div> | Stream y-position on the screen |
|
|
47
|
+
| `width` | Number | <div class="red">Yes</div> | Stream width on the screen |
|
|
48
|
+
| `height` | Number | <div class="red">Yes</div> | Stream height on the screen |
|
|
49
|
+
| `protocol` | String | <div class="red">Yes</div> | Protocol that the stream is using |
|
|
50
|
+
|^^|^^|^^| Types: `HLS`, `RTP`, `HTTP`, `UDP`, `RTMP`, `RTSP`. |
|
|
51
|
+
:::
|
|
52
|
+
|
|
53
|
+
### Javascript syntax
|
|
54
|
+
```javascript
|
|
55
|
+
await sos.stream.prepare(uri, x, y, width, height, protocol);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<div class="row d-flex align-content-stretch force-padding-20">
|
|
59
|
+
<div class="col-12 d-flex">
|
|
60
|
+
<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/stream">
|
|
61
|
+
<div>
|
|
62
|
+
<div class="wide-box__image d-flex align-items-center">
|
|
63
|
+
<i class="fab fa-github svg-black"></i>
|
|
64
|
+
</div>
|
|
65
|
+
<div>
|
|
66
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">Working example on our Github</h3>
|
|
67
|
+
<div class="wide-box__description">Stream video Applet example</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</a>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
32
74
|
## play()
|
|
33
|
-
|
|
75
|
+
Calls the internal player and starts a video stream in correct position.
|
|
34
76
|
|
|
35
77
|
::: alert alert--info
|
|
36
|
-
If you want to play video in full screen mode, use x = y = 0 and width = document.documentElement.clientWidth and height = document.documentElement.clientHeight as setup parameters.
|
|
78
|
+
If you want to play a video stream in full screen mode, use x = y = 0 and width = document.documentElement.clientWidth and height = document.documentElement.clientHeight as setup parameters.
|
|
37
79
|
:::
|
|
38
80
|
|
|
39
81
|
### Parameters
|
|
40
82
|
::: table-responsive
|
|
41
|
-
| Param | Type
|
|
42
|
-
| -------------- |
|
|
43
|
-
| `uri` | String
|
|
44
|
-
| `x` | Number | <div class="red">Yes</div>
|
|
45
|
-
| `y` | Number | <div class="red">Yes</div>
|
|
46
|
-
| `width` | Number | <div class="red">Yes</div>
|
|
47
|
-
| `height` | Number | <div class="red">Yes</div>
|
|
48
|
-
| `protocol` | String | <div class="
|
|
83
|
+
| Param | Type | Required | Description |
|
|
84
|
+
| -------------- | --------------------------- | :--------------------------: | --------------------------------------------- |
|
|
85
|
+
| `uri` | String | <div class="red">Yes</div> | Network address where the stream is available |
|
|
86
|
+
| `x` | Number | <div class="red">Yes</div> | Stream x-position on the screen |
|
|
87
|
+
| `y` | Number | <div class="red">Yes</div> | Stream y-position on the screen |
|
|
88
|
+
| `width` | Number | <div class="red">Yes</div> | Stream width on the screen |
|
|
89
|
+
| `height` | Number | <div class="red">Yes</div> | Stream height on the screen |
|
|
90
|
+
| `protocol` | String | <div class="red">Yes</div> | Protocol that the stream is using |
|
|
49
91
|
|^^|^^|^^| Types: `HLS`, `RTP`, `HTTP`, `UDP`, `RTMP`, `RTSP`. |
|
|
50
92
|
:::
|
|
51
93
|
|
|
@@ -71,7 +113,7 @@ await sos.stream.play(uri, x, y, width, height, protocol);
|
|
|
71
113
|
</div>
|
|
72
114
|
|
|
73
115
|
## stop()
|
|
74
|
-
|
|
116
|
+
Stops the video stream playback.
|
|
75
117
|
|
|
76
118
|
### Javascript syntax
|
|
77
119
|
```javascript
|
|
@@ -80,13 +122,13 @@ await sos.stream.stop(uri, x, y, width, height);
|
|
|
80
122
|
|
|
81
123
|
### Parameters:
|
|
82
124
|
::: table-responsive
|
|
83
|
-
| Param | Type
|
|
84
|
-
| -------------- |
|
|
85
|
-
| `uri` | String
|
|
86
|
-
| `x` | Number | <div class="red">Yes</div> | x-position
|
|
87
|
-
| `y` | Number | <div class="red">Yes</div> | y-position
|
|
88
|
-
| `width` | Number | <div class="red">Yes</div> |
|
|
89
|
-
| `height` | Number | <div class="red">Yes</div> |
|
|
125
|
+
| Param | Type | Required | Description |
|
|
126
|
+
| -------------- | --------------------------- | :------------------------: | --------------------------------------------- |
|
|
127
|
+
| `uri` | String | <div class="red">Yes</div> | Network address where the stream is available |
|
|
128
|
+
| `x` | Number | <div class="red">Yes</div> | Stream x-position on the screen |
|
|
129
|
+
| `y` | Number | <div class="red">Yes</div> | Stream y-position on the screen |
|
|
130
|
+
| `width` | Number | <div class="red">Yes</div> | Stream width on the screen |
|
|
131
|
+
| `height` | Number | <div class="red">Yes</div> | Stream height on the screen |
|
|
90
132
|
:::
|
|
91
133
|
|
|
92
134
|
## Event onConnected()
|
|
@@ -153,7 +195,7 @@ interface StreamEvent {
|
|
|
153
195
|
y: number;
|
|
154
196
|
width: number;
|
|
155
197
|
height: number;
|
|
156
|
-
protocol
|
|
198
|
+
protocol: string;
|
|
157
199
|
}
|
|
158
200
|
}
|
|
159
201
|
play(
|
|
@@ -20,6 +20,7 @@ Management API app lets you check application type and upgrade the application.
|
|
|
20
20
|
| Method | Description | Supported since |
|
|
21
21
|
| ------ | -------- | ------------- |
|
|
22
22
|
| `getType()` | Information about the platform your application is running on (eg. Tizen) | |
|
|
23
|
+
| `getVersion()` | Information about current version of your application is running on the device (eg. 2.0.5) | |
|
|
23
24
|
| `upgrade()` | Upgrade/Downgrade the Core App | |
|
|
24
25
|
:::
|
|
25
26
|
|
|
@@ -30,8 +31,24 @@ Method `getType()` returns the display type of application on the device.
|
|
|
30
31
|
await sos.management.app.getType(); // Returns ex. sssp, android
|
|
31
32
|
```
|
|
32
33
|
|
|
34
|
+
**Returns one of the following types:**
|
|
35
|
+
- `android`
|
|
36
|
+
- `brightsign`
|
|
37
|
+
- `default` (Emulator)
|
|
38
|
+
- `linux` (Raspberry Pi)
|
|
39
|
+
- `sssp`
|
|
40
|
+
- `tizen`
|
|
41
|
+
- `webos`
|
|
42
|
+
- `windows`
|
|
43
|
+
|
|
44
|
+
::: alert alert--info
|
|
45
|
+
If you need to get specific Android brand or Raspberry Pi model, use the [Firmware API](api/js/management/latest/2-js-management-firmware) `getType()`.
|
|
46
|
+
:::
|
|
47
|
+
|
|
33
48
|
## getVersion()
|
|
34
|
-
Method `getVersion()` returns the
|
|
49
|
+
Method `getVersion()` returns the version of Core App application on the device.
|
|
50
|
+
|
|
51
|
+
*This API is only available for Applets deployed via Timing from Box or REST API.*
|
|
35
52
|
|
|
36
53
|
```javascript
|
|
37
54
|
await sos.management.app.getVersion(); // Returns ex. 2.0.0
|