@interface VideoUploadObject ()@property (nonatomic,strong) TXPublishParam * param;
@end
@implementation VideoUploadObject
single_implementation(VideoUploadObject)
-(void)setInit{
if (!_param) {
_param = [[TXPublishParam alloc] init];
}
}
-(void)setSignature:(NSString *)signature
{
[self setInit];
_param.signature = signature;
[self initTheUploadVideoPath:self.dbPath coverImage:nil];
}
-(void)getTheSigNatureBlock:(theSigNature)block
{
[HXHttpTool getWithPath:[NSString stringWithFormat:@"%@%@",IP,getUploadSign_url] params:nil success:^(id JSON) {
if ([[JSON objectForKey:@"msg"] isEqualToString:@"OK"]) {
block([JSON objectForKey:@"data"]);
}
else
{
block(@"error");
}
} failure:^(NSError *error) {
block(@"error");
}];
}
-(void)initTheUploadVideoPath:(NSString *)videoPath coverImage:(UIImage *)coverImage
{
NSLog(@"videoPath==--==%@",videoPath);
_param.videoPath = videoPath;
_param.coverImage = coverImage;
TXUGCPublish *publish = [[TXUGCPublish alloc] init];
publish.delegate = self; // 设置 TXVideoPublishListener 回调
[publish publishVideo:_param];
}
-(void) onPublishProgress:(NSInteger)uploadBytes totalBytes: (NSInteger)totalBytes
{
if (_theUpLoadProgress)
{
_theUpLoadProgress(uploadBytes,totalBytes);
}
}
-(void) onPublishComplete:(TXPublishResult*)result
{
if (_result)
{
_result(result);
}
}