ソースを参照

编辑页面UI && 录制页面来回跳转fixed

Chris 5 年 前
コミット
d3ae3a5f3a

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Vendor/ProgressView/QUProgressView.m

@@ -83,7 +83,7 @@
     
     CGFloat w = CGRectGetWidth(self.superview.bounds);
     
-    NSLog(@"----videoCount == %ld", _videoCount);
+//    NSLog(@"----videoCount == %ld", _videoCount);
     for (int i = 0; i < _videoCount; i++) {
         CGFloat sp = [_pointArray[i] floatValue];
         if (i == _selectedIndex) {
@@ -98,7 +98,7 @@
         CGContextStrokePath(context);
     }
     
-    NSLog(@"----pointArray.count == %ld", _pointArray.count);
+//    NSLog(@"----pointArray.count == %ld", _pointArray.count);
     for (int i = 0; i < _pointArray.count; i++) {
         CGFloat p = [_pointArray[i] floatValue];
         CGContextSetStrokeColorWithColor(context, _colorSepatorPoint.CGColor);

+ 40 - 45
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -72,7 +72,10 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 @property(nonatomic, strong) AliyunTimelineView *currentTimelineView;
 @property(nonatomic, strong) UIButton *backgroundTouchButton;
 @property(nonatomic, strong) UILabel *currentTimeLabel;
+@property(nonatomic, strong) UILabel *totalTimeLabel;
 @property(nonatomic, strong) UIButton *playButton;
+@property(nonatomic, strong) UISlider *playSlider;
+@property(nonatomic, assign) CGFloat totalDuration;
 
 @property(nonatomic, strong) AliyunEditor *editor;
 @property(nonatomic, strong) id<AliyunIPlayer> player;
@@ -254,17 +257,35 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     [self.view addSubview:self.filterButton];
     [self.view addSubview:self.speedButton];
     
+    [self.view addSubview:self.playButton];
     
-    
-    self.currentTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake((ScreenWidth-60)/2, IS_IPHONEX?(SafeTop-10):0, 60, 12)];
-    self.currentTimeLabel.backgroundColor = RGBToColor(27, 33, 51);
+    // 当前播放时间
+    self.currentTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, ScreenHeight-SafeBottom-31-15, 32, 15)];
+    self.currentTimeLabel.backgroundColor = [UIColor clearColor];
     self.currentTimeLabel.textColor = [UIColor whiteColor];
     self.currentTimeLabel.textAlignment = NSTextAlignmentCenter;
     self.currentTimeLabel.font = [UIFont systemFontOfSize:11];
-    self.currentTimeLabel.center = CGPointMake(ScreenWidth / 2,self.currentTimelineView.frame.origin.y + CGRectGetHeight(self.currentTimelineView.bounds) + 6);
     [self.view addSubview:self.currentTimeLabel];
     
