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

Handle sessionId not defined case in cancel method of AbstractSession
pull/427/head
Taner Şener 3 years ago committed by GitHub
commit fd351b78c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      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) { 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);
} }

Loading…
Cancel
Save