@signageos/front-applet 8.1.0 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -1
- package/docs/fpath/index.md +12 -250
- package/docs/sos/fileSystem.md +12 -12
- package/docs/sos/index.md +36 -12
- package/docs/sos/offline/cache.md +6 -6
- package/docs/sos/stream.md +1172 -37
- package/docs/sos/sync.md +2 -2
- package/docs/sos/video.md +515 -22
- package/docs/sos_management/security.md +4 -2
- package/docs/sos_management/wifi.md +9 -9
- package/es6/FrontApplet/FrontApplet.d.ts +31 -7
- package/es6/FrontApplet/FrontApplet.js +32 -8
- package/es6/FrontApplet/FrontApplet.js.map +1 -1
- package/es6/FrontApplet/Stream/IStreamTrackInfo.d.ts +34 -0
- package/es6/FrontApplet/Stream/Stream.d.ts +245 -20
- package/es6/FrontApplet/Stream/Stream.js +245 -20
- package/es6/FrontApplet/Stream/Stream.js.map +1 -1
- package/es6/FrontApplet/Stream/StreamProtocol.d.ts +4 -0
- package/es6/FrontApplet/Stream/StreamProtocol.js +4 -0
- package/es6/FrontApplet/Stream/StreamProtocol.js.map +1 -1
- package/es6/FrontApplet/Stream/streamEventProperties.d.ts +11 -1
- package/es6/FrontApplet/Stream/streamEvents.d.ts +26 -0
- package/es6/FrontApplet/Video/IOptions.d.ts +41 -0
- package/es6/FrontApplet/Video/IVideoEvent.d.ts +8 -0
- package/es6/FrontApplet/Video/IVideoEvent.js.map +1 -1
- package/es6/FrontApplet/Video/IVideoProperties.d.ts +3 -0
- package/es6/FrontApplet/Video/Video.d.ts +256 -19
- package/es6/FrontApplet/Video/Video.js +258 -22
- package/es6/FrontApplet/Video/Video.js.map +1 -1
- package/es6/bundle.d.ts +14 -1
- package/es6/bundle.js +5 -16
- package/es6/bundle.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IVideoEvent.js","sourceRoot":"","sources":["../../../src/FrontApplet/Video/IVideoEvent.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IVideoEvent.js","sourceRoot":"","sources":["../../../src/FrontApplet/Video/IVideoEvent.ts"],"names":[],"mappings":";;;AAmBA,oCASC;AAED,sDAEC;AA1BY,QAAA,iBAAiB,GAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAapH,SAAgB,YAAY,CAAC,KAAkB;IAC9C,MAAM,kBAAkB,GAAG,qBAAqB,CAC/C,KAAK,CAAC,YAAY,CAAC,GAAG,EACtB,KAAK,CAAC,YAAY,CAAC,CAAC,EACpB,KAAK,CAAC,YAAY,CAAC,CAAC,EACpB,KAAK,CAAC,YAAY,CAAC,KAAK,EACxB,KAAK,CAAC,YAAY,CAAC,MAAM,CACzB,CAAC;IACF,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,kBAAkB,EAAE,CAAC;AAC9C,CAAC;AAED,SAAgB,qBAAqB,CAAC,GAAW,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,MAAc;IACrG,OAAO,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -4,13 +4,42 @@ import IVideo from './IVideo';
|
|
|
4
4
|
import IVideoEvent from './IVideoEvent';
|
|
5
5
|
import IVideoMessage from './IVideoMessage';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* We know how crucial video is for digital signage. So we made it easy. This guide will walk you through playing video using the sos.video API. This allows you to play video natively on any platform.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The `sos.video` provides you 4 methods to handle the playback:
|
|
10
|
+
* - `prepare()` - Prepare will load the video into memory and prepare it for immediate playback.
|
|
11
|
+
* - `play()` - This method loads the video into memory (if it hasn't been loaded previously) and starts the video playback.
|
|
12
|
+
* - `pause()` / `resume()` - This method pauses the video that was previously started to play, it is possible to resume the playback with `resume()`.
|
|
13
|
+
* - `stop()` - This method stops the playback and unloads the video from memory.
|
|
14
|
+
*
|
|
15
|
+
* :::warning Video identification
|
|
16
|
+
* First 5 parameters (uri, x, y, width, and height) are unique identifiers for playing the video using play, stop, resume, and pause methods.
|
|
11
17
|
* :::
|
|
12
18
|
*
|
|
13
|
-
*
|
|
19
|
+
* ## Gapless video playback
|
|
20
|
+
* It is often desirable to be able to play different videos consecutively without "black" frames. To achieve this next video in the queue needs to be loaded before the current video ends. How to achieve this may differ from platform to platform. Applet JS SDK handles this under the hood and provides you with `prepare()`, `play()` and `stop()` methods.
|
|
21
|
+
* Each video has to be pre-loaded with `prepare()` while the previous video is still playing, and after the video ends it should be unloaded immediately with `stop()`. This is because some (especially older ones) platforms support that only 2 videos are loaded into memory at any time (one playing and one ready to play).
|
|
22
|
+
*
|
|
23
|
+
* 
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const { filePath } = await sos.offline.cache.loadOrSaveFile(
|
|
27
|
+
* 'video-1.mp4',
|
|
28
|
+
* 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4',
|
|
29
|
+
* );
|
|
30
|
+
*
|
|
31
|
+
* const video = [filePath, 0, 0, 1280, 720];
|
|
32
|
+
*
|
|
33
|
+
* await sos.video.play(...video);
|
|
34
|
+
*
|
|
35
|
+
* // pause the video after 2s
|
|
36
|
+
* setTimeout(() => sos.video.pause(...video), 2000);
|
|
37
|
+
*
|
|
38
|
+
* // resume the paused video
|
|
39
|
+
* setTimeout(() => sos.video.resume(...video), 2500);
|
|
40
|
+
*
|
|
41
|
+
* // stop and unload the video
|
|
42
|
+
* setTimeout(() => sos.video.stop(...video), 4000);
|
|
14
43
|
*/
|
|
15
44
|
export default class Video implements IVideo {
|
|
16
45
|
private messagePrefix;
|
|
@@ -21,81 +50,289 @@ export default class Video implements IVideo {
|
|
|
21
50
|
/** @internal */
|
|
22
51
|
constructor(messagePrefix: string, postMessage: IPostMessage<void>);
|
|
23
52
|
/**
|
|
24
|
-
* The `play()` method starts the playback of a video previously prepared by `prepare()` method.
|
|
53
|
+
* The `play()` method starts the playback of a video or video that has been previously prepared by the `prepare()` method.
|
|
25
54
|
*
|
|
55
|
+
* @param uri Address to remote (online) or local video file
|
|
56
|
+
* @param x x-position for video on screen
|
|
57
|
+
* @param y y-position for video on screen
|
|
58
|
+
* @param width Video width on screen
|
|
59
|
+
* @param height Video height on screen
|
|
60
|
+
* @throws Error If the parameters are not valid.
|
|
61
|
+
* @throws Error If any error occurs during the playback of the video.
|
|
62
|
+
* @returns {Promise<void>} Returns a promise that resolves when the video starts playing.
|
|
26
63
|
* @since 1.0.3
|
|
64
|
+
*
|
|
65
|
+
* @example // {@link https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/video-loop-one | Play one video in infinite loop}
|
|
66
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/video-multiple | Play multiple videos in infinite loop}
|
|
67
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/video-and-images | Switching video and images in infinite loop}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const { filePath } = await sos.offline.cache.loadOrSaveFile('fileName', 'https://example.com/video.mp4');
|
|
71
|
+
* const video = [filePath, 0, 0, 1920, 1080];
|
|
72
|
+
* // Play the video
|
|
73
|
+
* await sos.video.play(...video);
|
|
27
74
|
*/
|
|
28
75
|
play(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
|
|
29
76
|
/**
|
|
30
|
-
* The `
|
|
31
|
-
*
|
|
32
|
-
* @param {boolean} options.4k Support for 4k video (Deprecated since Tizen Core App v2.1.0)
|
|
33
|
-
* @param options.background Bring video behind the applet html (similar to z-index: -1)
|
|
34
|
-
* @param options.volume Adjust volume of playing video itself (doesn't adjust display speaker volume)
|
|
77
|
+
* The `prepare()` method loads the video into memory and prepares it for a playback, this is useful for gapless playback.
|
|
35
78
|
*
|
|
79
|
+
* @param uri Address to remote (online) or local video file
|
|
80
|
+
* @param x x-position for video on screen
|
|
81
|
+
* @param y y-position for video on screen
|
|
82
|
+
* @param width Video width on screen
|
|
83
|
+
* @param height Video height on screen
|
|
84
|
+
* @param options Optional options for preparing the video.
|
|
85
|
+
* @param options.background If view should be prepared in background.
|
|
86
|
+
* @param options.volume Initial volume value of the video.
|
|
87
|
+
* @throws Error If the parameters are not valid.
|
|
88
|
+
* @throws Error If any error occurs during the preparation of the video.
|
|
89
|
+
* @returns {Promise<void>} Returns a promise which resolves when the video is prepared.
|
|
36
90
|
* @since 1.0.3
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Example of preparing and playing a video
|
|
94
|
+
* const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
|
|
95
|
+
* const video = [filePath, 0, 0, 1920, 1080];
|
|
96
|
+
* // Prepare the video
|
|
97
|
+
* await sos.video.prepare(...video);
|
|
98
|
+
* // Play the video
|
|
99
|
+
* await sos.video.play(...video);
|
|
37
100
|
*/
|
|
38
101
|
prepare(uri: string, x: number, y: number, width: number, height: number, options?: IOptions): Promise<void>;
|
|
39
102
|
/**
|
|
40
|
-
* The `stop()` method stops the video
|
|
103
|
+
* The `stop()` method stops the video; it can't be resumed with the `resume()` method.
|
|
41
104
|
*
|
|
105
|
+
* @param uri Address to remote (online) or local video file
|
|
106
|
+
* @param x x-position for video on screen
|
|
107
|
+
* @param y y-position for video on screen
|
|
108
|
+
* @param width Video width on screen
|
|
109
|
+
* @param height Video height on screen
|
|
110
|
+
* @returns {Promise<void>} Returns a promise which resolves when the video is stopped.
|
|
111
|
+
* @throws Error If the parameters are not valid.
|
|
112
|
+
* @throws Error If any error occurs during the stopping of the video.
|
|
42
113
|
* @since 1.0.3
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // Example of stopping a video
|
|
117
|
+
* const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
|
|
118
|
+
* const video = [filePath, 0, 0, 1920, 1080];
|
|
119
|
+
* // Prepare and play the video
|
|
120
|
+
* await sos.video.prepare(...video);
|
|
121
|
+
* await sos.video.play(...video);
|
|
122
|
+
* // Stop the video after 5 seconds
|
|
123
|
+
* setTimeout(() => sos.video.stop(...video), 5000);
|
|
43
124
|
*/
|
|
44
125
|
stop(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
|
|
45
126
|
/**
|
|
46
|
-
* The `pause()` method pauses the video
|
|
127
|
+
* The `pause()` method pauses the video; playback can be resumed with `resume()`. Stopped video can't be paused.
|
|
47
128
|
*
|
|
129
|
+
* @param uri Address to remote (online) or local video file
|
|
130
|
+
* @param x x-position for video on screen
|
|
131
|
+
* @param y y-position for video on screen
|
|
132
|
+
* @param width Video width on screen
|
|
133
|
+
* @param height Video height on screen
|
|
134
|
+
* @returns {Promise<void>} Returns a promise that resolves when the video is paused.
|
|
135
|
+
* @throws Error If the parameters are not valid.
|
|
136
|
+
* @throws Error If any error occurs during the pausing of the video.
|
|
48
137
|
* @since 1.0.3
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* // Example of resuming a paused video
|
|
141
|
+
* const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
|
|
142
|
+
* const video = [filePath, 0, 0, 1920, 1080];
|
|
143
|
+
* // Prepare the video
|
|
144
|
+
* await sos.video.prepare(...video);
|
|
145
|
+
* // Play the video
|
|
146
|
+
* await sos.video.play(...video);
|
|
147
|
+
* // Pause the video after 2 seconds
|
|
148
|
+
* setTimeout(() => sos.video.pause(...video), 2000);
|
|
49
149
|
*/
|
|
50
150
|
pause(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
|
|
51
151
|
/**
|
|
52
|
-
* The `resume()` method resumes the video paused by `pause()
|
|
152
|
+
* The `resume()` method resumes the video paused by `pause()` function. Stopped video can't be resumed.
|
|
53
153
|
*
|
|
154
|
+
* @param uri Address to remote (online) or local video file
|
|
155
|
+
* @param x x-position for video on screen
|
|
156
|
+
* @param y y-position for video on screen
|
|
157
|
+
* @param width Video width on screen
|
|
158
|
+
* @param height Video height on screen
|
|
159
|
+
* @returns {Promise<void>} Returns a promise that resolves when the video is resumed.
|
|
160
|
+
* @throws Error If the parameters are not valid.
|
|
161
|
+
* @throws Error If any error occurs during the resuming of the video.
|
|
54
162
|
* @since 1.0.3
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* // Example of resuming a paused video
|
|
166
|
+
* const { filePath } = await sos.offline.cache.loadOrSaveFile('video-1.mp4', 'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4');
|
|
167
|
+
* const video = [filePath, 0, 0, 1920, 1080];
|
|
168
|
+
* // Prepare the video
|
|
169
|
+
* await sos.video.prepare(...video);
|
|
170
|
+
* // Play the video
|
|
171
|
+
* await sos.video.play(...video);
|
|
172
|
+
* // Pause the video after 2 seconds
|
|
173
|
+
* setTimeout(() => sos.video.pause(...video), 2000);
|
|
174
|
+
* // Resume the video after 3 seconds
|
|
175
|
+
* setTimeout(() => sos.video.resume(...video), 5000);
|
|
55
176
|
*/
|
|
56
177
|
resume(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
|
|
57
178
|
/**
|
|
58
|
-
* The `onceEnded()` method returns a promise
|
|
179
|
+
* The `onceEnded()` method returns a promise that is resolved after the specified video ends.
|
|
59
180
|
*
|
|
181
|
+
* @param uri Address to remote (online) or local video file
|
|
182
|
+
* @param x x-position for video on screen
|
|
183
|
+
* @param y y-position for video on screen
|
|
184
|
+
* @param width Video width on screen
|
|
185
|
+
* @param height Video height on screen
|
|
186
|
+
* @returns {Promise<void>} Returns a promise that resolves when the video ends.
|
|
187
|
+
* @throws Error If the parameters are not valid.
|
|
188
|
+
* @throws Error If the video was not played yet.
|
|
60
189
|
* @since 1.0.29
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* // Example of using onceEnded to wait for a video to end
|
|
193
|
+
* await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
194
|
+
* while (true) {
|
|
195
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
196
|
+
* // Wait for the video to stop to start playing it again
|
|
197
|
+
* await sos.video.onceEnded('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
198
|
+
* }
|
|
61
199
|
*/
|
|
62
200
|
onceEnded(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
|
|
63
201
|
/**
|
|
64
|
-
* The `
|
|
202
|
+
* The `onceStop()` method returns a promise that is resolved after the specified video has been stopped.
|
|
65
203
|
*
|
|
204
|
+
* @param uri Address to remote (online) or local video file
|
|
205
|
+
* @param x x-position for video on screen
|
|
206
|
+
* @param y y-position for video on screen
|
|
207
|
+
* @param width Video width on screen
|
|
208
|
+
* @param height Video height on screen
|
|
209
|
+
* @returns {Promise<void>} Returns a promise that resolves when the video is stopped.
|
|
210
|
+
* @throws Error If the parameters are not valid.
|
|
211
|
+
* @throws Error If the video was not played yet.
|
|
66
212
|
* @since 1.0.29
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* // Example of using onceStop to wait for a video to stop
|
|
216
|
+
* await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
217
|
+
* while (true) {
|
|
218
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
219
|
+
* // Wait few seconds for the video to play
|
|
220
|
+
* await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
221
|
+
* // Stop the video and wait for it to stop
|
|
222
|
+
* await sos.video.stop('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
223
|
+
* await sos.video.onceStop('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
224
|
+
* // Now the video is stopped, and we can play it again
|
|
225
|
+
* }
|
|
67
226
|
*/
|
|
68
227
|
onceStop(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
|
|
69
228
|
/**
|
|
70
229
|
* The `onPlay()` method sets up a listener, which is called whenever a video starts to play.
|
|
230
|
+
*
|
|
231
|
+
* @param listener The listener function to be called when a play event occurs.
|
|
232
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
233
|
+
* @since 1.0.3
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* // Play a video and handle the play event
|
|
237
|
+
* await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
238
|
+
* sos.video.onPlay((event) => {
|
|
239
|
+
* console.log('Video started playing:', event);
|
|
240
|
+
* });
|
|
241
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
71
242
|
*/
|
|
72
243
|
onPlay(listener: (event: IVideoEvent) => void): void;
|
|
73
244
|
/**
|
|
74
|
-
* The `onPrepare()` method sets up a listener, which is called whenever a video
|
|
245
|
+
* The `onPrepare()` method sets up a listener, which is called whenever a video starts to be prepared.
|
|
246
|
+
*
|
|
247
|
+
* @param listener The listener function to be called when a prepare event occurs.
|
|
248
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
249
|
+
* @since 1.0.3
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* // Play a video and handle the prepare event
|
|
253
|
+
* await sos.video.prepare('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
254
|
+
* sos.video.onPrepare((event) => {
|
|
255
|
+
* console.log('Video prepared:', event);
|
|
256
|
+
* });
|
|
75
257
|
*/
|
|
76
258
|
onPrepare(listener: (event: IVideoEvent) => void): void;
|
|
77
259
|
/**
|
|
78
|
-
* The `onStop()` method sets up a listener, which is called whenever a video has been stopped.
|
|
260
|
+
* The `onStop()` method sets up a listener, which is called whenever a video has been stopped with `stop()` method.
|
|
261
|
+
*
|
|
262
|
+
* @param listener The listener function to be called when a stop event occurs.
|
|
263
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
264
|
+
* @since 1.0.3
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* // Play a video and handle the stop event
|
|
268
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
269
|
+
* sos.video.onStop((event) => {
|
|
270
|
+
* console.log('Video stopped:', event);
|
|
271
|
+
* });
|
|
272
|
+
* // Stop the video later...
|
|
273
|
+
* await sos.video.stop('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
79
274
|
*/
|
|
80
275
|
onStop(listener: (event: IVideoEvent) => void): void;
|
|
81
276
|
/**
|
|
82
|
-
* The `onPause()` method sets up a listener, which is called whenever a video is paused
|
|
277
|
+
* The `onPause()` method sets up a listener, which is called whenever a video is paused with `pause()` method.
|
|
278
|
+
*
|
|
279
|
+
* @param listener The listener function to be called when a pause event occurs.
|
|
280
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
281
|
+
* @since 1.0.3
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* // Play a video and handle the pause event
|
|
285
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
286
|
+
* sos.video.onPause((event) => {
|
|
287
|
+
* console.log('Video paused:', event); // Logs the pause event
|
|
288
|
+
* });
|
|
83
289
|
*/
|
|
84
290
|
onPause(listener: (event: IVideoEvent) => void): void;
|
|
85
291
|
/**
|
|
86
|
-
* The `onResume()` method sets up a listener, which is called whenever a video is resumed
|
|
292
|
+
* The `onResume()` method sets up a listener, which is called whenever a video is resumed with the `resume()` method.
|
|
293
|
+
*
|
|
294
|
+
* @param listener The listener function to be called when a resume event occurs.
|
|
295
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
296
|
+
* @since 1.0.3
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* // Play a video and handle the resume event
|
|
300
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
301
|
+
* sos.video.onResume((event) => {
|
|
302
|
+
* console.log('Video resumed:', event); // Logs the resume event
|
|
303
|
+
* });
|
|
304
|
+
* await sos.video.pause('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
305
|
+
* await sos.video.resume('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
87
306
|
*/
|
|
88
307
|
onResume(listener: (event: IVideoEvent) => void): void;
|
|
89
308
|
/**
|
|
90
309
|
* The `onEnded()` method sets up a listener, which is called whenever a video finished playing successfully.
|
|
91
310
|
*
|
|
311
|
+
* @param listener The listener function to be called when an ended event occurs.
|
|
312
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
92
313
|
* @since 1.0.3
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* // Play a video and handle the end of playback
|
|
317
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
318
|
+
* sos.video.onEnded((event) => {
|
|
319
|
+
* console.log('Video ended:', event);
|
|
320
|
+
* });
|
|
93
321
|
*/
|
|
94
322
|
onEnded(listener: (event: IVideoEvent) => void): void;
|
|
95
323
|
/**
|
|
96
324
|
* The `onError()` method sets up a listener, which is called whenever a video failed to finish playing.
|
|
97
325
|
*
|
|
326
|
+
* @param listener The listener function to be called when an error occurs.
|
|
327
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
98
328
|
* @since 1.0.3
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* // Play a video and handle errors
|
|
332
|
+
* await sos.video.play('https://example.com/video.mp4', 0, 0, 1920, 1080);
|
|
333
|
+
* sos.video.onError((event) => {
|
|
334
|
+
* console.error('Video error:', event);
|
|
335
|
+
* });
|
|
99
336
|
*/
|
|
100
337
|
onError(listener: (event: IVideoEvent) => void): void;
|
|
101
338
|
/** @internal */
|