-    [self.view addSubview:self.playButton];
+    // 总时长
+    self.totalTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth-14-32, ScreenHeight-SafeBottom-31-15, 32, 15)];
+    self.totalTimeLabel.backgroundColor = [UIColor clearColor];
+    self.totalTimeLabel.textColor = [UIColor whiteColor];
+    self.totalTimeLabel.textAlignment = NSTextAlignmentCenter;
+    self.totalTimeLabel.font = [UIFont systemFontOfSize:11];
+    [self.view addSubview:self.totalTimeLabel];
+    
+    // slider
+    self.playSlider = [[UISlider alloc] initWithFrame:CGRectMake(84, ScreenHeight-SafeBottom-37-5, ScreenWidth-84-55, 5)];
+    self.playSlider.value = 0;
+    self.playSlider.thumbTintColor = [UIColor whiteColor];
+    // 区域颜色
+    self.playSlider.minimumTrackTintColor = [UIColor whiteColor];
+    self.playSlider.maximumTrackTintColor = rgba(0, 0, 0, 0.3);
+    //
+    [self.playSlider setThumbImage:[UIImage imageNamed:@"edit_topic_delete"] forState:UIControlStateNormal];
+    [self.playSlider setThumbImage:[UIImage imageNamed:@"edit_topic_delete"] forState:UIControlStateHighlighted];
+    [self.view addSubview:_playSlider];
 }
 
 /**
@@ -356,6 +377,11 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
             [self resume];
         }
     }
+    
+    // 获取总时长
+    self.totalDuration = [self.player getDuration];
+    self.totalTimeLabel.text = [self stringFromTimeInterval:self.totalDuration];
+    
     //从发布合成界面返回重新开始编辑并播放
     [self.editor startEdit];
     [self play];
@@ -398,29 +424,15 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 #pragma mark - Getter
 - (UIButton *)playButton {
     if (!_playButton) {
-        CGFloat height = 32;
-        CGFloat width = 120;
-        _playButton =[[UIButton alloc] initWithFrame:CGRectMake(0, 0, width, height)];
+        CGFloat height = 40;
+        CGFloat width = 40;
+        _playButton =[[UIButton alloc] initWithFrame:CGRectMake(3, ScreenHeight-SafeBottom-19-height, width, height)];
         [_playButton setImage:_uiConfig.pauseImage forState:UIControlStateNormal];
         [_playButton setImage:_uiConfig.playImage forState:UIControlStateSelected];
         [_playButton setAdjustsImageWhenHighlighted:NO];
         [_playButton addTarget:self
                         action:@selector(playControlClick:)
               forControlEvents:UIControlEventTouchUpInside];
-        [_playButton setTitle:@"暂停播放" forState:UIControlStateNormal];
-        [_playButton setTitle:@"播放全片" forState:UIControlStateSelected];
-        [_playButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
-        [_playButton setBackgroundColor:[UIColor colorWithRed:0
-                                                        green:0
-                                                         blue:0
-                                                        alpha:0.5]];
-        _playButton.layer.cornerRadius = height / 2;
-        CGFloat cy = ScreenHeight - 125 - 2 * SafeTop;
-        CGFloat cxBeside = width / 2 - height / 2;
-        CGFloat cx = ScreenWidth - cxBeside;
-        _playButton.center = CGPointMake(cx, cy);
-        [_playButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 16)];
-        [_playButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
         _playButton.clipsToBounds = YES;
     }
     return _playButton;
@@ -813,10 +825,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     if (view) {
         [self p_showEffectView:view duration:animationTime];
     }
-    //播放按钮位置
-    CGPoint current = self.playButton.center;
-    current.y = ScreenHeight - 250 - SafeTop * 2;
-    self.playButton.center = current;
 }
 
 /**
@@ -845,11 +853,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     } else {
         [self p_dismissBackgroundButton];
     }
-    
-    //播放按钮位置
-    CGPoint current = self.playButton.center;
-    current.y = ScreenHeight - 125 - SafeTop * 2;
-    self.playButton.center = current;
 }
 
 /**
@@ -1115,8 +1118,12 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
         // 2.添加动图时,如果遮罩层在动,那么对于缩略图来说,他不能动,因为如果2者同时动的话,用户体验不好,所有有这个判断
         [self.currentTimelineView seekToTime:streamSec];
     }
+    
     self.currentTimeLabel.text = [self stringFromTimeInterval:streamSec];
-        
+    
+    // 刷新进度条
+    double time = streamSec / _totalDuration;
+    self.playSlider.value = time;
 }
 
 - (void)seekDidEnd {
@@ -1127,9 +1134,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     NSInteger ti = (NSInteger)interval;
     NSInteger seconds = ti % 60;
     NSInteger minutes = (ti / 60) % 60;
-    NSInteger hours = (ti / 3600);
-    return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", (long)hours,
-            (long)minutes, (long)seconds];
+    return [NSString stringWithFormat:@"%02ld:%02ld", (long)minutes, (long)seconds];
 }
 
 - (void)playError:(int)errorCode {
@@ -1148,15 +1153,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
     }
 }
 
-- (int)customRender:(int)srcTexture size:(CGSize)size {
-    // 自定义滤镜渲染
-    //    if (!self.filter) {
-    //        self.filter = [[AliyunCustomFilter alloc] initWithSize:size];
-    //    }
-    //    return [self.filter render:srcTexture size:size];
-    return srcTexture;
-}
-
 #pragma mark - AliyunIExporterCallback
 
 - (void)exporterDidStart {
@@ -1296,7 +1292,6 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 - (void)timelineDraggingAtTime:(CGFloat)time {
     [self.player seek:time];
     self.currentTimeLabel.text = [self stringFromTimeInterval:time];
-    NSLog(@"短视频编辑播放器测试::预览视图更新%.2f",time);
     [self updateUIAndDataWhenPlayStatusChanged];
 }
 

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.h

@@ -35,7 +35,7 @@
 @property (nonatomic, copy, nullable) void (^editBlock)(void);
 
 // 
-@property (nonatomic, copy) void (^hideSegmentBlock)(BOOL isHidden);
+@property (nonatomic, copy, nullable) void (^hideSegmentBlock)(BOOL isHidden);
 
 @end
 

+ 4 - 6
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m

@@ -559,7 +559,7 @@
 
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
-    [self starPreview];
+    
     _magicCameraView.musicButton.enabled = ![_clipManager partCount];
     NSLog(@"%zd",[_clipManager partCount]);
     [[UIApplication sharedApplication] setIdleTimerDisabled:YES];//录制模块禁止自动熄屏
@@ -844,7 +844,7 @@
         
 //        CGFloat percent = duration / _clipManager.maxDuration;
         [self.magicCameraView recordingPercent:duration];
-        _recordingDuration = duration;
+        self.recordingDuration = duration;
     });
 }
 
@@ -1047,13 +1047,11 @@
 }
 
 - (void)listDidAppear {
-//    recorder.startPreview()
-    NSLog(@"----listDidAppear");
+    [self starPreview];
 }
 
 - (void)listDidDisappear {
-//    recorder.stopPreview()
-    NSLog(@"----listDidDisappear");
+    [self stopPreview];
 }
 
 @end