fix toSessionDictionary method on ios

This commit is contained in:
Taner Sener 2022-01-03 00:00:50 +00:00
parent a3e235ca70
commit f4817dad4d
2 changed files with 13 additions and 13 deletions

View File

@ -1144,16 +1144,18 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
} }
protected static WritableMap toMap(final MediaInformation mediaInformation) { protected static WritableMap toMap(final MediaInformation mediaInformation) {
if (mediaInformation != null) {
WritableMap map = Arguments.createMap(); WritableMap map = Arguments.createMap();
if (mediaInformation != null) {
JSONObject allProperties = mediaInformation.getAllProperties(); JSONObject allProperties = mediaInformation.getAllProperties();
if (allProperties != null) { if (allProperties != null) {
map = toMap(allProperties); map = toMap(allProperties);
} }
}
return map; return map;
} else {
return null;
}
} }
protected static WritableMap toMap(final JSONObject jsonObject) { protected static WritableMap toMap(final JSONObject jsonObject) {

View File

@ -724,16 +724,14 @@ RCT_EXPORT_METHOD(getExternalLibraries:(RCTPromiseResolveBlock)resolve rejecter:
dictionary[KEY_SESSION_START_TIME] = [NSNumber numberWithDouble:[[session getStartTime] timeIntervalSince1970]*1000]; dictionary[KEY_SESSION_START_TIME] = [NSNumber numberWithDouble:[[session getStartTime] timeIntervalSince1970]*1000];
dictionary[KEY_SESSION_COMMAND] = [session getCommand]; dictionary[KEY_SESSION_COMMAND] = [session getCommand];
if ([session isFFprobe]) { if ([session isFFmpeg]) {
if ([session isMediaInformation]) { dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFMPEG];
} else if ([session isFFprobe]) {
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFPROBE];
} else if ([session isMediaInformation]) {
MediaInformationSession *mediaInformationSession = (MediaInformationSession*)session; MediaInformationSession *mediaInformationSession = (MediaInformationSession*)session;
dictionary[KEY_SESSION_MEDIA_INFORMATION] = [FFmpegKitReactNativeModule toMediaInformationDictionary:[mediaInformationSession getMediaInformation]]; dictionary[KEY_SESSION_MEDIA_INFORMATION] = [FFmpegKitReactNativeModule toMediaInformationDictionary:[mediaInformationSession getMediaInformation]];
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_MEDIA_INFORMATION]; dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_MEDIA_INFORMATION];
} else {
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFPROBE];
}
} else {
dictionary[KEY_SESSION_TYPE] = [NSNumber numberWithInt:SESSION_TYPE_FFMPEG];
} }
return dictionary; return dictionary;