pause method
Pauses the Player.
Implementation
@override
Future<void> pause({bool synchronized = true}) {
Future<void> function() async {
if (disposed) {
throw AssertionError('[Player] has been disposed');
}
await waitForPlayerInitialization;
await waitForVideoControllerInitializationIfAttached;
state = state.copyWith(playing: false);
if (!playingController.isClosed) {
playingController.add(false);
}
final name = 'pause'.toNativeUtf8();
final value = calloc<Uint8>();
mpv.mpv_get_property(
ctx,
name.cast(),
generated.mpv_format.MPV_FORMAT_FLAG,
value.cast(),
);
if (value.value == 0) {
await playOrPause(
notify: false,
synchronized: false,
);
}
calloc.free(name);
calloc.free(value);
}
if (synchronized) {
return lock.synchronized(function);
} else {
return function();
}
}