implement getSafParameter api method

This commit is contained in:
Taner Sener 2021-12-31 12:25:38 +00:00
parent 70ad8a8caa
commit 8448f29c02
9 changed files with 127 additions and 101 deletions

View File

@ -8,11 +8,11 @@
- `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android - `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures on Android
- `Android API Level 16` or later - `Android API Level 16` or later
- `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `i386`, `x86_64`, `x86_64-mac-catalyst` and `arm64-mac-catalyst` architectures on iOS - `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `i386`, `x86_64`, `x86_64-mac-catalyst` and `arm64-mac-catalyst` architectures on iOS
- `iOS SDK 9.3` or later - `iOS SDK 10` or later
- Can process Storage Access Framework (SAF) Uris on Android - Can process Storage Access Framework (SAF) Uris on Android
- 24 external libraries - 25 external libraries
`dav1d`, `fontconfig`, `freetype`, `fribidi`, `gmp`, `gnutls`, `kvazaar`, `lame`, `libass`, `libiconv`, `libilbc`, `libtheora`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `opencore-amr`, `opus`, `shine`, `snappy`, `soxr`, `speex`, `twolame`, `vo-amrwbenc` `dav1d`, `fontconfig`, `freetype`, `fribidi`, `gmp`, `gnutls`, `kvazaar`, `lame`, `libass`, `libiconv`, `libilbc`, `libtheora`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `opencore-amr`, `opus`, `shine`, `snappy`, `soxr`, `speex`, `twolame`, `vo-amrwbenc`, `zimg`
- 4 external libraries with GPL license - 4 external libraries with GPL license
@ -73,7 +73,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">min-lts</td> <td align="center">min-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">min-gpl</td> <td align="center">min-gpl</td>
@ -82,7 +82,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">min-gpl-lts</td> <td align="center">min-gpl-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">https</td> <td align="center">https</td>
@ -91,7 +91,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">https-lts</td> <td align="center">https-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">https-gpl</td> <td align="center">https-gpl</td>
@ -100,7 +100,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">https-gpl-lts</td> <td align="center">https-gpl-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">audio</td> <td align="center">audio</td>
@ -109,7 +109,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">audio-lts</td> <td align="center">audio-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">video</td> <td align="center">video</td>
@ -118,7 +118,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">video-lts</td> <td align="center">video-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">full</td> <td align="center">full</td>
@ -127,7 +127,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">full-lts</td> <td align="center">full-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
<tr> <tr>
<td align="center">full-gpl</td> <td align="center">full-gpl</td>
@ -136,7 +136,7 @@ The following table shows all package names and their respective API levels, iOS
<td align="center">12.1</td> <td align="center">12.1</td>
<td align="center">full-gpl-lts</td> <td align="center">full-gpl-lts</td>
<td align="center">16</td> <td align="center">16</td>
<td align="center">9.3</td> <td align="center">10</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -323,7 +323,7 @@ compare to each other.
}); });
``` ```
8. Get previous `FFmpeg` and `FFprobe` sessions from the session history. 8. Get previous `FFmpeg`, `FFprobe` and `MediaInformation` sessions from the session history.
```js ```js
FFmpegKit.listSessions().then(sessionList => { FFmpegKit.listSessions().then(sessionList => {
@ -332,7 +332,13 @@ compare to each other.
}); });
}); });
FFprobeKit.listSessions().then(sessionList => { FFprobeKit.listFFprobeSessions().then(sessionList => {
sessionList.forEach(async session => {
const sessionId = session.getSessionId();
});
});
FFprobeKit.listMediaInformationSessions().then(sessionList => {
sessionList.forEach(async session => { sessionList.forEach(async session => {
const sessionId = session.getSessionId(); const sessionId = session.getSessionId();
}); });
@ -340,10 +346,18 @@ compare to each other.
``` ```
9. Enable global callbacks. 9. Enable global callbacks.
- Execute Callback, called when an async execution is ended - Session type specific Complete Callbacks, called when an async session has been completed
```js ```js
FFmpegKitConfig.enableExecuteCallback(session => { FFmpegKitConfig.enableFFmpegSessionCompleteCallback(session => {
const sessionId = session.getSessionId();
});
FFmpegKitConfig.enableFFprobeSessionCompleteCallback(session => {
const sessionId = session.getSessionId();
});
FFmpegKitConfig.enableMediaInformationSessionCompleteCallback(session => {
const sessionId = session.getSessionId(); const sessionId = session.getSessionId();
}); });
``` ```

View File

@ -31,8 +31,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion safeExtGet('ffmpegKitPackage', 'https').contains("-lts") ? 16 : 24 minSdkVersion safeExtGet('ffmpegKitPackage', 'https').contains("-lts") ? 16 : 24
targetSdkVersion 30 targetSdkVersion 30
versionCode 450 versionCode 451
versionName "4.5.0" versionName "4.5.1"
} }
buildTypes { buildTypes {

View File

@ -1,3 +1,3 @@
android.useAndroidX=true android.useAndroidX=true
ffmpegKit.android.main.version=4.5 ffmpegKit.android.main.version=4.5.1-1
ffmpegKit.android.lts.version=4.5 ffmpegKit.android.lts.version=4.5.1-1

View File

@ -894,22 +894,18 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
} }
@ReactMethod @ReactMethod
public void getSafParameter(final Boolean writable, final String uriString, final Promise promise) { public void getSafParameter(final String uriString, final String openMode, final Promise promise) {
final ReactApplicationContext reactContext = getReactApplicationContext(); final ReactApplicationContext reactContext = getReactApplicationContext();
final Uri uri = Uri.parse(uriString); final Uri uri = Uri.parse(uriString);
if (uri == null) { if (uri == null) {
Log.w(LIBRARY_NAME, String.format("Cannot getSafParameter using parameters writable: %s, uriString: %s. Uri string cannot be parsed.", writable, uriString)); Log.w(LIBRARY_NAME, String.format("Cannot getSafParameter using parameters uriString: %s, openMode: %s. Uri string cannot be parsed.", uriString, openMode));
promise.reject("GET_SAF_PARAMETER_FAILED", "Uri string cannot be parsed."); promise.reject("GET_SAF_PARAMETER_FAILED", "Uri string cannot be parsed.");
} else { } else {
final String safParameter; final String safParameter;
if (writable) { safParameter = FFmpegKitConfig.getSafParameter(reactContext, uri, openMode);
safParameter = FFmpegKitConfig.getSafParameterForWrite(reactContext, uri);
} else {
safParameter = FFmpegKitConfig.getSafParameterForRead(reactContext, uri);
}
Log.d(LIBRARY_NAME, String.format("getSafParameter using parameters writable: %s, uriString: %s completed with saf parameter: %s.", writable, uriString, safParameter)); Log.d(LIBRARY_NAME, String.format("getSafParameter using parameters uriString: %s, openMode: %s completed with saf parameter: %s.", uriString, openMode, safParameter));
promise.resolve(safParameter); promise.resolve(safParameter);
} }
@ -994,19 +990,17 @@ public class FFmpegKitReactNativeModule extends ReactContextBaseJavaModule imple
sessionMap.putDouble(KEY_SESSION_START_TIME, toLong(session.getStartTime())); sessionMap.putDouble(KEY_SESSION_START_TIME, toLong(session.getStartTime()));
sessionMap.putString(KEY_SESSION_COMMAND, session.getCommand()); sessionMap.putString(KEY_SESSION_COMMAND, session.getCommand());
if (session.isFFprobe()) { if (session.isFFmpeg()) {
if (session.isMediaInformation()) { sessionMap.putDouble(KEY_SESSION_TYPE, SESSION_TYPE_FFMPEG);
} else if (session.isFFprobe()) {
sessionMap.putDouble(KEY_SESSION_TYPE, SESSION_TYPE_FFPROBE);
} else if (session.isMediaInformation()) {
final MediaInformationSession mediaInformationSession = (MediaInformationSession) session; final MediaInformationSession mediaInformationSession = (MediaInformationSession) session;
final MediaInformation mediaInformation = mediaInformationSession.getMediaInformation(); final MediaInformation mediaInformation = mediaInformationSession.getMediaInformation();
if (mediaInformation != null) { if (mediaInformation != null) {
sessionMap.putMap(KEY_SESSION_MEDIA_INFORMATION, toMap(mediaInformation)); sessionMap.putMap(KEY_SESSION_MEDIA_INFORMATION, toMap(mediaInformation));
} }
sessionMap.putDouble(KEY_SESSION_TYPE, SESSION_TYPE_MEDIA_INFORMATION); sessionMap.putDouble(KEY_SESSION_TYPE, SESSION_TYPE_MEDIA_INFORMATION);
} else {
sessionMap.putDouble(KEY_SESSION_TYPE, SESSION_TYPE_FFPROBE);
}
} else {
sessionMap.putDouble(KEY_SESSION_TYPE, SESSION_TYPE_FFMPEG);
} }
return sessionMap; return sessionMap;

View File

@ -23,113 +23,113 @@ Pod::Spec.new do |s|
s.subspec 'min' do |ss| s.subspec 'min' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-min', "4.5" ss.dependency 'ffmpeg-kit-ios-min', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'min-lts' do |ss| s.subspec 'min-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-min', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-min', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'min-gpl' do |ss| s.subspec 'min-gpl' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-min-gpl', "4.5" ss.dependency 'ffmpeg-kit-ios-min-gpl', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'min-gpl-lts' do |ss| s.subspec 'min-gpl-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-min-gpl', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-min-gpl', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'https' do |ss| s.subspec 'https' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-https', "4.5" ss.dependency 'ffmpeg-kit-ios-https', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'https-lts' do |ss| s.subspec 'https-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-https', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-https', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'https-gpl' do |ss| s.subspec 'https-gpl' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-https-gpl', "4.5" ss.dependency 'ffmpeg-kit-ios-https-gpl', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'https-gpl-lts' do |ss| s.subspec 'https-gpl-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-https-gpl', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-https-gpl', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'audio' do |ss| s.subspec 'audio' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-audio', "4.5" ss.dependency 'ffmpeg-kit-ios-audio', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'audio-lts' do |ss| s.subspec 'audio-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-audio', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-audio', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'video' do |ss| s.subspec 'video' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-video', "4.5" ss.dependency 'ffmpeg-kit-ios-video', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'video-lts' do |ss| s.subspec 'video-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-video', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-video', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'full' do |ss| s.subspec 'full' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-full', "4.5" ss.dependency 'ffmpeg-kit-ios-full', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'full-lts' do |ss| s.subspec 'full-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-full', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-full', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
s.subspec 'full-gpl' do |ss| s.subspec 'full-gpl' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-full-gpl', "4.5" ss.dependency 'ffmpeg-kit-ios-full-gpl', "4.5.1"
ss.ios.deployment_target = '12.1' ss.ios.deployment_target = '12.1'
end end
s.subspec 'full-gpl-lts' do |ss| s.subspec 'full-gpl-lts' do |ss|
ss.source_files = '**/FFmpegKitReactNativeModule.m', ss.source_files = '**/FFmpegKitReactNativeModule.m',
'**/FFmpegKitReactNativeModule.h' '**/FFmpegKitReactNativeModule.h'
ss.dependency 'ffmpeg-kit-ios-full-gpl', "4.5.LTS" ss.dependency 'ffmpeg-kit-ios-full-gpl', "4.5.1.LTS"
ss.ios.deployment_target = '9.3' ss.ios.deployment_target = '10'
end end
end end

View File

@ -637,7 +637,7 @@ RCT_EXPORT_METHOD(selectDocument:(BOOL)writable title:(NSString*)title type:(NSS
reject(@"Not Supported", @"Not supported on iOS platform.", nil); reject(@"Not Supported", @"Not supported on iOS platform.", nil);
} }
RCT_EXPORT_METHOD(getSafParameter:(BOOL)writable uri:(NSString*)uriString resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { RCT_EXPORT_METHOD(getSafParameter:(NSString*)uriString mode:(NSString*)openMode resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
reject(@"Not Supported", @"Not supported on iOS platform.", nil); reject(@"Not Supported", @"Not supported on iOS platform.", nil);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "ffmpeg-kit-react-native", "name": "ffmpeg-kit-react-native",
"version": "4.5.0", "version": "4.5.1",
"description": "FFmpeg Kit for React Native", "description": "FFmpeg Kit for React Native",
"main": "src/index", "main": "src/index",
"types": "src/index.d.ts", "types": "src/index.d.ts",

View File

@ -150,6 +150,12 @@ declare module 'ffmpeg-kit-react-native' {
static setLogLevel(level: Level): Promise<void>; static setLogLevel(level: Level): Promise<void>;
static getSafParameterForRead(uriString: String): Promise<string>;
static getSafParameterForWrite(uriString: String): Promise<string>;
static getSafParameter(uriString: String, openMode: String): Promise<string>;
static getSessionHistorySize(): Promise<number>; static getSessionHistorySize(): Promise<number>;
static setSessionHistorySize(sessionHistorySize: number): Promise<void>; static setSessionHistorySize(sessionHistorySize: number): Promise<void>;
@ -200,10 +206,6 @@ declare module 'ffmpeg-kit-react-native' {
static selectDocumentForWrite(title?: string, type?: string, extraTypes?: string[]): Promise<string>; static selectDocumentForWrite(title?: string, type?: string, extraTypes?: string[]): Promise<string>;
static getSafParameterForRead(uriString): Promise<string>;
static getSafParameterForWrite(uriString): Promise<string>;
} }
export class FFmpegSession extends AbstractSession implements Session { export class FFmpegSession extends AbstractSession implements Session {

View File

@ -1156,6 +1156,54 @@ export class FFmpegKitConfig {
return FFmpegKitReactNativeModule.setLogLevel(level); return FFmpegKitReactNativeModule.setLogLevel(level);
} }
/**
* <p>Converts the given Structured Access Framework Uri into an input url that can be used in FFmpeg
* and FFprobe commands.
*
* <p>Note that this method is Android only. It will fail if called on other platforms. It also requires
* API Level &ge; 19. On older API levels it returns an empty url.
*
* @param uriString SAF uri (<code>"content:…"</code>)
* @return input url that can be passed to FFmpegKit or FFprobeKit
*/
static async getSafParameterForRead(uriString) {
await FFmpegKitConfig.init();
return FFmpegKitReactNativeModule.getSafParameter(uriString, "r");
}
/**
* <p>Converts the given Structured Access Framework Uri into an output url that can be used in FFmpeg
* and FFprobe commands.
*
* <p>Note that this method is Android only. It will fail if called on other platforms. It also requires
* API Level &ge; 19. On older API levels it returns an empty url.
*
* @param uriString SAF uri (<code>"content:…"</code>)
* @return output url that can be passed to FFmpegKit or FFprobeKit
*/
static async getSafParameterForWrite(uriString) {
await FFmpegKitConfig.init();
return FFmpegKitReactNativeModule.getSafParameter(uriString, "w");
}
/**
* <p>Converts the given Structured Access Framework Uri into an saf protocol url opened with the given open mode.
*
* <p>Note that this method is Android only. It will fail if called on other platforms. It also requires
* API Level &ge; 19. On older API levels it returns an empty url.
*
* @param uriString SAF uri (<code>"content:…"</code>)
* @param openMode file mode to use as defined in Android Structured Access Framework documentation
* @return saf protocol url that can be passed to FFmpegKit or FFprobeKit
*/
static async getSafParameter(uriString, openMode) {
await FFmpegKitConfig.init();
return FFmpegKitReactNativeModule.getSafParameter(uriString, openMode);
}
/** /**
* Returns the session history size. * Returns the session history size.
* *
@ -1522,38 +1570,6 @@ export class FFmpegKitConfig {
return FFmpegKitReactNativeModule.selectDocument(true, title, type, extraTypes); return FFmpegKitReactNativeModule.selectDocument(true, title, type, extraTypes);
} }
/**
* <p>Converts the given Structured Access Framework Uri into an input url that can be used in FFmpeg
* and FFprobe commands.
*
* <p>Note that this method is Android only. It will fail if called on other platforms. It also requires
* API Level &ge; 19. On older API levels it returns an empty url.
*
* @param uriString SAF uri (<code>"content:…"</code>)
* @return input url that can be passed to FFmpegKit or FFprobeKit
*/
static async getSafParameterForRead(uriString) {
await FFmpegKitConfig.init();
return FFmpegKitReactNativeModule.getSafParameter(false, uriString);
}
/**
* <p>Converts the given Structured Access Framework Uri into an output url that can be used in FFmpeg
* and FFprobe commands.
*
* <p>Note that this method is Android only. It will fail if called on other platforms. It also requires
* API Level &ge; 19. On older API levels it returns an empty url.
*
* @param uriString SAF uri (<code>"content:…"</code>)
* @return output url that can be passed to FFmpegKit or FFprobeKit
*/
static async getSafParameterForWrite(uriString) {
await FFmpegKitConfig.init();
return FFmpegKitReactNativeModule.getSafParameter(true, uriString);
}
} }
class FFmpegKitFactory { class FFmpegKitFactory {