Merge pull request #339 from superandrew213/development-react-native

Handle sessionId not defined case in cancel method of AbstractSession
This commit is contained in:
Taner Şener 2022-02-02 13:41:30 +00:00 committed by GitHub
commit fd351b78c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) { if (sessionId === undefined) {
return FFmpegKitReactNativeModule.cancel(); return Promise.reject(new Error('sessionId is not defined'));
} else { } else {
return FFmpegKitReactNativeModule.cancelSession(sessionId); return FFmpegKitReactNativeModule.cancelSession(sessionId);
} }