提交
This commit is contained in:
@@ -40,12 +40,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@interface QXEffectContentView : UIView
|
||||
@property (nonatomic,assign) BOOL isShow;
|
||||
@property (nonatomic,assign) BOOL isOnece;
|
||||
@property (nonatomic,strong) VAPView *playerMp4View;
|
||||
@property (nonatomic, strong) dispatch_queue_t queue;
|
||||
-(void)previewEffectWith:(NSString *)play_image;
|
||||
- (void)displayEffectView:(NSString *)play_image;
|
||||
- (void)displayEffectViewWithMorePlayImages:(NSArray *)playImages;
|
||||
- (void)openOrCloseEffectViewWith:(BOOL)isShow;
|
||||
@property (nonatomic,assign) BOOL isShow;
|
||||
- (void)destroyEffectView;
|
||||
-(void)stopPlay;
|
||||
-(void)startPlay;
|
||||
|
||||
@@ -280,6 +280,35 @@ static NSString *PLAY_IMAGE = @"play_image";
|
||||
}
|
||||
});
|
||||
}
|
||||
-(void)previewEffectWith:(NSString *)play_image{
|
||||
self.isOnece = YES;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if ([play_image hasSuffix:@"mp4"]) {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
/// mp4格式下载播放
|
||||
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:play_image completion:^(BOOL result, NSString * _Nonnull fileName) {
|
||||
NSString *videoPath = [QXFileManager getGiftVideoPath:fileName];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
weakSelf.playerMp4View.hidden = NO;
|
||||
weakSelf.svagView.hidden = YES;
|
||||
});
|
||||
[weakSelf.playerMp4View stopHWDMP4];
|
||||
[weakSelf.playerMp4View playHWDMP4:videoPath delegate:self];
|
||||
}];
|
||||
}else if ([play_image hasSuffix:@"svg"] || [play_image hasSuffix:@"svga"]) {
|
||||
__weak typeof(self)weakSelf = self;
|
||||
/// svga下载播放
|
||||
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:play_image completion:^(BOOL result, NSString * _Nonnull fileName) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
weakSelf.playerMp4View.hidden = YES;
|
||||
weakSelf.svagView.hidden = NO;
|
||||
});
|
||||
NSString *filePath = [QXFileManager getGiftVideoPath:fileName];
|
||||
[weakSelf.svagView loadSVGAPlayerWith:filePath];
|
||||
}];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)openOrCloseEffectViewWith:(BOOL)isShow {
|
||||
_isShow = isShow;
|
||||
@@ -307,9 +336,13 @@ static NSString *PLAY_IMAGE = @"play_image";
|
||||
[self loadStartSVGAPlayer];
|
||||
}
|
||||
-(void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container{
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.playerMp4View.hidden = YES;
|
||||
});
|
||||
if (self.isOnece) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self loadStartSVGAPlayer];
|
||||
});
|
||||
@@ -318,6 +351,9 @@ static NSString *PLAY_IMAGE = @"play_image";
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.playerMp4View.hidden = YES;
|
||||
});
|
||||
if (self.isOnece) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self loadStartSVGAPlayer];
|
||||
});
|
||||
@@ -417,6 +453,9 @@ static NSString *PLAY_IMAGE = @"play_image";
|
||||
__weak typeof(self)weakSelf = self;
|
||||
_svagView.didFinishedDisplay = ^(QXEffectSvgaView * _Nonnull svgaView) {
|
||||
[svgaView destroySvga];
|
||||
if (weakSelf.isOnece) {
|
||||
return;
|
||||
}
|
||||
[weakSelf loadEndSvgaPlayer];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user