@@ -154,18 +154,33 @@ class Player {
154
154
PlayerFFI .open (
155
155
this .id,
156
156
autoStart ? 1 : 0 ,
157
- < String > [source.mediaType.toString (), source.resource]
158
- .toNativeUtf8Array (),
157
+ < String > [
158
+ source.mediaType.toString (),
159
+ source.resource,
160
+ source.startTime.argument ('start-time' ),
161
+ source.stopTime.argument ('stop-time' ),
162
+ ].toNativeUtf8Array (),
159
163
1 );
160
164
}
161
165
if (source is Playlist ) {
162
166
List <String > medias = < String > [];
163
167
source.medias.forEach ((media) {
164
- medias.add (media.mediaType.toString ());
165
- medias.add (media.resource);
168
+ medias.addAll (
169
+ < String > [
170
+ media.mediaType.toString (),
171
+ media.resource,
172
+ media.startTime.argument ('start-time' ),
173
+ media.stopTime.argument ('stop-time' ),
174
+ ],
175
+ );
166
176
});
167
- PlayerFFI .open (this .id, autoStart ? 1 : 0 , medias.toNativeUtf8Array (),
168
- source.medias.length);
177
+ print (medias);
178
+ PlayerFFI .open (
179
+ this .id,
180
+ autoStart ? 1 : 0 ,
181
+ medias.toNativeUtf8Array (),
182
+ source.medias.length,
183
+ );
169
184
}
170
185
}
171
186
@@ -206,54 +221,86 @@ class Player {
206
221
/// Jumps to [Media] at specific index in the [Playlist] opened.
207
222
/// Pass index as parameter.
208
223
void jump (int index) {
209
- PlayerFFI .jump (this .id, index);
224
+ PlayerFFI .jump (
225
+ this .id,
226
+ index,
227
+ );
210
228
}
211
229
212
230
/// Seeks the [Media] currently playing in the [Player] instance, to the provided [Duration] .
213
231
void seek (Duration duration) {
214
- PlayerFFI .seek (this .id, duration.inMilliseconds);
232
+ PlayerFFI .seek (
233
+ this .id,
234
+ duration.inMilliseconds,
235
+ );
215
236
}
216
237
217
238
/// Sets volume of the [Player] instance.
218
239
void setVolume (double volume) {
219
- PlayerFFI .setVolume (this .id, volume);
240
+ PlayerFFI .setVolume (
241
+ this .id,
242
+ volume,
243
+ );
220
244
}
221
245
222
246
/// Sets playback rate of the [Media] currently playing in the [Player] instance.
223
247
void setRate (double rate) {
224
- PlayerFFI .setRate (this .id, rate);
248
+ PlayerFFI .setRate (
249
+ this .id,
250
+ rate,
251
+ );
225
252
}
226
253
227
254
/// Sets user agent for dart_vlc player.
228
255
void setUserAgent (String userAgent) {
229
- PlayerFFI .setUserAgent (this .id, userAgent.toNativeUtf8 ());
256
+ PlayerFFI .setUserAgent (
257
+ this .id,
258
+ userAgent.toNativeUtf8 (),
259
+ );
230
260
}
231
261
232
262
/// Changes [Playlist] playback mode.
233
263
void setPlaylistMode (PlaylistMode playlistMode) {
234
- PlayerFFI .setPlaylistMode (this .id, playlistMode.toString ().toNativeUtf8 ());
264
+ PlayerFFI .setPlaylistMode (
265
+ this .id,
266
+ playlistMode.toString ().toNativeUtf8 (),
267
+ );
235
268
}
236
269
237
270
/// Appends [Media] to the [Playlist] of the [Player] instance.
238
271
void add (Media source) {
239
- PlayerFFI .add (this .id, source.mediaType.toString ().toNativeUtf8 (),
240
- source.resource.toString ().toNativeUtf8 ());
272
+ PlayerFFI .add (
273
+ this .id,
274
+ source.mediaType.toString ().toNativeUtf8 (),
275
+ source.resource.toString ().toNativeUtf8 (),
276
+ );
241
277
}
242
278
243
279
/// Removes [Media] from the [Playlist] at a specific index.
244
280
void remove (int index) {
245
- PlayerFFI .remove (this .id, index);
281
+ PlayerFFI .remove (
282
+ this .id,
283
+ index,
284
+ );
246
285
}
247
286
248
287
/// Inserts [Media] to the [Playlist] of the [Player] instance at specific index.
249
288
void insert (int index, Media source) {
250
- PlayerFFI .insert (this .id, index, source.mediaType.toString ().toNativeUtf8 (),
251
- source.resource.toString ().toNativeUtf8 ());
289
+ PlayerFFI .insert (
290
+ this .id,
291
+ index,
292
+ source.mediaType.toString ().toNativeUtf8 (),
293
+ source.resource.toString ().toNativeUtf8 (),
294
+ );
252
295
}
253
296
254
297
/// Moves [Media] already present in the [Playlist] of the [Player] from [initialIndex] to [finalIndex] .
255
298
void move (int initialIndex, int finalIndex) {
256
- PlayerFFI .move (this .id, initialIndex, finalIndex);
299
+ PlayerFFI .move (
300
+ this .id,
301
+ initialIndex,
302
+ finalIndex,
303
+ );
257
304
}
258
305
259
306
/// Sets playback [Device] for the instance of [Player] .
@@ -265,7 +312,10 @@ class Player {
265
312
///
266
313
void setDevice (Device device) {
267
314
PlayerFFI .setDevice (
268
- this .id, device.id.toNativeUtf8 (), device.name.toNativeUtf8 ());
315
+ this .id,
316
+ device.id.toNativeUtf8 (),
317
+ device.name.toNativeUtf8 (),
318
+ );
269
319
}
270
320
271
321
/// Sets [Equalizer] for the [Player] .
@@ -275,7 +325,12 @@ class Player {
275
325
276
326
/// Saves snapshot of a video to a desired [File] location.
277
327
void takeSnapshot (File file, int width, int height) {
278
- PlayerFFI .takeSnapshot (this .id, file.path.toNativeUtf8 (), width, height);
328
+ PlayerFFI .takeSnapshot (
329
+ this .id,
330
+ file.path.toNativeUtf8 (),
331
+ width,
332
+ height,
333
+ );
279
334
}
280
335
281
336
/// Destroys the instance of [Player] & closes all [StreamController] s in it.
0 commit comments