implement AbstractSession.cancel method on flutter
This commit is contained in:
parent
10ef18ab6b
commit
c3d1bff355
|
@ -428,5 +428,18 @@ class AbstractSession extends Session {
|
|||
bool isMediaInformation() => false;
|
||||
|
||||
/// Cancels running the session.
|
||||
void cancel() {}
|
||||
Future<void> cancel() async {
|
||||
try {
|
||||
final int? sessionId = getSessionId();
|
||||
await FFmpegKitConfig.init();
|
||||
if (sessionId == null) {
|
||||
return _platform.ffmpegKitCancel();
|
||||
} else {
|
||||
return _platform.ffmpegKitCancelSession(sessionId);
|
||||
}
|
||||
} on PlatformException catch (e, stack) {
|
||||
print("Plugin cancel error: ${e.message}");
|
||||
return Future.error("cancel failed.", stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,5 +106,5 @@ abstract class Session {
|
|||
bool isMediaInformation();
|
||||
|
||||
/// Cancels running the session.
|
||||
void cancel();
|
||||
Future<void> cancel();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user