diff --git a/react-native/src/index.js b/react-native/src/index.js index 4b28ff5..3a39aa6 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -669,11 +669,12 @@ export class AbstractSession extends Session { } /** - * Cancels running the session. + * Cancels running the session. Only starts cancellation. Does not guarantee that session is cancelled when promise resolves. */ - cancel() { + async cancel() { + const sessionId = this.getSessionId(); if (sessionId === undefined) { - return FFmpegKitReactNativeModule.cancel(); + return Promise.reject(new Error('sessionId is not defined')); } else { return FFmpegKitReactNativeModule.cancelSession(sessionId); }