Adding Background Music During Shooting
TXUGCRecord *recorder = [TXUGCRecord shareInstance];
[recorder setBGMAsset:path];
[recorder setBGMAsset:asset];
[recorder playBGMFromTime:beginTime
toTime:endTime
withBeginNotify:^(NSInteger errCode) {
} withProgressNotify:^(NSInteger progressMS, NSInteger durationMS) {
} andCompleteNotify:^(NSInteger errCode) {
}];
[recorder stopBGM];
[recorder pauseBGM];
[recorder resumeBGM];
[recorder setMicVolume:1.0];
[recorder setBGMVolume:1.0];
Adding Background Music During Editing
TXPreviewParam *param = [[TXPreviewParam alloc] init];
param.videoView = videoView;
param.renderMode = PREVIEW_RENDER_MODE_FILL_EDGE;
ugcEdit = [[TXVideoEditer alloc] initWithPreview:param];
[ugcEdit setBGMAsset:fileAsset result:^(int result) {
}];
[ugcEdit setBGMStartTime:0 endTime:5];
[ugcEdit setBGMLoop:YES];
[ugcEdit setBGMAtVideoTime:0];
[ugcEdit setVideoVolume:1.0];
[ugcEdit setBGMVolume:1.0];
After you set the background music, when you start the editor for video preview, the background music will be played back according to the configured parameters. After you start the editor for video generation, the background music will be composed into the generated video according to the configured parameters.
Was this page helpful?