@signageos/front-applet 8.1.1 → 8.1.3

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.
Files changed (74) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/bundle.js.map +1 -1
  3. package/docs/sos/browser.md +66 -14
  4. package/docs/sos/command.md +52 -6
  5. package/docs/sos/debug.md +17 -2
  6. package/docs/sos/deviceInfo.md +27 -0
  7. package/docs/sos/display.md +34 -3
  8. package/docs/sos/fileSystem.md +1135 -59
  9. package/docs/sos/index.md +36 -12
  10. package/docs/sos/input.md +42 -1
  11. package/docs/sos/native/mdc.md +65 -19
  12. package/docs/sos/offline/cache.md +14 -8
  13. package/docs/sos/stream.md +1172 -37
  14. package/docs/sos/sync.md +2 -2
  15. package/docs/sos/video.md +515 -22
  16. package/docs/sos_management/security.md +4 -2
  17. package/docs/sos_management/wifi.md +9 -9
  18. package/es6/FrontApplet/Browser/Browser.d.ts +25 -9
  19. package/es6/FrontApplet/Browser/Browser.js +25 -9
  20. package/es6/FrontApplet/Browser/Browser.js.map +1 -1
  21. package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +7 -0
  22. package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
  23. package/es6/FrontApplet/Browser/events.d.ts +6 -0
  24. package/es6/FrontApplet/Browser/events.js.map +1 -1
  25. package/es6/FrontApplet/Command/Command.d.ts +15 -6
  26. package/es6/FrontApplet/Command/Command.js +15 -6
  27. package/es6/FrontApplet/Command/Command.js.map +1 -1
  28. package/es6/FrontApplet/Command/ICommand.d.ts +7 -0
  29. package/es6/FrontApplet/Command/ICommandEvent.d.ts +6 -0
  30. package/es6/FrontApplet/Debug/Debug.d.ts +11 -3
  31. package/es6/FrontApplet/Debug/Debug.js +11 -3
  32. package/es6/FrontApplet/Debug/Debug.js.map +1 -1
  33. package/es6/FrontApplet/DeviceInfo/DeviceInfo.d.ts +15 -0
  34. package/es6/FrontApplet/DeviceInfo/DeviceInfo.js +16 -2
  35. package/es6/FrontApplet/DeviceInfo/DeviceInfo.js.map +1 -1
  36. package/es6/FrontApplet/Display/Display.d.ts +22 -14
  37. package/es6/FrontApplet/Display/Display.js +22 -14
  38. package/es6/FrontApplet/Display/Display.js.map +1 -1
  39. package/es6/FrontApplet/Display/IDisplay.d.ts +4 -0
  40. package/es6/FrontApplet/FileSystem/FileSystem.d.ts +429 -41
  41. package/es6/FrontApplet/FileSystem/FileSystem.js +427 -39
  42. package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
  43. package/es6/FrontApplet/FileSystem/HashAlgorithm.d.ts +4 -1
  44. package/es6/FrontApplet/FileSystem/types.d.ts +46 -0
  45. package/es6/FrontApplet/FileSystem/types.js.map +1 -1
  46. package/es6/FrontApplet/FrontApplet.d.ts +31 -7
  47. package/es6/FrontApplet/FrontApplet.js +32 -8
  48. package/es6/FrontApplet/FrontApplet.js.map +1 -1
  49. package/es6/FrontApplet/Input/IKeyUpEvent.d.ts +9 -0
  50. package/es6/FrontApplet/Input/IKeyUpEvent.js +6 -0
  51. package/es6/FrontApplet/Input/IKeyUpEvent.js.map +1 -1
  52. package/es6/FrontApplet/Input/Input.d.ts +17 -1
  53. package/es6/FrontApplet/Input/Input.js +17 -1
  54. package/es6/FrontApplet/Input/Input.js.map +1 -1
  55. package/es6/FrontApplet/NativeCommands/MDC/Mdc.d.ts +32 -11
  56. package/es6/FrontApplet/NativeCommands/MDC/Mdc.js +14 -11
  57. package/es6/FrontApplet/NativeCommands/MDC/Mdc.js.map +1 -1
  58. package/es6/FrontApplet/Stream/IStreamTrackInfo.d.ts +34 -0
  59. package/es6/FrontApplet/Stream/Stream.d.ts +245 -20
  60. package/es6/FrontApplet/Stream/Stream.js +245 -20
  61. package/es6/FrontApplet/Stream/Stream.js.map +1 -1
  62. package/es6/FrontApplet/Stream/StreamProtocol.d.ts +4 -0
  63. package/es6/FrontApplet/Stream/StreamProtocol.js +4 -0
  64. package/es6/FrontApplet/Stream/StreamProtocol.js.map +1 -1
  65. package/es6/FrontApplet/Stream/streamEventProperties.d.ts +11 -1
  66. package/es6/FrontApplet/Stream/streamEvents.d.ts +26 -0
  67. package/es6/FrontApplet/Video/IOptions.d.ts +41 -0
  68. package/es6/FrontApplet/Video/IVideoEvent.d.ts +8 -0
  69. package/es6/FrontApplet/Video/IVideoEvent.js.map +1 -1
  70. package/es6/FrontApplet/Video/IVideoProperties.d.ts +3 -0
  71. package/es6/FrontApplet/Video/Video.d.ts +256 -19
  72. package/es6/FrontApplet/Video/Video.js +258 -22
  73. package/es6/FrontApplet/Video/Video.js.map +1 -1
  74. package/package.json +1 -1
