TAVMedia Quick access
SDK acquisition
Android terminal access
Basic requirements
support android 4.4 and above systems.
It is recommended to compile with gralde 3.0 and above.
Access method
aar Access
Place the tavmedia aar file in the libs directory of the Android project directory.
Add aar library dependency.
In the app's gradle file
app/build.gradle
, add the following tavmedia library dependencies.implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) // aar mode dependencies need to manually add exifinterface and tavmedia_pag_decode dependencies implementation("androidx.exifinterface:exifinterface:2.0.15") implementation 'com.tencent.tav:tavmedia_pag_decode:1.0.0' // If the project also depends on libpag, there is no need to add this line
In the obfuscation list, add the following keep rules for tavmedia.
-keep class com.tencent.tavmedia.**{*;} -keep class androidx.exifinterface.** {*;} -keep class org.libpag.** {*;}
- After the configuration is completed, execute sync and then compile.
maven Access
Modify the build.gradle file in the project directory and add mavenCentral().
repositories { ... maven { url "https://mirrors.tencent.com/repository/maven/tencent_public" } ... }
Add dependencies
In the app's gradle file
app/build.gradle
, add the following tavmedia library dependencies.implementation "com.tencent.tav:tavmedia:2.0.12"
If the project also depends on libpag, please use the following dependencies.
implementation('com.tencent.tav:tavmedia:2.0.12') { exclude group: 'com.tencent.tav', module: 'tavmedia_pag_decode' }
In the obfuscation list, add the following keep rules for tavmedia.
-keep class com.tencent.tavmedia.**{*;} -keep class androidx.exifinterface.** {*;} -keep class org.libpag.** {*;}
iOS terminal access
Basic requirements
support iOS 9 and above.
You need to use Xcode11.0 and above for compilation.
Use CocoaPods
- Execute the following command in the terminal window to install CocoaPods.
Description:
Ruby environment needs to be installed on Mac before executing the command.
sudo gem install cocoapods
Enter the path where the project is located and execute the following command to create the Podfile file.
pod init
Select the appropriate version according to your project needs and edit the Profile file as follows.
platform :ios, '8.0' target 'App' dopod 'TAVMedia' end
Execute the following commands in the terminal window to update the local library files and install the SDK.
pod install
After the pod command is executed, a project file with the .xcworkspace suffix integrated with the SDK will be generated, which can be opened by double-clicking it.
Modify the Bundle Identifier to be consistent with the applied test authorization.
Download SDK and import manually
Download and unzip SDKLibrary file.
Open your Xcode project and add the framework in the folder to the actual project.
Select the TARGETS to run, select General, and expand the Frameworks, Libraries, and Embedded Content item, and click the
+
icon in the expanded item to add dependent libraries. Add the downloadedTAVMedia.xcframework
andFFmpeg.xcframework
in turn. As shown below:
Since TAVMedia currently does not support Bitcode, you need to configure Build Settings > Build Options > Enable Bitcode to be No.
Modify the Bundle Identifier to be consistent with the applied test authorization.
TAVMedia SDK License guidelines
TAVMedia License provides an authentication function. After purchasing the corresponding package, you can obtain the official version of the license and get one year of usage rights. If there is no license file for authorized operations, the preview and export screens will have watermarks.
This article will explain and guide the creation, authentication and common problems of License files.
Obtain License
Contact the business, choose to purchase the SDK, and obtain the official version of the License (valid for 1 year until 00:00:00 the day after expiration).
After successful purchase, the URL download address and key of the license file will be provided. Download the corresponding License file through the URL link in the application to the local for authentication and verification.
License Authentication
The corresponding API for authentication is provided in TAVMedia SDK. Please select as needed:
Android
String licenseUrl = "replace_your_license_url";
String licenseAppId = "replace_your_app_id";
String licenseKey = "replace_your_key";
licenseAuthListener = (errorCode, msg) -> {
if (errorCode == TAVLicense.LICENSE_AUTH_SUCCESS) {
Log.d("export", "auth success " + msg);
} else {
Log.e("export", "auth failed and errorCode is " + errorCode + " " + msg);
}
};
TAVLicense.getInstance().Auth(getBaseContext(), licenseUrl, licenseKey, licenseAppId, licenseAuthListener);
The core interface class TAVLicense provides the authentication method Auth()
.
public void Auth(Context context, String url, String key, String appId, TAVLicenseAuthListener listener)
The parameter meanings are as follows:
parameter | meaning |
context | context |
url | License link address |
key | key |
appId | provided during authorization AppID |
listener | The callback corresponding to the authentication result returns the corresponding error code |
iOS
NSString *licenseUrl = @"replace_your_license_url";
NSString *licenseAppId = @"replace_your_app_id";
NSString *licenseKey = @"replace_your_key";
id<TAVLicenseAuthListener> listener = replace_your_Listener;
[TAVLicense Auth:licenseUrl key:licenseKey appID:licenseAppId listener:listener];
The core interface class TAVLicense provides the authentication method Auth()
.
@interface TAVLicense : NSObject
+ (void)Auth:(NSString *)url key:(NSString *)key appID:(NSString *)appID listener:(id<TAVLicenseAuthListener>)listener;
@end
The parameter meanings are as follows:
parameter | meaning |
url | License link address |
key | key |
appId | provided during authorization AppID |
listener | The callback corresponding to the authentication result returns the corresponding error code |
The TAVLicenseAuthListener protocol will return the result after authentication. You can refer to [Error Code] for the returned result information.
@protocol TAVLicenseAuthListener <NSObject>
- (void)onLicenseAuthResult:(TAVLicenseAuthResult)result msg:(NSString *)msg;
@end
Error code
error code | meaning |
0 | Authentication successful |
-1 | Parameter error |
-2 | APPID error |
-3 | Package error |
-4 | time expired |
-5 | Decryption failed |
-6 | Licensefile does not exist |
-7 | License Download error |
License renewal
After the license expires, you need to renew and update it on the console, and then perform the authentication operation again.
Related questions
How to get the official version License?
If you need to use the TAVMedia SDK function in your business, please contact the business and select the SDK package according to your needs for purchase.
You can obtain the license after purchase. After binding the license through the console, you can use the corresponding functions.
How long is the license valid for? How to renew the license after it expires?
The validity period of the TAVMedia License is one year (365 days) from the date of issuance of the license after it is successfully created. For example, if you apply for and successfully create a formal license on January 1, 2022, the formal license will expire at 00:00:00 on January 2, 2023.
After the official version license expires, you need to purchase a new license for renewal.
How many package names does the License support? How many authorized units are there?
Currently, a single license only supports one package name, but there is no limit on the number of authorized terminals.
TAVMedia SDK Demo experience
The trial version SDK Demo provides specific scenario applications of TAVMedia to help you quickly develop short video apps for video editing, template applications, and special effects additions. You can get the source code Demo in the card below, and refer to the access guide to access it.
Please refer to the following link to download the source code: