@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
|
@@ -19,11 +19,10 @@ That way your applet can handle cases, when a certain feature isn't supported by
|
|
|
19
19
|
|
|
20
20
|
## All methods
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
| Method | Description | Supported since |
|
|
24
24
|
| ------------------ | ---------------------- | :-------------: |
|
|
25
|
-
| `supports()` | Query, whether a certain feature is supported by the display | 3.1.0
|
|
26
|
-
:::
|
|
25
|
+
| `supports()` | Query, whether a certain feature is supported by the display | 3.1.0
|
|
27
26
|
|
|
28
27
|
## supports()
|
|
29
28
|
|
|
@@ -31,16 +30,25 @@ Query the display to find out, whether a certain feature is supported.
|
|
|
31
30
|
To let you know, when you should call this method, we will warn you throughout the content JS API documentation
|
|
32
31
|
with a warning message like this one:
|
|
33
32
|
|
|
34
|
-
:::
|
|
33
|
+
:::warning
|
|
35
34
|
* Before using this API, ensure that the display supports serial via `sos.display.supports("SERIAL")`.
|
|
36
|
-
* More info [**HERE**](/api/js/content/latest/js-display#supports).
|
|
37
35
|
:::
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
37
|
+
### List of capabilities
|
|
38
|
+
|
|
39
|
+
| Param | Description |
|
|
40
|
+
| ------------ | --------------- |
|
|
41
|
+
| `FILE_SYSTEM_INTERNAL_STORAGE` | |
|
|
42
|
+
| `FILE_SYSTEM_EXTERNAL_STORAGE` | |
|
|
43
|
+
| `FILE_SYSTEM_FILE_CHECKSUM` | |
|
|
44
|
+
| `FILE_SYSTEM_LINK` | |
|
|
45
|
+
| `TIMERS_PROPRIETARY` | |
|
|
46
|
+
| `VIDEO_4K` | |
|
|
47
|
+
| `SERIAL` | |
|
|
48
|
+
| `BARCODE_SCANNER` | |
|
|
49
|
+
| `FRONT_OSD` | |
|
|
50
|
+
| `FILE_SYSTEM_CREATE_ARCHIVE` | |
|
|
51
|
+
| `FILE_SYSTEM_ARCHIVE_EXTRACT_INFO` | Information about total size of all files when archive will be extracted |
|
|
44
52
|
|
|
45
53
|
### Javascript example
|
|
46
54
|
```javascript
|
|
@@ -15,8 +15,8 @@ description: "[Content JS API] File System API allows **low level manipulation w
|
|
|
15
15
|
File System API allows **low level manipulation with files and directories** in the device internal storage.
|
|
16
16
|
File System API works with both in **internal and external storages** (USB flash drives, etc.).
|
|
17
17
|
|
|
18
|
-
:::
|
|
19
|
-
File System directory structure is **PERSISTENT** and is **NOT** automatically deleted through `Applet Reload` power action! Applet Reload only deletes `/data` directory which is reserved for simplified [Offline Cache API](
|
|
18
|
+
:::warning
|
|
19
|
+
File System directory structure is **PERSISTENT** and is **NOT** automatically deleted through `Applet Reload` power action! Applet Reload only deletes `/data` directory which is reserved for simplified [Offline Cache API](js-offline-cache-media-files). Use `deleteFile()` to clear the device storage file system.
|
|
20
20
|
:::
|
|
21
21
|
|
|
22
22
|
<div class="row d-flex align-content-stretch force-padding-10">
|
|
@@ -35,25 +35,13 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<div>
|
|
42
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
43
|
-
<i class="fas fa-medal svg-black"></i>
|
|
44
|
-
</div>
|
|
45
|
-
<div>
|
|
46
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Offline Cache for media files</h3>
|
|
47
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</a>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
38
|
+
:::note[Alternative file caching]
|
|
39
|
+
[Offline Cache for media files](js-offline-cache-media-files)
|
|
40
|
+
:::
|
|
53
41
|
|
|
54
42
|
## All methods
|
|
55
43
|
|
|
56
|
-
|
|
44
|
+
|
|
57
45
|
| Methods | Description | Supported since |
|
|
58
46
|
| -------- | ----------- | :---------------: |
|
|
59
47
|
| `listStorageUnits()` | Return list of storage units /internal, external/ from the device | 2.1.0 |
|
|
@@ -71,18 +59,17 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
71
59
|
| `copyFile()` | Copy file or directory to a new location | 3.3.0 |
|
|
72
60
|
| `writeFile()` | Write string to a file | 3.2.0 |
|
|
73
61
|
| `appendFile()` | Write string to a file | 4.13.0 |
|
|
74
|
-
| `readFile()` | Read a text file | 3.3.0
|
|
75
|
-
:::
|
|
62
|
+
| `readFile()` | Read a text file | 3.3.0
|
|
76
63
|
|
|
77
64
|
## listStorageUnits()
|
|
78
65
|
|
|
79
66
|
Return list of storage units /internal, external/ from the device. Capacity values are in bytes.
|
|
80
67
|
|
|
81
|
-
:::
|
|
68
|
+
:::info
|
|
82
69
|
This is a mandatory method that is required for all the other File System APIs. The other APIs require a `storageUnit` object that is retrieved from this method to manipulate with files on a correct storage location (internal/external).
|
|
83
70
|
:::
|
|
84
71
|
|
|
85
|
-
:::
|
|
72
|
+
:::warning
|
|
86
73
|
`storageUnit` is a dynamic object! It has to be always generated and retrieved by this JS API, as the values in `type` differ platform by platform. **Never** generate the object manually. `{"type":"internal"}` is for demonstration only.
|
|
87
74
|
:::
|
|
88
75
|
|
|
@@ -236,7 +223,7 @@ console.log(fileProperties.localUri);
|
|
|
236
223
|
|
|
237
224
|
### Returns
|
|
238
225
|
|
|
239
|
-
:::
|
|
226
|
+
:::warning
|
|
240
227
|
Return statement is a dynamic object! It has to be always generated and retrieved by this JS API, as the values in `localUri` differ platform by platform. **Never** generate the object manually. `{"localUri":"file://internal/test-dir/downloaded-file.png"}` is for demonstration only.
|
|
241
228
|
:::
|
|
242
229
|
|
|
@@ -293,11 +280,11 @@ Download file to path within existing directory or **overrides existing file** i
|
|
|
293
280
|
| `uri` | String | <div class="red">Yes</div> | Url address to retrieve the file from network |
|
|
294
281
|
| `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
|
|
295
282
|
|
|
296
|
-
:::
|
|
283
|
+
:::danger
|
|
297
284
|
For every download request, our app makes HEAD request for `content-length` header on that downloaded file.
|
|
298
285
|
:::
|
|
299
286
|
|
|
300
|
-
:::
|
|
287
|
+
:::warning
|
|
301
288
|
`headers` has to be a JSON object. If you are passing the value, make sure you use `JSON.parse()`.
|
|
302
289
|
:::
|
|
303
290
|
|
|
@@ -416,7 +403,7 @@ Returns checksum of existing file in a path.
|
|
|
416
403
|
* FAIL: When file path doesn't exist
|
|
417
404
|
* FAIL: When file path is directory
|
|
418
405
|
|
|
419
|
-
:::
|
|
406
|
+
:::info
|
|
420
407
|
Does not work on Samsung Tizen display - [read more here](https://docs.signageos.io/hc/en-us/articles/4416327809810)
|
|
421
408
|
:::
|
|
422
409
|
|
|
@@ -450,7 +437,7 @@ Extract ZIPed all files (recursively) to destination path and override existing
|
|
|
450
437
|
* FAIL: When extracting not existing ZIP archive file
|
|
451
438
|
* FAIL: When extracting try override existing directory with file or existing file with directory
|
|
452
439
|
|
|
453
|
-
:::
|
|
440
|
+
:::info
|
|
454
441
|
The directory/folder you are extracting your ZIP file into has to be created BEFORE you start extracting the ZIP.
|
|
455
442
|
:::
|
|
456
443
|
|
|
@@ -484,12 +471,12 @@ Creates a archive in a path with all files from `archiveEntries` array.
|
|
|
484
471
|
* FAIL: When creating directory over existing file or directory
|
|
485
472
|
* FAIL: When creating directory in not existing containing (parent) directory
|
|
486
473
|
|
|
487
|
-
:::
|
|
474
|
+
:::warning
|
|
488
475
|
- Never start OR end the `filePath` with a slash - `/`. It will cause error *50517*
|
|
489
476
|
- It is a good practice to check if file exists - `exists()` prior creating it
|
|
490
477
|
:::
|
|
491
478
|
|
|
492
|
-
:::
|
|
479
|
+
:::info
|
|
493
480
|
- This function is available only on Tizen devices.
|
|
494
481
|
- All files are added to the archive based on absolute path from root directory.
|
|
495
482
|
:::
|
|
@@ -527,7 +514,7 @@ Creates a directory in a path.
|
|
|
527
514
|
* FAIL: When creating directory over existing file or directory
|
|
528
515
|
* FAIL: When creating directory in not existing containing (parent) directory
|
|
529
516
|
|
|
530
|
-
:::
|
|
517
|
+
:::warning
|
|
531
518
|
- Never start OR end the `filePath` with a slash - `/`. It will cause error *50512*
|
|
532
519
|
- It is a good practice to check if directory exists - `isDirectory()` prior creating it
|
|
533
520
|
:::
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Fonts
|
|
3
3
|
author: Miroslav Behina
|
|
4
4
|
date: 22.11.2018
|
|
5
5
|
type: js-api
|
|
@@ -14,16 +14,18 @@ description: "[Content JS API] When working with custom font families, you shoul
|
|
|
14
14
|
# Loading fonts
|
|
15
15
|
When working with custom font families, you should use this method that downloads fonts into offline storage and generates the appropriate font-face definition.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
## All methods
|
|
18
|
+
|
|
19
19
|
| Method | Description | Supported since |
|
|
20
|
-
| ------ | -------- |
|
|
21
|
-
| `addFont()` | Load additionally font into applet cache | 2.0.0
|
|
22
|
-
:::
|
|
20
|
+
| ------ | -------- | :----------: |
|
|
21
|
+
| `addFont()` | Load additionally font into applet cache | 2.0.0 |
|
|
23
22
|
|
|
24
|
-
### Parameters
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
## addFont()
|
|
25
|
+
|
|
26
|
+
Load your custom fonts into the Applet.
|
|
27
|
+
|
|
28
|
+
### Parameters
|
|
27
29
|
| Param | Type | Required | Description |
|
|
28
30
|
| ------- | --------- | :----------: | ------ |
|
|
29
31
|
| `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 |
|
|
@@ -34,8 +36,7 @@ When working with custom font families, you should use this method that download
|
|
|
34
36
|
| `fontStyle` | string | <div class="yellow">No</div> | Apecifies the font stlye for a text |
|
|
35
37
|
|^^|^^|^^| Types: `normal`, `italic`, `oblique`, `initial`, `inherit` |
|
|
36
38
|
| `fontWeight` | string | <div class="yellow">No</div> | Sets how thick or thin characters in text should be displayed |
|
|
37
|
-
| `unicodeRage` | string | <div class="yellow">No</div> | Defines the range of unicode characters the font supports, default value is "U+0-10FFFF"
|
|
38
|
-
:::
|
|
39
|
+
| `unicodeRage` | string | <div class="yellow">No</div> | Defines the range of unicode characters the font supports, default value is "U+0-10FFFF"
|
|
39
40
|
|
|
40
41
|
### Formats parameters
|
|
41
42
|
| Param | Type | Required | Description |
|
|
@@ -69,37 +70,14 @@ await sos.offline.addFont({
|
|
|
69
70
|
});
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Most properties follow the official CSS properties found</h3>
|
|
81
|
-
<div class="wide-box__description">Mozilla Developer Page</div>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</a>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<div class="row d-flex align-content-stretch force-padding-10">
|
|
89
|
-
<div class="col-12 d-flex">
|
|
90
|
-
<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/fonts">
|
|
91
|
-
<div>
|
|
92
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
93
|
-
<i class="fab fa-github svg-black"></i>
|
|
94
|
-
</div>
|
|
95
|
-
<div>
|
|
96
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of Applet that load custom fonts</h3>
|
|
97
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</a>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
73
|
+
:::info
|
|
74
|
+
Most properties follow the official CSS properties found on [Mozilla Developer Page](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face)
|
|
75
|
+
:::
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
:::note[GitHub Example]
|
|
79
|
+
[Example of Applet that load custom fonts](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/fonts)
|
|
80
|
+
:::
|
|
103
81
|
|
|
104
82
|
## Usage with Typescript
|
|
105
83
|
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
@@ -126,7 +104,7 @@ addFont(
|
|
|
126
104
|
## Errors
|
|
127
105
|
Although we are doing our best, following errors may occur when working with the Applet Resources.
|
|
128
106
|
|
|
129
|
-
|
|
107
|
+
|
|
130
108
|
| Code | Type | Message |
|
|
131
109
|
| ---- | ---- | ------- |
|
|
132
110
|
| 40105 | AppletResourcesError | Already loading file: `$$FILE_NAME$$` |
|
|
@@ -134,5 +112,4 @@ Although we are doing our best, following errors may occur when working with the
|
|
|
134
112
|
| 40106 | AppletResourcesError | Already existing file: `$$FILE_NAME$$` |
|
|
135
113
|
|^^|^^| Please, check your code for occurrences of addFile/s methods on lines before this error. |
|
|
136
114
|
| 49901 | AppletResourceError | Please, check if the used URL is correct. |
|
|
137
|
-
| 49902 | FileNotFoundError | File was not found `$$FILE_ID$$`
|
|
138
|
-
:::
|
|
115
|
+
| 49902 | FileNotFoundError | File was not found `$$FILE_ID$$`
|
|
@@ -23,19 +23,17 @@ Some Philips brand devices have LED lights built into them. The color of lights
|
|
|
23
23
|
|
|
24
24
|
### All methods
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
| Method | Description | Supported since |
|
|
28
28
|
| ------ | -------- | :---------: |
|
|
29
|
-
| `setColor()` | Method supports a string in hexa format to display color of LED light or null value to not be disabled | 1.0.1
|
|
30
|
-
:::
|
|
29
|
+
| `setColor()` | Method supports a string in hexa format to display color of LED light or null value to not be disabled | 1.0.1
|
|
31
30
|
|
|
32
31
|
### setColor()
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
| Param | Type | Required | Description |
|
|
36
35
|
| ------ | ------ | :--------: | -------- |
|
|
37
|
-
| `color` | string | <div class="red">Yes</div> | Color of LED to be set in CSS hexa format `#000000`. To disable LED pass null value instead.
|
|
38
|
-
:::
|
|
36
|
+
| `color` | string | <div class="red">Yes</div> | Color of LED to be set in CSS hexa format `#000000`. To disable LED pass null value instead.
|
|
39
37
|
|
|
40
38
|
#### Javascript example
|
|
41
39
|
```javascript
|
|
@@ -61,10 +59,9 @@ sos.hardware.led.setColor("#00FF00"); // For GREEN light
|
|
|
61
59
|
## Errors
|
|
62
60
|
Although we are doing our best, following errors may occur when working with the hardware.
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
|
|
65
63
|
| Code | Type | Message |
|
|
66
64
|
| ---- | ---- | ------- |
|
|
67
65
|
| 50601 | InternalHardwareError | Unexpected error occurred when working with hardware. |
|
|
68
66
|
| 40601 | AppletHardwareError | Color must be string |
|
|
69
|
-
| 40602 | AppletHardwareError | Color must be in format #000000 or null, allowed are `/^[a-zA-Z0-9\.\-_]+$/g`
|
|
70
|
-
:::
|
|
67
|
+
| 40602 | AppletHardwareError | Color must be in format #000000 or null, allowed are `/^[a-zA-Z0-9\.\-_]+$/g`
|
|
@@ -9,13 +9,13 @@ tags:
|
|
|
9
9
|
- api
|
|
10
10
|
- js_api
|
|
11
11
|
- iframe
|
|
12
|
-
description: "[Content JS API] We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending
|
|
12
|
+
description: "[Content JS API] We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending </body>. Everything will be prepared, and you can call the very same methods as described for Applet."
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# Iframes
|
|
16
|
-
We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending
|
|
16
|
+
We **do not recommend** to use iframes inside your Applet. However, if you have to use it, you can add full support of the sOS JS API to every one of your iframe. Just add the JS snippet script below to every page load in iframe before ending </body>. Everything will be prepared, and you can call the very same methods as described for Applet.
|
|
17
17
|
|
|
18
|
-
:::
|
|
18
|
+
:::warning
|
|
19
19
|
The signageOS Snippet and API works **ONLY** if the iframe is served from the display's internal storage - `<iframe src="file://...`. If your iframe is served from a live URL - `<iframe src="https://your-iframe-url"...` the snippet and signageOS API will **NOT** work. This is a security limitation to prevent random site took advantage of the API and alter the display behavior. There is a simple way to [save and load your iframe from the internal storage](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/iframes). Just make sure you are using full paths in your iframe for linking javascripts and css instead of the relative ones.
|
|
20
20
|
|
|
21
21
|
If your device can not load a file stored in local storage, such as an html, you can try to use an alternative instead of python to zip the file when you are preparing the applet.
|
|
@@ -20,11 +20,10 @@ This feature must be tested by users on real devices.
|
|
|
20
20
|
|
|
21
21
|
### Parameters
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
| Parameters | Type | Required | Description | Supported Since |
|
|
25
25
|
| ------ | ------ | :--------: | -------- | :-----: |
|
|
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
|
|
27
|
-
:::
|
|
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
|
|
28
27
|
|
|
29
28
|
### Javascript syntax
|
|
30
29
|
```javascript
|
|
@@ -16,9 +16,8 @@ File API allows files (video files, media files etc.) to be stored for offline u
|
|
|
16
16
|
|
|
17
17
|
## All methods
|
|
18
18
|
|
|
19
|
-
::: table-responsive
|
|
20
19
|
| Methods | Description | Supported since |
|
|
21
|
-
| ------ | -------- |
|
|
20
|
+
| ------ | -------- | :-------------: |
|
|
22
21
|
| `listFiles()` | Return list of files of existing directory | 2.0.0 |
|
|
23
22
|
| `saveFile()` | Download file to selected directory | 1.0.3 |
|
|
24
23
|
| `loadFile()` | Load file from cache | 1.0.3 |
|
|
@@ -26,10 +25,9 @@ File API allows files (video files, media files etc.) to be stored for offline u
|
|
|
26
25
|
| `deleteFile()` | Delete file from directory | 2.0.0 |
|
|
27
26
|
| `getChecksumFile()` | Get checksum of a file | 2.0.0 |
|
|
28
27
|
| `validateChecksumFile()` | Validate that file's checksum matches expected value | 2.0.0 |
|
|
29
|
-
| `decompressFile()` | Decompress a compressed file or archive | 2.1.0
|
|
30
|
-
:::
|
|
28
|
+
| `decompressFile()` | Decompress a compressed file or archive | 2.1.0 |
|
|
31
29
|
|
|
32
|
-
:::
|
|
30
|
+
:::warning
|
|
33
31
|
Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
34
32
|
:::
|
|
35
33
|
|
|
@@ -54,19 +52,18 @@ Method `saveFile()` is used to save files from remote a destination into the dev
|
|
|
54
52
|
|
|
55
53
|
### Parameters
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
|
|
58
56
|
| Param | Type | Required | Description |
|
|
59
57
|
| ---------------- | --------------------- | :------: |---------------------------------------------- |
|
|
60
58
|
| `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, slash / is supported since Front-display version 6.0.0 |
|
|
61
59
|
| `uri` | string | <div class="red">Yes</div> | URL address to retrieve the file |
|
|
62
|
-
| `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.
|
|
63
|
-
:::
|
|
60
|
+
| `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.
|
|
64
61
|
|
|
65
|
-
:::
|
|
62
|
+
:::warning
|
|
66
63
|
`headers` has to be a JSON object. If you are passing the value, make sure you use `JSON.parse()`.
|
|
67
64
|
:::
|
|
68
65
|
|
|
69
|
-
:::
|
|
66
|
+
:::warning
|
|
70
67
|
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
71
68
|
:::
|
|
72
69
|
|
|
@@ -78,7 +75,7 @@ await sos.offline.cache.saveFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'https:
|
|
|
78
75
|
.catch((error) => { console.error(error); });
|
|
79
76
|
```
|
|
80
77
|
|
|
81
|
-
:::
|
|
78
|
+
:::info
|
|
82
79
|
Local device file path differs from device to device. It can point to file:// or http://localhost etc.
|
|
83
80
|
:::
|
|
84
81
|
|
|
@@ -91,7 +88,7 @@ Method `loadFile()` is used for individual file retrieval from internal memory.
|
|
|
91
88
|
| --------- | ------------ | :---------: | --------------- |
|
|
92
89
|
| `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 |
|
|
93
90
|
|
|
94
|
-
:::
|
|
91
|
+
:::warning
|
|
95
92
|
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
96
93
|
:::
|
|
97
94
|
|
|
@@ -107,7 +104,7 @@ await sos.offline.cache.loadFile('9d66725ba2105f1833731ade5b7f334e.mp4')
|
|
|
107
104
|
}
|
|
108
105
|
```
|
|
109
106
|
|
|
110
|
-
:::
|
|
107
|
+
:::info
|
|
111
108
|
Local device file path differs from device to device. It can point to file:// or http://localhost etc.
|
|
112
109
|
:::
|
|
113
110
|
|
|
@@ -119,7 +116,7 @@ Local device file path differs from device to device. It can point to file:// or
|
|
|
119
116
|
Method `loadOrSaveFile()` is used for individual file retrieval & save in case when file is not saved in local storage yet.
|
|
120
117
|
To get file from internal memory & save it when not yet exists we prepared `loadOrSaveFile()` method:
|
|
121
118
|
|
|
122
|
-
:::
|
|
119
|
+
:::info
|
|
123
120
|
* The file URI has to return the file. If your URI leads to a 303 redirect (e.g. from http to http**s**), the API will not work.
|
|
124
121
|
* Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
125
122
|
:::
|
|
@@ -132,7 +129,7 @@ To get file from internal memory & save it when not yet exists we prepared `load
|
|
|
132
129
|
| `uri` | string | <div class="red">Yes</div> | URL address where to get the file |
|
|
133
130
|
| `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. |
|
|
134
131
|
|
|
135
|
-
:::
|
|
132
|
+
:::warning
|
|
136
133
|
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
137
134
|
:::
|
|
138
135
|
|
|
@@ -148,7 +145,7 @@ await sos.offline.cache.loadOrSaveFile('9d66725ba2105f1833731ade5b7f334e.mp4', '
|
|
|
148
145
|
}
|
|
149
146
|
```
|
|
150
147
|
|
|
151
|
-
:::
|
|
148
|
+
:::info
|
|
152
149
|
Local device file path differs from device to device. It can point to file:// or http://localhost etc.
|
|
153
150
|
:::
|
|
154
151
|
|
|
@@ -156,37 +153,10 @@ Local device file path differs from device to device. It can point to file:// or
|
|
|
156
153
|
* SUCCESS: File object
|
|
157
154
|
* FAIL: No file of such uid is available, it will download it to local storage & then return saved file.
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
164
|
-
<i class="fab fa-github svg-black"></i>
|
|
165
|
-
</div>
|
|
166
|
-
<div>
|
|
167
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of managing offline files</h3>
|
|
168
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</a>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<div class="row d-flex align-content-stretch force-padding-10">
|
|
176
|
-
<div class="col-12 d-flex">
|
|
177
|
-
<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/video-loop-offline">
|
|
178
|
-
<div>
|
|
179
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
180
|
-
<i class="fab fa-github svg-black"></i>
|
|
181
|
-
</div>
|
|
182
|
-
<div>
|
|
183
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of playing video in loop</h3>
|
|
184
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</a>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
156
|
+
:::note[GitHub Example]
|
|
157
|
+
- [Example of managing offline files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/offline-files)
|
|
158
|
+
- [Example of playing video in loop](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/video-loop-offline)
|
|
159
|
+
:::
|
|
190
160
|
|
|
191
161
|
## deleteFile()
|
|
192
162
|
Method `deleteFile()` is used for deleting previously saved file from internal memory.
|
|
@@ -220,21 +190,9 @@ await sos.offline.cache.getChecksumFile('9d66725ba2105f1833731ade5b7f334e.mp4',
|
|
|
220
190
|
.catch((error) => { console.error(error); });
|
|
221
191
|
```
|
|
222
192
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
<div>
|
|
227
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
228
|
-
<i class="fab fa-github svg-black"></i>
|
|
229
|
-
</div>
|
|
230
|
-
<div>
|
|
231
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of checking checksum of file</h3>
|
|
232
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
</a>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
193
|
+
:::note[GitHub Example]
|
|
194
|
+
[Example of checking checksum of file](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/md5-checksum)
|
|
195
|
+
:::
|
|
238
196
|
|
|
239
197
|
## validateChecksumFile()
|
|
240
198
|
Method `validateChecksumFile()` is used for validating the checksum of the previously saved file in from internal memory.
|
|
@@ -274,27 +232,12 @@ await sos.offline.cache.decompressFile(zipUid, destinationDirectoryUid, 'zip')
|
|
|
274
232
|
.catch((error) => { console.error(error); });
|
|
275
233
|
```
|
|
276
234
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
</div>
|
|
284
|
-
<div>
|
|
285
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of decompressing ZIP files</h3>
|
|
286
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
287
|
-
</div>
|
|
288
|
-
</div>
|
|
289
|
-
</a>
|
|
290
|
-
</div>
|
|
291
|
-
</div>
|
|
292
|
-
|
|
293
|
-
## More examples
|
|
294
|
-
|
|
295
|
-
* [Managing files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/file-system)
|
|
296
|
-
* [Sample applet from Box](https://github.com/signageos/applet-examples/blob/master/index.html)
|
|
297
|
-
* All other examples are available in Knowledge Base under [Applet Examples](https://github.com/signageos/applet-examples/)
|
|
235
|
+
:::note[GitHub Example]
|
|
236
|
+
- [Example of decompressing ZIP files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/offline-zip-decompress
|
|
237
|
+
- [Managing files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/file-system)
|
|
238
|
+
- [Sample applet from Box](https://github.com/signageos/applet-examples/blob/master/index.html)
|
|
239
|
+
- All other examples are available in Knowledge Base under [Applet Examples](https://github.com/signageos/applet-examples/)
|
|
240
|
+
:::
|
|
298
241
|
|
|
299
242
|
## Errors
|
|
300
243
|
Although we are doing our best, following errors may occur when working with the offline cache.
|
|
@@ -15,19 +15,18 @@ description: "[Content JS API] This API provides you with approach similar to th
|
|
|
15
15
|
|
|
16
16
|
Use when you need to save some data into local memory.
|
|
17
17
|
This API provides you with approach similar to the HTML5's Local Storage, but implemented internally via native device API and completely device agnostic.
|
|
18
|
-
We do not recommend using a different storage type then Offline Cache or full featured [File System API](
|
|
18
|
+
We do not recommend using a different storage type then Offline Cache or full featured [File System API](js-file-system) that will provide you with more low-level methods.
|
|
19
19
|
|
|
20
20
|
## All methods
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
| Method | Description | Supported Since |
|
|
23
|
-
| ------ | -------- |
|
|
23
|
+
| ------ | -------- | :--------: |
|
|
24
24
|
| `loadContent()` | Loads content from internal storage | 1.0.3 |
|
|
25
25
|
| `saveContent()` | Saves content to internal storage | 1.0.3 |
|
|
26
26
|
| `listContents()` | List all content items saved previously to internal storage | 2.0.0 |
|
|
27
27
|
| `deleteContent()` | Delete content item previously saved to internal storage | 2.0.0 |
|
|
28
|
-
:::
|
|
29
28
|
|
|
30
|
-
:::
|
|
29
|
+
:::warning
|
|
31
30
|
Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
32
31
|
:::
|
|
33
32
|
|
|
@@ -35,11 +34,10 @@ Emulator has certain limitations while handling offline files. [Read more here](
|
|
|
35
34
|
Method `loadContent()` loads content from internal storage.
|
|
36
35
|
|
|
37
36
|
### Parameters
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
| Param | Type | Required | Description |
|
|
40
39
|
| -------------- | ------ | :-------: | ----------- |
|
|
41
|
-
| `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 |
|
|
42
|
-
:::
|
|
40
|
+
| `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 |
|
|
43
41
|
|
|
44
42
|
### Javascript example
|
|
45
43
|
```javascript
|
|
@@ -50,12 +48,11 @@ await sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash');
|
|
|
50
48
|
Method for saving content into internal storage.
|
|
51
49
|
|
|
52
50
|
### Parameters
|
|
53
|
-
|
|
51
|
+
|
|
54
52
|
| Param | Type | Required | Description |
|
|
55
53
|
| -------------- | ------ | :-------: | ----------- |
|
|
56
54
|
| `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 |
|
|
57
|
-
| `content` | string | <div class="red">Yes</div> | Only string variables enabled. For JSON values use `JSON.Stringify()`
|
|
58
|
-
:::
|
|
55
|
+
| `content` | string | <div class="red">Yes</div> | Only string variables enabled. For JSON values use `JSON.Stringify()`
|
|
59
56
|
|
|
60
57
|
### Javascript Example
|
|
61
58
|
```javascript
|
|
@@ -81,11 +78,10 @@ await sos.offline.cache.listContents();
|
|
|
81
78
|
Delete content item previously saved to internal storage.
|
|
82
79
|
|
|
83
80
|
### Parameters
|
|
84
|
-
|
|
81
|
+
|
|
85
82
|
| Param | Type | Required | Description |
|
|
86
83
|
| -------------- | ------ | :-------: | ----------- |
|
|
87
|
-
| `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 |
|
|
88
|
-
:::
|
|
84
|
+
| `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
85
|
|
|
90
86
|
### Javascript example
|
|
91
87
|
```javascript
|
|
@@ -121,7 +117,7 @@ deleteContent(uid: string): Promise<void>;
|
|
|
121
117
|
## Errors
|
|
122
118
|
Although we are doing our best, following errors may occur when working with the offline cache.
|
|
123
119
|
|
|
124
|
-
|
|
120
|
+
|
|
125
121
|
| Code | Type | Message |
|
|
126
122
|
| ---- | ---- | ------- |
|
|
127
123
|
| 41001 | AppletNativeCacheError | Already saving the file with UID: ```uid``` |
|
|
@@ -130,5 +126,4 @@ Although we are doing our best, following errors may occur when working with the
|
|
|
130
126
|
| 51001 | InternalNativeCacheError | Couldn\'t load the file before deleting it. |
|
|
131
127
|
| 51002 | InternalNativeCacheError | Couldn\'t save the file to the offline cache. |
|
|
132
128
|
| 51003 | InternalNativeCacheError | File wasn\'t deleted correctly. |
|
|
133
|
-
| 40901 | AppletOfflineCacheError | Uid contains invalid characters, allowed: $$ALLOWED_CHARS$$, got $$ACTUAL_UID$$
|
|
134
|
-
:::
|
|
129
|
+
| 40901 | AppletOfflineCacheError | Uid contains invalid characters, allowed: $$ALLOWED_CHARS$$, got $$ACTUAL_UID$$
|
|
@@ -18,11 +18,9 @@ OSD API allows you to open OSD for initial setup with applet.
|
|
|
18
18
|
|
|
19
19
|
## All methods
|
|
20
20
|
|
|
21
|
-
::: table-responsive
|
|
22
21
|
| Method | Description | Supported since |
|
|
23
22
|
| ------------------ | ---------------------- | :-------------: |
|
|
24
23
|
| `showOSD()` |Open OSD on the display | 5.5.0 |
|
|
25
|
-
:::
|
|
26
24
|
|
|
27
25
|
## showOSD()
|
|
28
26
|
|