@@ -1,12 +1,40 @@
1
+ /**
2
+ * Available track types for media streams.
3
+ */
1
4
  export type TrackType = 'TEXT' | 'AUDIO' | 'VIDEO';
2
5
  export type ITrackInfo = ITrackVideoInfo | ITrackAudioInfo | ITrackTextInfo;
6
+ /**
7
+ * Interface representing stream track information.
8
+ */
3
9
  export interface ITrack<T extends TrackType> {
10
+ /**
11
+ * Type of the track, e.g., "VIDEO", "AUDIO", "TEXT".
12
+ */
4
13
  trackType: T;
14
+ /**
15
+ * MIME type of the track, e.g., "video/mp4", "audio/mp3", "text/vtt".
16
+ */
5
17
  mimeType: string;
18
+ /**
19
+ * Unique identifier for the track group.
20
+ * This is used to group tracks of the same type (e.g., multiple audio tracks).
21
+ */
6
22
  groupId: string;
23
+ /**
24
+ * Unique identifier for the track.
25
+ */
7
26
  trackIndex: number;
27
+ /**
28
+ * If the track is selected for playback.
29
+ */
8
30
  selected: boolean;
31
+ /**
32
+ * Selected language of subtitles or captions.
33
+ */
9
34
  language: string | null;
35
+ /**
36
+ * If the track is supported by the device.
37
+ */
10
38
  supported: boolean;
11
39
  }
12
40
  export interface ITrackVideoInfo extends ITrack<'VIDEO'> {
@@ -16,8 +44,14 @@ export interface ITrackVideoInfo extends ITrack<'VIDEO'> {
16
44
  };
17
45
  }
18
46
  export interface ITrackAudioInfo extends ITrack<'AUDIO'> {
47
+ /**
48
+ * Number of audio channels.
49
+ */
19
50
  channelCount: number;
20
51
  }
21
52
  export interface ITrackTextInfo extends ITrack<'TEXT'> {
53
+ /**
54
+ * Selected subtitles or captions.
55
+ */
22
56
  selection: string[];
23
57
  }
@@ -7,20 +7,22 @@ import type { ITrackInfo, TrackType } from './IStreamTrackInfo';
7
7
  import { IStreamErrorEvent, IStreamEvent, IStreamTracksChangedEvent } from './streamEvents';
8
8
  import StreamProtocol from './StreamProtocol';
9
9
  /**
10
- * The `sos.video` API groups together methods for streaming videos.
10
+ * The `sos.stream` API groups together methods for streaming videos from different sources. There are various methods for preparing, playing, stopping, pausing, and resuming streams.
11
11
  *
12
- * :::warning
12
+ * Streams are identified by their URI and their position on the screen (x, y, width, height).
13
+ *
14
+ * This API allows you to play video stream from:
15
+ * - URL (e.g., HTTP, RTSP, RTP, UDP, RTMP)
16
+ * - HDMI (e.g., Picture-in-Picture, Internal ports) streams
13
17
  *
18
+ * :::warning
14
19
  * Are you using **Samsung Tizen** to play streams? Read more about limitation and
15
20
  * [Tizen-specific details](https://docs.signageos.io/hc/en-us/articles/4405387373458).
16
- *
17
21
  * :::
18
22
  *
19
23
  * :::danger
20
- *
21
24
  * Be aware version of JS API (v6.0.0+) changed how stream functions `play()` and `prepare()` work. For using an options object you need to
22
25
  * our latest core app versions. If you are using older core app versions, you need to use deprecated format.
23
- *
24
26
  * :::
25
27
  */
