Skip to content

Commit

Permalink
Merge pull request #339 from superandrew213/development-react-native
Browse files Browse the repository at this point in the history
Handle sessionId not defined case in cancel method of AbstractSession
  • Loading branch information
tanersener authored Feb 2, 2022
2 parents f4817da + cb12474 commit fd351b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions react-native/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit fd351b7

Please sign in to comment.