jump method
Future<void>
jump(
- int index, {
- bool synchronized = true,
})
override
Jumps to specified Media's index in the Player's playlist.
Implementation
@override
Future<void> jump(int index, {bool synchronized = true}) {
Future<void> function() async {
if (disposed) {
throw AssertionError('[Player] has been disposed');
}
await waitForPlayerInitialization;
await waitForVideoControllerInitializationIfAttached;
await play(synchronized: false);
final name = 'playlist-pos'.toNativeUtf8();
final value = calloc<Int64>()..value = index;
mpv.mpv_set_property(
ctx,
name.cast(),
generated.mpv_format.MPV_FORMAT_INT64,
value.cast(),
);
calloc.free(name);
calloc.free(value);
}
if (synchronized) {
return lock.synchronized(function);
} else {
return function();
}
}