26
28
  export default class Stream implements IStream {
@@ -31,113 +33,336 @@ export default class Stream implements IStream {
31
33
  /** @internal */
32
34
  constructor(messagePrefix: string, postMessage: IPostMessage<any>);
33
35
  /**
34
- * The `prepare()` method prepares the stream in the background.
36
+ * Calls the internal player and prepares a video stream in memory, so it can later start playing instantaneously.
35
37
  *
36
38
  * :::info
37
- *
38
39
  * 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.
39
- *
40
40
  * :::
41
41
  *
42
+ * @param uri Network address where the stream is available.
43
+ * @param x Stream x-position on the screen
44
+ * @param y Stream y-position on the screen
45
+ * @param width Stream width on the screen
46
+ * @param height Stream height on the screen
47
+ * @param options Additional options for the stream
48
+ *
49
+ * @returns {Promise<void>} Returns a promise that resolves when the stream is prepared.
50
+ * @throws AppletStreamError If the protocol is not a string or if the parameters are invalid.
51
+ * @throws Error If parameters are invalid.
52
+ * @throws Error If device fail to prepare the stream.
42
53
  * @since 4.7.0
43
54
  *
44
- * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream}
55
+ * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream | How to create video Applet with for streams}
56
+ * @example
57
+ * // Example with specific protocol type
58
+ * await sos.stream.prepare(uri, x, y, width, height, { protocol: 'HTTP' });
59
+ *
60
+ * // Example with options - prepare stream in the background
61
+ * await sos.stream.prepare(uri, x, y, width, height, { protocol: 'HTTP', background: true });
62
+ *
63
+ * // Deprecated format
64
+ * await sos.stream.prepare(uri, x, y, width, height, 'HTTP');
45
65
  */
46
66
  prepare(uri: string, x: number, y: number, width: number, height: number, options?: IStreamPrepareOptions | keyof typeof StreamProtocol): Promise<void>;
47
67
  /**
48
- * The `play()` method starts the streaming of a streaming previously prepared by `prepare()` method.
68
+ * The `play()` method starts the video stream based by uri or stream which was prepared by `prepare()` method.
69
+ *
70
+ * :::note Internal ports
71
+ * This method use same functionality, instead of URL (for stream), specify a URI of the port to display.
72
+ *
73
+ * | Port URI value | Description |
74
+ * |-----------------|-------------|
75
+ * | `internal://hdmi<number>` | HDMI |
76
+ * | `internal://dp` | DisplayPort |
77
+ * | `internal://dvi` | DVI |
78
+ * | `internal://pc` | PC or VGA |
79
+ *
80
+ * `<number>` has to be a value between 1 - 4, depending on which of the available HDMI ports you want to use.
81
+ * :::
49
82
  *
83
+ * @param uri Network address where the stream is available.
84
+ * @param x Stream x-position on the screen
85
+ * @param y Stream y-position on the screen
86
+ * @param width Stream width on the screen
87
+ * @param height Stream height on the screen
88
+ * @param options Additional options for the stream
89
+ *
90
+ * @returns {Promise<void>} Returns a promise that resolves when the stream is successfully started.
91
+ * @throws AppletStreamError If the protocol is not a string or if the parameters are invalid.
92
+ * @throws Error If parameters are invalid.
93
+ * @throws Error If the device fails to prepare the stream.
50
94
  * @since 1.0.18
95
+ *
96
+ * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream | How to create video Applet with for URL streams}
97
+ * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream-hdmi-port | How to create video Applet with HDMI port}
98
+ * @example
99
+ * // Example with specific protocol type
100
+ * await sos.stream.play(uri, x, y, width, height, { protocol: 'HTTP' });
101
+ *
102
+ * // Example with options - reconnect stream when it disconnects after 60 seconds
103
+ * await sos.stream.play(uri, x, y, width, height, { protocol: 'HTTP', autoReconnect: true, autoReconnectInterval: 60000 });
104
+ *
105
+ * // Example for playing HDMI port
106
+ * await sos.stream.play('internal://hdmi1', 0, 0, 1920, 1080, { protocol: 'RTP' });
51
107
  */
52
108
  play(uri: string, x: number, y: number, width: number, height: number, options?: IStreamOptions | keyof typeof StreamProtocol): Promise<void>;
53
109
  /**
54
- * The `stop()` method stops the stream, it can't be resumed with `resume()`.
110
+ * The `stop()` method stops the active stream, it can't be later resumed with `resume()`.
55
111
  *
112
+ * @param uri Network address where the stream is available.
113
+ * @param x Stream x-position on the screen
114
+ * @param y Stream y-position on the screen
115
+ * @param width Stream width on the screen
116
+ * @param height Stream height on the screen
117
+ * @returns {Promise<void>} Returns a promise that resolves when the stream is stopped.
118
+ * @throws Error If parameters are invalid.
56
119
  * @since 1.0.18
120
+ *
121
+ * @example
122
+ * // Example of stopping an active stream
123
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080); // Start
124
+ * // ... after some time
125
+ * await sos.stream.stop('http://example.com/stream', 0, 0, 1920, 1080); // Stop
57
126
  */
58
127
  stop(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
59
128
  /**
60
- * The `pause()` method pauses the stream, it can be resumed with `resume()`.
129
+ * The `pause()` method pauses the active stream, it can be resumed with `resume()`.
61
130
  *
131
+ * @param uri Network address where the stream is available.
132
+ * @param x Stream x-position on the screen
133
+ * @param y Stream y-position on the screen
134
+ * @param width Stream width on the screen
135
+ * @param height Stream height on the screen
136
+ * @returns {Promise<void>} Returns a promise that resolves when the stream is paused.
137
+ * @throws Error If parameters are invalid.
62
138
  * @since 6.4.0
139
+ *
140
+ * @example
141
+ * // Example of pausing an active stream
142
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080); // Start
143
+ * // ... after some time
144
+ * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080); // Pause
63
145
  */
64
146
  pause(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
65
147
  /**
66
- * The `resume()` method resumes the stream paused by `pause()`.
148
+ * The `resume()` method resumes the paused stream by `pause()` function.
67
149
  *
150
+ * @param uri Network address where the stream is available.
151
+ * @param x Stream x-position on the screen
152
+ * @param y Stream y-position on the screen
153
+ * @param width Stream width on the screen
154
+ * @param height Stream height on the screen
155
+ * @returns {Promise<void>} Returns a promise that resolves when the stream is successfully resumed.
156
+ * @throws Error If parameters are invalid.
68
157
  * @since 6.4.0
158
+ *
159
+ * @example
160
+ * // Example of resuming a paused stream
161
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080); // Start
162
+ * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080); // Pause
163
+ * // ... after some time
164
+ * await sos.stream.resume('http://example.com/stream', 0, 0, 1920, 1080); // Resume
69
165
  */
70
166
  resume(uri: string, x: number, y: number, width: number, height: number): Promise<void>;
71
167
  /**
72
- * The `getTracks()` method returns a track list of a stream.
168
+ * The `getTracks()` method returns a list of subtitles, video, and audio tracks of a stream.
73
169
  *
170
+ * @param videoId The video properties of the stream to get tracks for.
171
+ * @returns {Promise<ITrackInfo[]>} Returns array of object with information about subtitles, video, and audio tracks.
74
172
  * @since 6.1.0
173
+ *
174
+ * @example
175
+ * // Example of getting tracks for a stream
176
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
177
+ * const tracks = await sos.stream.getTracks(streamId);
178
+ * console.log(tracks); // Outputs an array of track information
75
179
  */
76
180
  getTracks(videoId: IVideoProperties): Promise<ITrackInfo[]>;
77
181
  /**
78
- * The `selectTrack()` method selects a track of a stream.
182
+ * The `selectTrack()` method selects a text (subtitles), video or audio track of a stream.
79
183
  *
184
+ * @param videoId The video properties of the stream to select track for.
185
+ * @param trackType The type of the track to select (e.g., 'TEXT', 'AUDIO', 'VIDEO').
186
+ * @param groupId The group ID of the track to select.
187
+ * @param trackIndex The index of the track to select within the group.
188
+ * @throws Error If parameters are invalid or if the track type is not supported.
189
+ * @returns {Promise<void>} Resolves when the track is successfully selected.
80
190
  * @since 6.1.0
191
+ *
192
+ * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/stream-subtitles | How to set subtitles for a stream}
193
+ *
194
+ * @example
195
+ * // Example of selecting a track for a stream
196
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
197
+ *
198
+ * // Select the first audio track in the group with ID 'audioGroup1'
199
+ * await sos.stream.selectTrack(videoId, 'AUDIO', 'audioGroup1', 0);
200
+ * // Select the first text track in the group with ID 'subtitlesGroup1'
201
+ * await sos.stream.selectTrack(videoId, 'TEXT', 'subtitlesGroup1', 0);
202
+ * // Select the first video track in the group with ID 'videoGroup1'
203
+ * await sos.stream.selectTrack(videoId, 'VIDEO', 'videoGroup1', 0);
81
204
  */
82
205
  selectTrack(videoId: IVideoProperties, trackType: TrackType, groupId: string, trackIndex: number): Promise<void>;
83
206
  /**
84
- * The `resetTrack()` method resets a track of a stream.
207
+ * The `resetTrack()` method resets a selected track of a stream.
208
+ *
209
+ * @param videoId The video properties of the stream to reset track for.
210
+ * @param trackType The type of the track to reset (e.g., 'TEXT', 'AUDIO', 'VIDEO').
211
+ * @param groupId The group ID of the track to reset. If not provided, the first track in the group will be reset.
212
+ * @throws Error If parameters are invalid or if the track type is not supported.
213
+ * @returns {Promise<void>} Resolves when the track is successfully reset.
85
214
  *
86
215
  * @since 6.1.0
216
+ *
217
+ * @example
218
+ * // Example of resetting a track for a stream
219
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
220
+ * // Reset the audio track in the group with ID 'audioGroup1'
221
+ * await sos.stream.resetTrack(videoId, 'AUDIO', 'audioGroup1');
87
222
  */
88
223
  resetTrack(videoId: IVideoProperties, trackType: TrackType, groupId?: string): Promise<void>;
89
224
  /**
90
- * The `onTracksChanged()` method sets up a listener, which is called whenever a track is changed.
225
+ * The `onTracksChanged()` method sets up a listener, which is called whenever a track is changed
226
+ * from functions `selectTrack()` or `resetTrack()`.
91
227
  *
228
+ * @param listener The listener function to be called when the event occurs.
229
+ * @returns {void} Resolves when the listener is successfully set up.
92
230
  * @since 6.1.0
231
+ *
232
+ * @example
233
+ * // Example of setting up a listener with starting a stream and selecting a track
234
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
235
+ * await sos.stream.selectTrack(videoId, 'AUDIO', 'audioGroup1', 0);
236
+ *
237
+ * // Create the listener for tracks changed event
238
+ * sos.stream.onTracksChanged((event) => {
239
+ * console.log('Track type:', event.tracks[0].trackType); // AUDIO
240
+ * console.log('Track group ID:', event.tracks[0].groupId); // audioGroup1
241
+ * console.log('Track index:', event.tracks[0].trackIndex); // 0
242
+ * });
93
243
  */
94
244
  onTracksChanged(listener: (event: IStreamTracksChangedEvent) => void): void;
95
245
  /**
96
- * The `onTracksChanged()` method sets up a listener, which is called whenever an unexpected error occurs during a stream.
246
+ * The `onError()` method sets up a listener, which is called whenever an unexpected error occurs during a stream.
97
247
  *
248
+ * @param listener The listener function to be called when the event occurs.
249
+ * @returns {void} Resolves when the listener is successfully set up.
98
250
  * @since 1.0.20
251
+ *
252
+ * @example
253
+ * // Example of setting up a listener for the error event
254
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
255
+ * sos.stream.onError((event) => {
256
+ * console.error('Stream error:', event.errorMessage);
257
+ * });
99
258
  */
100
259
  onError(listener: (event: IStreamErrorEvent) => void): void;
101
260
  /**
102
261
  * The `onConnected()` method sets up a listener, which is called whenever a stream is connected.
103
262
  *
263
+ * @param listener The listener function to be called when the event occurs.
264
+ * @returns {void} Resolves when the listener is successfully set up.
104
265
  * @since 1.0.20
266
+ *
267
+ * @example
268
+ * // Example of setting up a listener for the connected event
269
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
270
+ * sos.stream.onConnected((event) => {
271
+ * console.log('Stream connected:', event.srcArguments.uri);
272
+ * });
105
273
  */
106
274
  onConnected(listener: (event: IStreamEvent<'connected'>) => void): void;
107
275
  /**
108
276
  * The `onDisconnected()` method sets up a listener, which is called whenever a stream gets disconnected.
277
+ * Usually when source URI is not available anymore or when the stream is stopped.
109
278
  *
279
+ * @param listener The listener function to be called when the event occurs.
280
+ * @returns {void} Resolves when the listener is successfully set up.
110
281
  * @since 1.0.20
282
+ *
283
+ * @example
284
+ * // Example of setting up a listener for the disconnected event
285
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
286
+ * sos.stream.onDisconnected((event) => {
287
+ * console.log('Stream disconnected:', event.srcArguments.uri);
288
+ * });
111
289
  */
112
290
  onDisconnected(listener: (event: IStreamEvent<'disconnected'>) => void): void;
113
291
  /**
114
292
  * The `onPrepare()` method sets up a listener, which is called whenever a stream gets prepared.
115
293
  *
294
+ * @param listener The listener function to be called when the event occurs.
295
+ * @returns {void} Resolves when the listener is successfully set up.
116
296
  * @since 5.12.0
297
+ *
298
+ * @example
299
+ * // Example of setting up a listener for the prepare event
300
+ * await sos.stream.prepare('http://example.com/stream', 0, 0, 1920, 1080);
301
+ * sos.stream.onPrepare((event) => {
302
+ * console.log('Stream prepared:', event.srcArguments.uri);
303
+ * });
117
304
  */
118
305
  onPrepare(listener: (event: IStreamEvent<'prepare'>) => void): void;
119
306
  /**
120
307
  * The `onPlay()` method sets up a listener, which is called whenever a stream starts playing.
121
308
  *
309
+ * @param listener The listener function to be called when the event occurs.
310
+ * @returns {void} Resolves when the listener is successfully set up.
122
311
  * @since 5.12.0
312
+ *
313
+ * @example
314
+ * // Example of setting up a listener for the play event
315
+ * await sos.stream.play('http://example.com/stream', 0, 0, 1920, 1080);
316
+ * sos.stream.onPlay((event) => {
317
+ * console.log('Stream started playing:', event.srcArguments.uri);
318
+ * });
123
319
  */
124
320
  onPlay(listener: (event: IStreamEvent<'play'>) => void): void;
125
321
  /**
126
322
  * The `onStop()` method sets up a listener, which is called whenever a stream stops.
127
323
  *
324
+ * @param listener The listener function to be called when the event occurs.
325
+ * @returns {void} Resolves when the listener is successfully set up.
128
326
  * @since 5.12.0
327
+ *
328
+ * @example
329
+ * // Example of setting up a listener for the stop event
330
+ * await sos.stream.stop('http://example.com/stream', 0, 0, 1920, 1080);
331
+ * sos.stream.onStop((event) => {
332
+ * console.log('Stream stopped:', event.srcArguments.uri);
333
+ * });
129
334
  */
130
335
  onStop(listener: (event: IStreamEvent<'stop'>) => void): void;
131
336
  /**
132
- * The `onStop()` method sets up a listener, which is called whenever a stream is paused.
337
+ * The `onPause()` method sets up a listener, which is called whenever a stream is paused.
133
338
  *
339
+ * @param listener The listener function to be called when the event occurs.
340
+ * @returns {void} Resolves when the listener is successfully set up.
134
341
  * @since 5.12.0
342
+ *
343
+ * @example
344
+ * // Example of setting up a listener for the pause event
345
+ * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080);
346
+ * sos.stream.onPause((event) => {
347
+ * console.log('Stream paused:', event.srcArguments.uri);
348
+ * });
135
349
  */
136
350
  onPause(listener: (event: IStreamEvent<'pause'>) => void): void;
137
351
  /**
138
- * The `onStop()` method sets up a listener, which is called whenever a stream is resumed.
352
+ * The `onResume()` method sets up a listener, which is called whenever a stream is resumed.
139
353
  *
354
+ * @param listener The listener function to be called when the event occurs.
355
+ * @returns {void} Resolves when the listener is successfully set up.
140
356
  * @since 5.12.0
357
+ *
358
+ * @example
359
+ * // Example of setting up a listener for the resume event
360
+ * await sos.stream.pause('http://example.com/stream', 0, 0, 1920, 1080); // Pause the stream
361
+ * // ... after some time
362
+ * await sos.stream.resume('http://example.com/stream', 0, 0, 1920, 1080);
363
+ * sos.stream.onResume((event) => {
364
+ * console.log('Stream resumed:', event.srcArguments.uri);
365
+ * });
141
366
  */
142
367
  onResume(listener: (event: IStreamEvent<'resume'>) => void): void;
143
368
  /** @internal */