|
@@ -47,6 +47,7 @@
|
|
|
#import "AliyunMusicPickViewController.h"
|
|
|
#import "AlivcMacro.h"
|
|
|
#import "AlivcAlertView.h"
|
|
|
+#import "AliyunRateSelectView.h"
|
|
|
#import "MXSlider.h"
|
|
|
|
|
|
//底部UI适配
|
|
@@ -87,6 +88,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
@property (nonatomic, strong) AliyunEffectFilterInfo *intelligentFilter;
|
|
|
@property(nonatomic, strong) AliyunEffectFilterView *filterView;
|
|
|
@property(nonatomic, strong) AliyunEffectTimeFilterView *timeFilterView;
|
|
|
+@property (nonatomic, strong) UIView *rateViewWithDim;
|
|
|
|
|
|
/**
|
|
|
用户操作的记录
|
|
@@ -247,7 +249,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
y = SafeTop;
|
|
|
}
|
|
|
[self.view addSubview:self.backButton];
|
|
|
-
|
|
|
self.backButton.frame = CGRectMake(5, SafeTop + 2, 40, 40);
|
|
|
|
|
|
//发布按钮
|
|
@@ -286,7 +287,39 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
//
|
|
|
[self.playSlider setThumbImage:[UIImage imageNamed:@"music_btn_dot"] forState:UIControlStateNormal];
|
|
|
[self.playSlider setThumbImage:[UIImage imageNamed:@"music_btn_dot"] forState:UIControlStateHighlighted];
|
|
|
+ [self.playSlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
|
|
|
[self.view addSubview:_playSlider];
|
|
|
+
|
|
|
+ // 播放速度选择View
|
|
|
+ UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dimRateViewTapGesture)];
|
|
|
+ self.rateViewWithDim = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
|
|
|
+ self.rateViewWithDim.backgroundColor = [UIColor clearColor];
|
|
|
+ self.rateViewWithDim.hidden = true;
|
|
|
+ [self.rateViewWithDim addGestureRecognizer:tapGesture];
|
|
|
+ [self.view addSubview:self.rateViewWithDim];
|
|
|
+
|
|
|
+ CGFloat rateViewH = 40;
|
|
|
+ CGFloat rateViewY = ScreenHeight-SafeBottom-98-rateViewH;
|
|
|
+ AliyunRateSelectView *rateView = [[AliyunRateSelectView alloc] initWithItems:@[@"极慢",@"慢",@"标准",@"快",@"极快"]];
|
|
|
+ rateView.frame = CGRectMake(14,rateViewY, ScreenWidth-28, rateViewH);
|
|
|
+ rateView.layer.cornerRadius = 20;
|
|
|
+ rateView.layer.masksToBounds = YES;
|
|
|
+ rateView.selectedSegmentIndex = 2;
|
|
|
+ [rateView addTarget:self action:@selector(rateChanged:) forControlEvents:UIControlEventValueChanged];
|
|
|
+ [self.rateViewWithDim addSubview:rateView];
|
|
|
+}
|
|
|
+
|
|
|
+// slider变动时改变播放进度
|
|
|
+- (void)sliderValueChanged:(id)sender {
|
|
|
+ UISlider *slider = (UISlider *)sender;
|
|
|
+
|
|
|
+ CGFloat sliderRate = slider.value / slider.maximumValue;
|
|
|
+ CGFloat seekTime = _totalDuration * sliderRate;
|
|
|
+
|
|
|
+ [self.player seek:seekTime];
|
|
|
+ if (_prePlaying) {
|
|
|
+ [self resume];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -638,6 +671,39 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
[self tryExport];
|
|
|
}
|
|
|
|
|
|
+- (void)dimRateViewTapGesture {
|
|
|
+ self.rateViewWithDim.hidden = true;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ 速度选择控件的点击时间
|
|
|
+
|
|
|
+ @param rateView 速度选择控件
|
|
|
+ */
|
|
|
+- (void)rateChanged:(AliyunRateSelectView *)rateView {
|
|
|
+ CGFloat rate = 1.0f;
|
|
|
+ switch (rateView.selectedSegmentIndex) {
|
|
|
+ case 0:
|
|
|
+ rate = 0.5f;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ rate = 0.75f;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ rate = 1.0f;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ rate = 1.5f;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ rate = 2.0f;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ [self didSelectMomentChangedWithRate:rate];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - Notification
|
|
|
|
|
|
- (void)addNotifications {
|
|
@@ -1345,20 +1411,22 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
|
|
|
//时间特效
|
|
|
- (void)timeButtonClicked {
|
|
|
- AliyunClip *clip = self.clipConstructor.mediaClips[0];
|
|
|
- if (self.clipConstructor.mediaClips.count > 1 || clip.mediaType == 1) {
|
|
|
- MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
- hud.mode = MBProgressHUDModeText;
|
|
|
- hud.label.text = @"多段视频或图片不支持时间特效";
|
|
|
- hud.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor;
|
|
|
- hud.bezelView.color = rgba(0, 0, 0, 0.7);
|
|
|
- hud.label.textColor = [UIColor whiteColor];
|
|
|
- hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
|
|
|
- [hud hideAnimated:YES afterDelay:1.5f];
|
|
|
- return;
|
|
|
- }
|
|
|
- self.currentTimelineView = self.timeFilterView.timelineView;
|
|
|
- [self enterEditWithActionType:AliyunEditSouceClickTypeTimeFilter animationCompletion:nil];
|
|
|
+ self.rateViewWithDim.hidden = false;
|
|
|
+
|
|
|
+// AliyunClip *clip = self.clipConstructor.mediaClips[0];
|
|
|
+// if (self.clipConstructor.mediaClips.count > 1 || clip.mediaType == 1) {
|
|
|
+// MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
+// hud.mode = MBProgressHUDModeText;
|
|
|
+// hud.label.text = @"多段视频或图片不支持时间特效";
|
|
|
+// hud.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor;
|
|
|
+// hud.bezelView.color = rgba(0, 0, 0, 0.7);
|
|
|
+// hud.label.textColor = [UIColor whiteColor];
|
|
|
+// hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
|
|
|
+// [hud hideAnimated:YES afterDelay:1.5f];
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// self.currentTimelineView = self.timeFilterView.timelineView;
|
|
|
+// [self enterEditWithActionType:AliyunEditSouceClickTypeTimeFilter animationCompletion:nil];
|
|
|
}
|
|
|
|
|
|
#pragma mark - AliyunEffectFilter2ViewDelegate - 滤镜
|
|
@@ -1423,6 +1491,21 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
|
|
|
}
|
|
|
|
|
|
#pragma mark - AliyunEffectTimeFilterDelegate - 时间特效
|
|
|
+/**
|
|
|
+ 改变播放速率
|
|
|
+ */
|
|
|
+- (void)didSelectMomentChangedWithRate:(CGFloat)rate {
|
|
|
+ [self didSelectNone];
|
|
|
+ AliyunEffectTimeFilter *timeFilter = [[AliyunEffectTimeFilter alloc] init];
|
|
|
+ timeFilter.startTime = 0;
|
|
|
+ timeFilter.endTime = _totalDuration;
|
|
|
+ timeFilter.type = TimeFilterTypeSpeed;
|
|
|
+ timeFilter.param = rate;
|
|
|
+ [self.editor applyTimeFilter:timeFilter];
|
|
|
+ self.currentTimeFilter = timeFilter;
|
|
|
+ [self resume];
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
应用时间特效的效果
|
|
|
*/
|