next method
Future<void>
next(
{ - bool synchronized = true,
})
override
Jumps to next Media in the Player's playlist.
Implementation
@override
Future<void> next({bool synchronized = true}) {
Future<void> function() async {
if (disposed) {
throw AssertionError('[Player] has been disposed');
}
await waitForPlayerInitialization;
await waitForVideoControllerInitializationIfAttached;
// Do nothing if currently present at the first or last index & playlist mode is [PlaylistMode.none] or [PlaylistMode.single].
if ([
PlaylistMode.none,
PlaylistMode.single,
].contains(state.playlistMode) &&
state.playlist.index == state.playlist.medias.length - 1) {
return;
}
await play(synchronized: false);
final command = 'playlist-next'.toNativeUtf8();
mpv.mpv_command_string(
ctx,
command.cast(),
);
calloc.free(command);
}
if (synchronized) {
return lock.synchronized(function);
} else {
return function();
}
}