瀏覽代碼

合成页面进度处理为ms进行处理

Steven 9 月之前
父節點
當前提交
d3cf23c29b

+ 1 - 1
KulexiuForStudent/KulexiuForStudent.xcodeproj/xcshareddata/xcschemes/KulexiuForStudent.xcscheme

@@ -51,7 +51,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Debug"
+      buildConfiguration = "TEST"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 6 - 6
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

@@ -172,6 +172,7 @@
     [self.contrlView configWithOffsetTime:0];
     self.contrlView.hideBackView = NO;
     [self configUI];
+    [LOADING_MANAGER showCustomLoading:@"资源下载中"];
     [self modifyBgSpeed:self.bgAudioUrl callback:^{
         [self configPlayer];
     }];
@@ -241,7 +242,6 @@
 // 修改文件速度
 - (void)modifyBgSpeed:(NSURL *)musicUrl callback:(void(^)(void))callback {
     if (self.musicSpeed > 1.0 || self.musicSpeed < 1.0) {
-        [LOADING_MANAGER showCustomLoading:@"资源下载中"];
         [KSMediaEditor modifyAudioFileSpeed:musicUrl rate:self.musicSpeed completion:^(NSString * _Nonnull outPath, BOOL isSuccess, NSString * _Nonnull desc) {
             if (isSuccess) {
                 self.bgAudioUrl = [NSURL fileURLWithPath:outPath];
@@ -409,7 +409,7 @@
 - (void)refreshTotalTime {
     NSInteger realOffsetTime = self.offsetTime + self.evaluateDelay;
     [self.mergePlayer changeRecordDelay:realOffsetTime];
-    float totalTime = [self.mergePlayer getTotalTime] / 1000.0;
+    float totalTime = [self.mergePlayer getTotalTime];
     [self.playControlView configWithDuration:totalTime];
 }
 
@@ -464,7 +464,7 @@
     self.playControlView.isPlay = YES;
     self.animationView.isPlay = YES;
     
-    NSInteger playPosition = self.playControlView.playScheduleTime*1000;
+    NSInteger playPosition = self.playControlView.playScheduleTime;
     NSInteger realOffsetTime = self.offsetTime + self.evaluateDelay;
     [self.mergePlayer changeRecordDelay:realOffsetTime];
     [self.mergePlayer seekToTimePlay:playPosition];
@@ -507,12 +507,12 @@
         case PLAYERTYPE_RATE:
         {
             if (self.mergePlayer.isPlaying) {
-                [self.mergePlayer seekToTimePlay:rate*1000];
+                [self.mergePlayer seekToTimePlay:rate];
             }
             
             if (self.isVideoPlay) {
 //                NSInteger realOffsetTime = self.offsetTime + self.evaluateDelay;
-                [self.videoView seekOffsetTime:rate*1000];
+                [self.videoView seekOffsetTime:rate];
             }
         }
             break;
@@ -947,7 +947,7 @@
     NSLog(@"----- offset %f ", playTime - videoTime);
      */
     dispatch_main_async_safe(^{
-        self.playControlView.playScheduleTime = (NSInteger)(playTime / 1000);
+        self.playControlView.playScheduleTime = playTime;
     });
 }
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSPlayerSliderView.h

@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 + (instancetype)shareInstance;
 
-- (void)configWithDuration:(NSInteger)totalDuration;
+- (void)configWithDuration:(NSInteger)totalDurationMs;
 
 - (void)sliderControlAction:(KSPlayerSliderActionCallback)callback;
 

+ 3 - 3
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSPlayerSliderView.m

@@ -137,7 +137,7 @@
 
 - (void)configScheduleTime:(NSInteger)playTime {
     _playScheduleTime = playTime;
-    self.playTime.text  = [NSString stringWithFormat:@"%.2d:%.2d", (int)playTime / 60, (int)playTime % 60];
+    self.playTime.text  = [NSString stringWithFormat:@"%.2d:%.2d", (int)(playTime/1000) / 60, (int)(playTime/1000) % 60];
 }
 
 - (void)setIsPlay:(BOOL)isPlay {
@@ -154,12 +154,12 @@
 
 - (void)setTotalDuration:(NSInteger)totalDuration {
     _totalDuration = totalDuration;
-    self.fullTime.text  = [NSString stringWithFormat:@"%.2d:%.2d", (int)totalDuration / 60, (int)totalDuration % 60];
+    self.fullTime.text  = [NSString stringWithFormat:@"%.2d:%.2d", (int)(totalDuration/1000) / 60, (int)(totalDuration/1000) % 60];
 }
 
 - (void)setPlayScheduleTime:(NSInteger)playScheduleTime {
     _playScheduleTime = playScheduleTime;
-    self.playTime.text  = [NSString stringWithFormat:@"%.2d:%.2d", (int)playScheduleTime / 60, (int)playScheduleTime % 60];
+    self.playTime.text  = [NSString stringWithFormat:@"%.2d:%.2d", (int)(playScheduleTime/1000) / 60, (int)(playScheduleTime/1000) % 60];
     if (_isDragingSlider == NO) {
         self.progressSlider.value = playScheduleTime;
     }

+ 9 - 4
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/MergePlayer/KSMergeEnginePlayer.m

@@ -385,10 +385,9 @@
 - (void)stopPlay {
     self.stopMix = YES;
     self.stopChangeVolume = YES;
-    if (self.isPlaying) {
+    if (self.nodePlayer.isPlaying) {
         [self.nodePlayer stop];
     }
-    self.isPlaying = NO;
     [self stopTimer];
 }
 
@@ -421,7 +420,6 @@
 
     if (needPlay) {
         [self.nodePlayer play];
-        self.isPlaying = YES;
         [self startTimer];
     }
 }
@@ -435,7 +433,7 @@
 
 - (void)freePlayer {
     
-    if (self.isPlaying) {
+    if (self.nodePlayer.isPlaying) {
         [self stopPlay];
     }
     [self.audioEngine stop];
@@ -525,4 +523,11 @@
     NSTimeInterval recordTotalDuration = (AVAudioFramePosition)self.audioFile.length * 1000.0 / self.audioFormat.sampleRate;
     return recordTotalDuration;
 }
+
+- (BOOL)isPlaying {
+    if (self.nodePlayer) {
+        return self.nodePlayer.isPlaying;
+    }
+    return NO;
+}
 @end