The SDK is supported on iOS 8.0 and above.
TXLiteAVSDK\_
(e.g. TXLiteAVSDK_UGC.framework) in the SDK folder to your project folder, and drag them to the project.bitcode
in Building Settings, and set Enable Bitcode to No.The app needs access to the photo album, which can be configured in Info.plist
. Right-click Info.plist
, select Open as > Source Code, and copy and modify the code below.
<key>NSAppleMusicUsageDescription</key>
<string>Video Cloud Toolkit needs to access your media library to obtain music files. It cannot add music if you deny it access.</string>
<key>NSCameraUsageDescription</key>
<string>Video Cloud Toolkit needs to access your camera to be able to shoot videos with images.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Video Cloud Toolkit needs to access your mic to be able to shoot videos with audio.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Video Cloud Toolkit needs to access your photo album to save edited video files.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Video Cloud Toolkit needs to access your photo album to edit your video files.</string>
Follow the steps in License Application to apply for a license, and copy the key and license URL in the console.
Before using UGSV features in your app, we recommend that you add the following code to - [AppDelegate application:didFinishLaunchingWithOptions:]
.
@import TXLiteAVSDK_UGC;
@implementation AppDelegate
- (BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictinoary*)options {
NSString * const licenceURL = @"<License URL obtained>";
NSString * const licenceKey = @"<The key obtained>";
[TXUGCBase setLicenceURL:licenceURL key:licenceKey];
NSLog(@"SDK Version = %@", [TXLiveBase getSDKVersionStr]);
}
@end
Note:
- If you use a v4.7 license and have updated the SDK to v4.9, you can click Switch to New License in the console to generate a new license key and URL. A new license can be used only on v4.9 or above and should be configured as described above.
You can enable/disable console log printing and set the log level in TXLiveBase
. Below are the APIs used.
[TXLiveBase setConsoleEnabled:YES];
[TXLiveBase setLogLevel:LOGLEVEL_DEBUG];
If the above steps are performed correctly, you will be able to successfully compile the HelloSDK
project. Run the app in the debug mode, and the following SDK version information will be printed in the Xcode console:
2017-09-26 16:16:15.767 HelloSDK[17929:7488566] SDK Version = 5.2.5541
UGCKit is a UI component library built based on the UGSV SDK. It helps you quickly integrate different features of the SDK.
You can find UGCKit in Demo/TXLiteAVDemo/UGC/UGCKit
of the SDK package, which you can download at GitHub or here.
Configure the project:
Use CocoaPods in your project and, based on your actual conditions, do either of the following:
pod init && pod install
to get the Podfile.Open the Podfile and add the following:
pod 'BeautySettingKit', :path => 'BeautySettingKit/BeautySettingKit.podspec'
pod 'UGCKit', :path => 'UGCKit/UGCKit.podspec', :subspecs => ["UGC"] #subspecs Choose according to your SDK
Run pod install and open project name.xcworkspace
. You will find a UGCKit BeautySettingKit
file in Pods/Development Pods
.
Import resources of the Enterprise Edition (required only if you use the Enterprise Edition):
Drag EnterprisePITU
(in App/AppCommon
of the ZIP file of the Enterprise Edition SDK) to your project, click Create groups, select your target, and click Finish.
UGCKitRecordViewController
provides the video shooting feature. To enable the feature, just instantiate the controller and display it in the UI.UGCKitRecordViewController *recordViewController = [[UGCKitRecordViewController alloc] initWithConfig:nil theme:nil];
[self.navigationController pushViewController:recordViewController]
<dx-code-holder data-codeindex="5"></dx-code-holder>
recordViewController.completion = ^(UGCKitResult *result) {
if (result.error) {
// Shooting error.
[self showAlertWithError:error];
} else {
if (result.cancelled) {
// User cancelled shooting and left the shooting view.
[self.navigationController popViewControllerAnimated:YES];
} else {
// Shooting successful. Use the result for subsequent processing.
[self processRecordedVideo:result.media];
}
}
};
UGCKitEditViewController
provides the slideshow making and video editing features. During instantiation, you need to pass in the media object to be edited. Below is an example that involves the editing of a shooting result:- (void)processRecordedVideo:(UGCKitMedia *)media {
// Instantiate the editing view controller.
UGCKitEditViewController *editViewController = [[UKEditViewController alloc] initWithMedia:media conifg:nil theme:nil];
// Display the editing view controller.
[self.navigationController pushViewController:editViewController animated:YES];
<dx-code-holder data-codeindex="6"></dx-code-holder>
editViewController.completion = ^(UGCKitResult *result) {
if (result.error) {
// Error.
[self showAlertWithError:error];
} else {
if (result.cancelled) {
// User cancelled shooting and left the editing view.
[self.navigationController popViewControllerAnimated:YES];
} else {
// Video edited and saved successfully. Use the result for subsequent processing.
[self processEditedVideo:result.path];
}
}
}
UGCKitMediaPickerViewController
is used to select and splice images or videos. When multiple videos are selected, it returns a spliced video. Below is an example:// Configure initialization.
UGCKitMediaPickerConfig *config = [[UGCKitMediaPickerConfig alloc] init];
config.mediaType = UGCKitMediaTypeVideo;//Select videos.
config.maxItemCount = 5; // Up to five can be selected.
// Instantiate the media picker view controller.
UGCKitMediaPickerViewController *mediaPickerViewController = [[UGCKitMediaPickerViewController alloc] initWithConfig:config theme:nil];
// Display the media picker view controller.
[self presentViewController:mediaPickerViewController animated:YES completion:nil];
<dx-code-holder data-codeindex="7"></dx-code-holder>
mediaPickerViewController.completion = ^(UGCKitResult *result) {
if (result.error) {
// Error.
[self showAlertWithError:error];
} else {
if (result.cancelled) {
// User cancelled shooting and left the picker view.
[self dismissViewControllerAnimated:YES completion:nil];
} else {
// Video edited and saved successfully. Use the result for subsequent processing.
[self processEditedVideo:result.media];
}
}
}
UGCKitCutViewController
provides the video clipping feature. As with the editing API, you need to pass in a media project when instantiating the controller and process clipping results in completion
.UGCKitMedia *media = [UGCKitMedia mediaWithVideoPath:@"<#video path#>"];
UGCKitCutViewController *cutViewController = [[UGCKitCutViewController alloc] initWithMedia:media theme:nil];
cutViewController.completion = ^(UGCKitResult *result) {
if (!result.cancelled && !result.error) {
[self editVideo:result.media];
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}
[self.navigationController pushViewController: cutViewController]
Read the documents below to learn more about different modules of the SDK.
Was this page helpful?