|
@@ -13,9 +13,7 @@
|
|
#import "AlivcDefine.h"
|
|
#import "AlivcDefine.h"
|
|
#import "AliyunEditViewController.h"
|
|
#import "AliyunEditViewController.h"
|
|
#import <AliyunVideoSDKPro/AVAsset+AliyunSDKInfo.h>
|
|
#import <AliyunVideoSDKPro/AVAsset+AliyunSDKInfo.h>
|
|
-#import <AliyunVideoSDKPro/AliyunAlphaAction.h>
|
|
|
|
#import <AliyunVideoSDKPro/AliyunAudioRecorder.h>
|
|
#import <AliyunVideoSDKPro/AliyunAudioRecorder.h>
|
|
-#import <AliyunVideoSDKPro/AliyunCustomAction.h>
|
|
|
|
#import <AliyunVideoSDKPro/AliyunEditor.h>
|
|
#import <AliyunVideoSDKPro/AliyunEditor.h>
|
|
#import <AliyunVideoSDKPro/AliyunEffectMusic.h>
|
|
#import <AliyunVideoSDKPro/AliyunEffectMusic.h>
|
|
#import <AliyunVideoSDKPro/AliyunErrorCode.h>
|
|
#import <AliyunVideoSDKPro/AliyunErrorCode.h>
|
|
@@ -43,7 +41,6 @@
|
|
//其它
|
|
//其它
|
|
#import "AVAsset+VideoInfo.h"
|
|
#import "AVAsset+VideoInfo.h"
|
|
#import "AliAssetImageGenerator.h"
|
|
#import "AliAssetImageGenerator.h"
|
|
-#import "AlivcCoverImageSelectedView.h"
|
|
|
|
#import "AliyunCustomFilter.h"
|
|
#import "AliyunCustomFilter.h"
|
|
#import "AliyunEffectFilterView.h"
|
|
#import "AliyunEffectFilterView.h"
|
|
#import "AliyunEffectTimeFilterView.h"
|
|
#import "AliyunEffectTimeFilterView.h"
|
|
@@ -52,7 +49,6 @@
|
|
#import "AlivcAlertView.h"
|
|
#import "AlivcAlertView.h"
|
|
|
|
|
|
//底部UI适配
|
|
//底部UI适配
|
|
-#import "AlivcEditItemManager.h"
|
|
|
|
#import "AlivcEditItemModel.h"
|
|
#import "AlivcEditItemModel.h"
|
|
|
|
|
|
//用户操作事件,目前特效里长按特效和缩略图滑动互斥,长按特效优先
|
|
//用户操作事件,目前特效里长按特效和缩略图滑动互斥,长按特效优先
|
|
@@ -70,26 +66,23 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
// TODO:此类需再抽一层,否则会太庞大
|
|
// TODO:此类需再抽一层,否则会太庞大
|
|
@interface AliyunEditViewController () <
|
|
@interface AliyunEditViewController () <
|
|
-AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDelegate ,AlivcCoverImageSelectedViewDelegate,AliyunEffectTimeFilterDelegate>
|
|
|
|
|
|
+AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDelegate ,AliyunEffectTimeFilterDelegate>
|
|
|
|
|
|
@property(nonatomic, strong) UIView *movieView;
|
|
@property(nonatomic, strong) UIView *movieView;
|
|
@property(nonatomic, strong) AliyunTimelineView *currentTimelineView;
|
|
@property(nonatomic, strong) AliyunTimelineView *currentTimelineView;
|
|
@property(nonatomic, strong) UIButton *backgroundTouchButton;
|
|
@property(nonatomic, strong) UIButton *backgroundTouchButton;
|
|
@property(nonatomic, strong) UILabel *currentTimeLabel;
|
|
@property(nonatomic, strong) UILabel *currentTimeLabel;
|
|
@property(nonatomic, strong) UIButton *playButton;
|
|
@property(nonatomic, strong) UIButton *playButton;
|
|
-@property(nonatomic, strong) UIView *playButtonConView;
|
|
|
|
|
|
|
|
@property(nonatomic, strong) AliyunEditor *editor;
|
|
@property(nonatomic, strong) AliyunEditor *editor;
|
|
@property(nonatomic, strong) id<AliyunIPlayer> player;
|
|
@property(nonatomic, strong) id<AliyunIPlayer> player;
|
|
@property(nonatomic, strong) id<AliyunIExporter> exporter;
|
|
@property(nonatomic, strong) id<AliyunIExporter> exporter;
|
|
@property(nonatomic, strong) id<AliyunIClipConstructor> clipConstructor;
|
|
@property(nonatomic, strong) id<AliyunIClipConstructor> clipConstructor;
|
|
-@property(nonatomic, strong) AliyunEffectImage *paintImage;
|
|
|
|
@property (nonatomic, assign) BOOL hasUesedintelligentFilter;
|
|
@property (nonatomic, assign) BOOL hasUesedintelligentFilter;
|
|
|
|
|
|
@property (nonatomic, strong) AliyunEffectFilterInfo *intelligentFilter;
|
|
@property (nonatomic, strong) AliyunEffectFilterInfo *intelligentFilter;
|
|
@property(nonatomic, strong) AliyunEffectFilterView *filterView;
|
|
@property(nonatomic, strong) AliyunEffectFilterView *filterView;
|
|
@property(nonatomic, strong) AliyunEffectTimeFilterView *timeFilterView;
|
|
@property(nonatomic, strong) AliyunEffectTimeFilterView *timeFilterView;
|
|
-@property(nonatomic, strong) AlivcCoverImageSelectedView *coverSelectedView;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
用户操作的记录
|
|
用户操作的记录
|
|
@@ -106,12 +99,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
*/
|
|
*/
|
|
@property(nonatomic, strong) AliyunEffectTimeFilter *currentTimeFilter;
|
|
@property(nonatomic, strong) AliyunEffectTimeFilter *currentTimeFilter;
|
|
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- 封面图
|
|
|
|
- */
|
|
|
|
-@property(nonatomic, strong, nullable) UIImage *coverImage;
|
|
|
|
-
|
|
|
|
@property(nonatomic, strong) AliyunDBHelper *dbHelper;
|
|
@property(nonatomic, strong) AliyunDBHelper *dbHelper;
|
|
|
|
|
|
@property(nonatomic, assign) BOOL isExporting;
|
|
@property(nonatomic, assign) BOOL isExporting;
|
|
@@ -127,10 +114,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
@property(nonatomic, assign) CGSize outputSize;
|
|
@property(nonatomic, assign) CGSize outputSize;
|
|
@property(nonatomic, strong) AliyunCustomFilter *filter;
|
|
@property(nonatomic, strong) AliyunCustomFilter *filter;
|
|
|
|
|
|
-@property(nonatomic, strong) UIButton *saveButton; //保存
|
|
|
|
-
|
|
|
|
-@property(nonatomic, strong) UIButton *cancelButton; //取消
|
|
|
|
-
|
|
|
|
@property(nonatomic, strong) UIButton *backButton; //返回按钮
|
|
@property(nonatomic, strong) UIButton *backButton; //返回按钮
|
|
|
|
|
|
@property(nonatomic, strong) UIButton *publishButton; //发布按钮
|
|
@property(nonatomic, strong) UIButton *publishButton; //发布按钮
|
|
@@ -468,18 +451,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
return _timeFilterView;
|
|
return _timeFilterView;
|
|
}
|
|
}
|
|
|
|
|
|
-//封面选择
|
|
|
|
-- (AlivcCoverImageSelectedView *)coverSelectedView {
|
|
|
|
- if (!_coverSelectedView) {
|
|
|
|
- _coverSelectedView = [[AlivcCoverImageSelectedView alloc]
|
|
|
|
- initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, 120)];
|
|
|
|
- _coverSelectedView.timelineView = [self getOneTimeLineView];
|
|
|
|
- _coverSelectedView.delegate = self;
|
|
|
|
- [self.view addSubview:_coverSelectedView];
|
|
|
|
- }
|
|
|
|
- return _coverSelectedView;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
- (AliyunDBHelper *)dbHelper {
|
|
- (AliyunDBHelper *)dbHelper {
|
|
if (!_dbHelper) {
|
|
if (!_dbHelper) {
|
|
_dbHelper = [[AliyunDBHelper alloc] init];
|
|
_dbHelper = [[AliyunDBHelper alloc] init];
|
|
@@ -488,41 +459,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
return _dbHelper;
|
|
return _dbHelper;
|
|
}
|
|
}
|
|
|
|
|
|
-- (UIButton *)saveButton {
|
|
|
|
- if (!_saveButton) {
|
|
|
|
- _saveButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
- [_saveButton setTitle:[@"保存" localString] forState:UIControlStateNormal];
|
|
|
|
- [_saveButton setTitle:[@"保存" localString]
|
|
|
|
- forState:UIControlStateSelected];
|
|
|
|
- [_saveButton setTitleColor:[UIColor whiteColor]
|
|
|
|
- forState:UIControlStateNormal];
|
|
|
|
- [_saveButton setTitleColor:[UIColor whiteColor]
|
|
|
|
- forState:UIControlStateSelected];
|
|
|
|
- [_saveButton addTarget:self
|
|
|
|
- action:@selector(apply)
|
|
|
|
- forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
- }
|
|
|
|
- return _saveButton;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-- (UIButton *)cancelButton {
|
|
|
|
- if (!_cancelButton) {
|
|
|
|
- _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
- [_cancelButton setTitle:[@"取消" localString]
|
|
|
|
- forState:UIControlStateNormal];
|
|
|
|
- [_cancelButton setTitle:[@"取消" localString]
|
|
|
|
- forState:UIControlStateSelected];
|
|
|
|
- [_cancelButton setTitleColor:[UIColor whiteColor]
|
|
|
|
- forState:UIControlStateNormal];
|
|
|
|
- [_cancelButton setTitleColor:[UIColor whiteColor]
|
|
|
|
- forState:UIControlStateSelected];
|
|
|
|
- [_cancelButton addTarget:self
|
|
|
|
- action:@selector(cancel)
|
|
|
|
- forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
- }
|
|
|
|
- return _cancelButton;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
- (UIButton *)backButton {
|
|
- (UIButton *)backButton {
|
|
if (!_backButton) {
|
|
if (!_backButton) {
|
|
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
@@ -740,11 +676,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
- (void)applicationWillResignActive {
|
|
- (void)applicationWillResignActive {
|
|
if (self.isAppear) {
|
|
if (self.isAppear) {
|
|
self.isBackground = YES;
|
|
self.isBackground = YES;
|
|
- // 特效正在添加过程中
|
|
|
|
- if (_processAnimationFilter &&
|
|
|
|
- _editSouceClickType == AliyunEditSouceClickTypeEffect) {
|
|
|
|
- [self pause];
|
|
|
|
- }
|
|
|
|
|
|
|
|
// app退到后台前先停止滑动,否则播放器状态在特定情境下会出现异常
|
|
// app退到后台前先停止滑动,否则播放器状态在特定情境下会出现异常
|
|
[self.currentTimelineView stopSlid];
|
|
[self.currentTimelineView stopSlid];
|
|
@@ -925,8 +856,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
根据编辑类型判断这个编辑类型是否能对视频逐帧操作,局部处理
|
|
根据编辑类型判断这个编辑类型是否能对视频逐帧操作,局部处理
|
|
能的类型整理:
|
|
能的类型整理:
|
|
//音乐 AliyunEditSouceClickTypeMusic
|
|
//音乐 AliyunEditSouceClickTypeMusic
|
|
- //动图 AliyunEditSouceClickTypePaster
|
|
|
|
- //字幕 AliyunEditSouceClickTypeSubtitle
|
|
|
|
//特效 AliyunEditSouceClickTypeEffect
|
|
//特效 AliyunEditSouceClickTypeEffect
|
|
//时间特效 AliyunEditSouceClickTypeTimeFilter
|
|
//时间特效 AliyunEditSouceClickTypeTimeFilter
|
|
@param type 类型
|
|
@param type 类型
|
|
@@ -934,13 +863,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
*/
|
|
*/
|
|
- (BOOL)isEditFrameType:(AliyunEditSouceClickType)type {
|
|
- (BOOL)isEditFrameType:(AliyunEditSouceClickType)type {
|
|
if (type == AliyunEditSouceClickTypeMusic ||
|
|
if (type == AliyunEditSouceClickTypeMusic ||
|
|
- type == AliyunEditSouceClickTypePaster ||
|
|
|
|
- type == AliyunEditSouceClickTypeCaption ||
|
|
|
|
- type == AliyunEditSouceClickTypeEffect ||
|
|
|
|
- type == AliyunEditSouceClickTypeTimeFilter ||
|
|
|
|
- type == AliyunEditSouceClickTypeTranslation ||
|
|
|
|
- type == AliyunEditSouceClickTypePaint ||
|
|
|
|
- type == AliyunEditSouceClickTypeCover) {
|
|
|
|
|
|
+ type == AliyunEditSouceClickTypeTimeFilter) {
|
|
return YES;
|
|
return YES;
|
|
}
|
|
}
|
|
return NO;
|
|
return NO;
|
|
@@ -963,9 +886,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
case AliyunEditSouceClickTypeTimeFilter:
|
|
case AliyunEditSouceClickTypeTimeFilter:
|
|
return self.timeFilterView;
|
|
return self.timeFilterView;
|
|
break;
|
|
break;
|
|
- case AliyunEditSouceClickTypeCover:
|
|
|
|
- return self.coverSelectedView;
|
|
|
|
- break;
|
|
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1060,8 +980,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
让界面进入能编辑视频帧的模式
|
|
让界面进入能编辑视频帧的模式
|
|
*/
|
|
*/
|
|
- (void)p_changeUIToEnterEditFrameModeCompletionHandle:(void (^__nullable)(BOOL finished))completion {
|
|
- (void)p_changeUIToEnterEditFrameModeCompletionHandle:(void (^__nullable)(BOOL finished))completion {
|
|
- [self.saveButton sizeToFit];
|
|
|
|
- [self.cancelButton sizeToFit];
|
|
|
|
self.backButton.hidden = YES;
|
|
self.backButton.hidden = YES;
|
|
self.publishButton.hidden = YES;
|
|
self.publishButton.hidden = YES;
|
|
CGRect editFrame = [self editStatusFrameMovieView];
|
|
CGRect editFrame = [self editStatusFrameMovieView];
|
|
@@ -1081,8 +999,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
界面退出编辑模式
|
|
界面退出编辑模式
|
|
*/
|
|
*/
|
|
- (void)p_changeUIToQuitEditFrameMode {
|
|
- (void)p_changeUIToQuitEditFrameMode {
|
|
- [self.saveButton removeFromSuperview];
|
|
|
|
- [self.cancelButton removeFromSuperview];
|
|
|
|
self.backButton.hidden = NO;
|
|
self.backButton.hidden = NO;
|
|
self.publishButton.hidden = NO;
|
|
self.publishButton.hidden = NO;
|
|
[self p_setMovieViewFrameToPlayStatusWithAnimation];
|
|
[self p_setMovieViewFrameToPlayStatusWithAnimation];
|
|
@@ -1374,7 +1290,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
|
|
|
//时间轴拖动事件
|
|
//时间轴拖动事件
|
|
- (void)timelineBeginDragging {
|
|
- (void)timelineBeginDragging {
|
|
- // NSLog(@"timelineBeginDragging");
|
|
|
|
self.userAction = AliyunEditUserEvent_Effect_Slider;
|
|
self.userAction = AliyunEditUserEvent_Effect_Slider;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1392,14 +1307,12 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
if (_prePlaying) {
|
|
if (_prePlaying) {
|
|
[self resume];
|
|
[self resume];
|
|
}
|
|
}
|
|
- // NSLog(@"短视频编辑播放器测试:结束滑动预览视图更新%.2f",time);
|
|
|
|
self.userAction = AliyunEditUserEvent_None;
|
|
self.userAction = AliyunEditUserEvent_None;
|
|
}
|
|
}
|
|
|
|
|
|
- (void)timelineEditDraggingAtTime:(CGFloat)time {
|
|
- (void)timelineEditDraggingAtTime:(CGFloat)time {
|
|
_isEidtTuchAction = YES;
|
|
_isEidtTuchAction = YES;
|
|
[self.player seek:time];
|
|
[self.player seek:time];
|
|
- // NSLog(@"timelineEditDraggingAtTime");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|