add method
Appends a Media to the Player's playlist.
Implementation
@override
Future<void> add(Media media, {bool synchronized = true}) {
Future<void> function() async {
if (disposed) {
throw AssertionError('[Player] has been disposed');
}
await waitForPlayerInitialization;
await waitForVideoControllerInitializationIfAttached;
// Keep this [Media] object in memory.
current.add(media);
final command = 'loadfile ${media.uri} append'.toNativeUtf8();
mpv.mpv_command_string(
ctx,
command.cast(),
);
calloc.free(command.cast());
}
if (synchronized) {
return lock.synchronized(function);
} else {
return function();
}
}