diff --git a/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java b/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java index bccdcee..8d7ed2c 100644 --- a/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java +++ b/react-native/android/src/main/java/com/arthenica/ffmpegkit/reactnative/FFmpegKitReactNativeModule.java @@ -344,7 +344,7 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule { @ReactMethod public void ffmpegSession(final ReadableArray readableArray, final Promise promise) { - promise.resolve(toMap(new FFmpegSession(toArgumentsArray(readableArray), null, null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS))); + promise.resolve(toMap(FFmpegSession.create(toArgumentsArray(readableArray), null, null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS))); } @ReactMethod @@ -395,14 +395,14 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule { @ReactMethod public void ffprobeSession(final ReadableArray readableArray, final Promise promise) { - promise.resolve(toMap(new FFprobeSession(toArgumentsArray(readableArray), null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS))); + promise.resolve(toMap(FFprobeSession.create(toArgumentsArray(readableArray), null, null, LogRedirectionStrategy.NEVER_PRINT_LOGS))); } // MediaInformationSession @ReactMethod public void mediaInformationSession(final ReadableArray readableArray, final Promise promise) { - promise.resolve(toMap(new MediaInformationSession(toArgumentsArray(readableArray), null, null))); + promise.resolve(toMap(MediaInformationSession.create(toArgumentsArray(readableArray), null, null))); } // MediaInformationJsonParser diff --git a/react-native/ios/FFmpegKitReactNativeModule.m b/react-native/ios/FFmpegKitReactNativeModule.m index 7465cda..6cca720 100644 --- a/react-native/ios/FFmpegKitReactNativeModule.m +++ b/react-native/ios/FFmpegKitReactNativeModule.m @@ -244,7 +244,7 @@ RCT_EXPORT_METHOD(getArch:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRe // FFmpegSession RCT_EXPORT_METHOD(ffmpegSession:(NSArray*)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { - FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs]; + FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs]; resolve([FFmpegKitReactNativeModule toSessionDictionary:session]); } @@ -285,14 +285,14 @@ RCT_EXPORT_METHOD(ffmpegSessionGetStatistics:(int)sessionId resolver:(RCTPromise // FFprobeSession RCT_EXPORT_METHOD(ffprobeSession:(NSArray*)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { - FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs]; + FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs]; resolve([FFmpegKitReactNativeModule toSessionDictionary:session]); } // MediaInformationSession RCT_EXPORT_METHOD(mediaInformationSession:(NSArray*)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { - MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:nil withLogCallback:nil]; + MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:nil withLogCallback:nil]; resolve([FFmpegKitReactNativeModule toSessionDictionary:session]); } diff --git a/react-native/src/index.d.ts b/react-native/src/index.d.ts index 551b735..9ac8aab 100644 --- a/react-native/src/index.d.ts +++ b/react-native/src/index.d.ts @@ -2,8 +2,6 @@ declare module 'ffmpeg-kit-react-native' { export abstract class AbstractSession implements Session { - protected constructor(); - static createFFmpegSession(argumentsArray: Array, logRedirectionStrategy?: LogRedirectionStrategy): Promise; static createFFmpegSessionFromMap(sessionMap: { [key: string]: any }): FFmpegSession; @@ -212,12 +210,8 @@ declare module 'ffmpeg-kit-react-native' { export class FFmpegSession extends AbstractSession implements Session { - constructor(); - static create(argumentsArray: Array, completeCallback?: FFmpegSessionCompleteCallback, logCallback?: LogCallback, statisticsCallback?: StatisticsCallback, logRedirectionStrategy?: LogRedirectionStrategy): Promise; - static fromMap(sessionMap: { [key: string]: any }): FFmpegSession; - getStatisticsCallback(): StatisticsCallback; getCompleteCallback(): FFmpegSessionCompleteCallback; @@ -266,12 +260,8 @@ declare module 'ffmpeg-kit-react-native' { export class FFprobeSession extends AbstractSession implements Session { - constructor(); - static create(argumentsArray: Array, completeCallback?: FFprobeSessionCompleteCallback, logCallback?: LogCallback, logRedirectionStrategy?: LogRedirectionStrategy): Promise; - static fromMap(sessionMap: { [key: string]: any }): FFprobeSession; - getCompleteCallback(): FFprobeSessionCompleteCallback; isFFmpeg(): boolean; @@ -381,12 +371,8 @@ declare module 'ffmpeg-kit-react-native' { export class MediaInformationSession extends AbstractSession implements Session { - constructor(); - static create(argumentsArray: Array, completeCallback?: MediaInformationSessionCompleteCallback, logCallback?: LogCallback): Promise; - static fromMap(sessionMap: { [key: string]: any }): MediaInformationSession; - getMediaInformation(): MediaInformation; setMediaInformation(mediaInformation: MediaInformation): void; diff --git a/react-native/src/index.js b/react-native/src/index.js index 041544f..346fbc5 100644 --- a/react-native/src/index.js +++ b/react-native/src/index.js @@ -296,13 +296,6 @@ export class AbstractSession extends Session { */ #logRedirectionStrategy; - /** - * Creates a new abstract session. - */ - constructor() { - super(); - } - /** * Creates a new FFmpeg session. * @@ -1605,12 +1598,12 @@ class FFmpegKitFactory { if (sessionMap !== undefined) { switch (sessionMap.type) { case 2: - return FFprobeSession.fromMap(sessionMap); + return AbstractSession.createFFprobeSessionFromMap(sessionMap); case 3: - return MediaInformationSession.fromMap(sessionMap); + return AbstractSession.createMediaInformationSessionFromMap(sessionMap); case 1: default: - return FFmpegSession.fromMap(sessionMap); + return AbstractSession.createFFmpegSessionFromMap(sessionMap); } } else { return undefined; @@ -1935,13 +1928,6 @@ class FFmpegKitInitializer { */ export class FFmpegSession extends AbstractSession { - /** - * Creates an empty FFmpeg session. - */ - constructor() { - super(); - } - /** * Creates a new FFmpeg session. * @@ -1963,16 +1949,6 @@ export class FFmpegSession extends AbstractSession { return session; } - /** - * Creates a new FFmpeg session from the given map. - * - * @param sessionMap map that includes session fields as map keys - * @returns FFmpeg session created - */ - static fromMap(sessionMap) { - return AbstractSession.createFFmpegSessionFromMap(sessionMap); - } - /** * Returns the session specific statistics callback. * @@ -2252,13 +2228,6 @@ export class FFprobeKit { */ export class FFprobeSession extends AbstractSession { - /** - * Creates an empty FFprobe session. - */ - constructor() { - super(); - } - /** * Creates a new FFprobe session. * @@ -2278,16 +2247,6 @@ export class FFprobeSession extends AbstractSession { return session; } - /** - * Creates a new FFprobe session from the given map. - * - * @param sessionMap map that includes session fields as map keys - * @returns FFprobe session created - */ - static fromMap(sessionMap) { - return AbstractSession.createFFprobeSessionFromMap(sessionMap); - } - /** * Returns the session specific complete callback. * @@ -2722,13 +2681,6 @@ export class MediaInformationJsonParser { export class MediaInformationSession extends AbstractSession { #mediaInformation; - /** - * Creates an empty MediaInformationSession. - */ - constructor() { - super(); - } - /** * Creates a new MediaInformationSession session. * @@ -2747,16 +2699,6 @@ export class MediaInformationSession extends AbstractSession { return session; } - /** - * Creates a new MediaInformationSession from the given map. - * - * @param sessionMap map that includes session fields as map keys - * @returns MediaInformationSession created - */ - static fromMap(sessionMap) { - return AbstractSession.createMediaInformationSessionFromMap(sessionMap); - } - /** * Returns the media information extracted in this session. *