瀏覽代碼

合成版本上线

Steven 1 年之前
父節點
當前提交
d7423855d3

+ 4 - 4
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -8651,7 +8651,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForStudent/KulexiuForStudent.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.5.3;
+				CURRENT_PROJECT_VERSION = 1.5.4.1;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				ENABLE_MODULE_VERIFIER = YES;
@@ -8707,7 +8707,7 @@
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/SocialLibraries/Sina/SinaSDK",
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.5.3;
+				MARKETING_VERSION = 1.5.4;
 				MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
 				MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
 				OTHER_LDFLAGS = (
@@ -8837,7 +8837,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForStudent/KulexiuForStudent.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.5.3;
+				CURRENT_PROJECT_VERSION = 1.5.4.1;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				ENABLE_MODULE_VERIFIER = YES;
@@ -8893,7 +8893,7 @@
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/SocialLibraries/Sina/SinaSDK",
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.5.3;
+				MARKETING_VERSION = 1.5.4;
 				MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
 				MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
 				OTHER_LDFLAGS = (

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/AppDelegate.m

@@ -185,7 +185,7 @@
 }
 
 - (void)registerSDK {
-    NSString *universalLinkUrl = [NSString stringWithFormat:@"%@%@",hostURL,@"/studentApp/"];
+    NSString *universalLinkUrl = [NSString stringWithFormat:@"%@%@",@"https://online.colexiu.com",@"/studentApp/"];
     [WXApi registerApp:@"wx97408cd22c879ff7" universalLink:universalLinkUrl];
 }
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m

@@ -827,7 +827,7 @@
                     }
                 }
                 else {
-                    [LOADING_MANAGER MBShowAUTOHidingInWindow:@"当前曲目无mp3伴奏"];
+//                    [LOADING_MANAGER MBShowAUTOHidingInWindow:@"当前曲目无mp3伴奏"];
                     [self configVideoRecord:nil];
                 }
             }

+ 6 - 2
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.m

@@ -658,7 +658,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         [LOADING_MANAGER removeCustomLoading];
         NSString *fileUrl = [fileUrlArray lastObject];
         NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:content];
-        [content setValue:fileUrl forKey:@"videoCover"];
+        [dic setValue:fileUrl forKey:@"videoCover"];
         NSMutableDictionary *sendParm = [NSMutableDictionary dictionary];
         [sendParm setValue:@"videoCrop" forKey:@"api"];
         [sendParm setValue:dic forKey:@"content"];
@@ -1379,7 +1379,11 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         NSData *fileData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:fileUrl]];
         [UPLOAD_MANAGER configBucketName:self.bucketName];
         [UPLOAD_MANAGER uploadFile:fileData fileName:@"file" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
-            
+            int progress = (int)(bytesWritten / totalBytes * 100);
+            __block NSString *tipsMessage = [NSString stringWithFormat:@"上传中 %d%%",progress];
+            dispatch_main_async_safe(^{
+                [LOADING_MANAGER.loadingView setDisplayText:tipsMessage];
+            });
         } successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
             [LOADING_MANAGER removeHUD];
             NSString *fileUrl = [fileUrlArray lastObject];

+ 31 - 67
KulexiuForStudent/KulexiuForStudent/Common/Base/KSUploadManager.m

@@ -11,13 +11,6 @@
 
 @interface KSUploadManager ()<QCloudSignatureProvider>
 
-@property (nonatomic, copy) KSUploadSuccess successCallback;
-
-@property (nonatomic, copy) KSUploadFailer faliureCallback;
-
-@property (nonatomic, copy) KSUploadProgress uploadProgress;
-
-@property (nonatomic, strong) NSString *videoLinkUrl;
 
 @property (assign, nonatomic) long long fileSize;
 
@@ -75,12 +68,7 @@
 }
 
 - (void)uploadImage:(NSData *)imageData fileName:(NSString *)fileName successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-    if (success) {
-        self.successCallback = success;
-    }
-    if (faliure) {
-        self.faliureCallback = faliure;
-    }
+
     NSString *folderString = [self getDayFolder];
     NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey), fileName,[UIImage typeForImageData:imageData]];
 
@@ -89,23 +77,18 @@
     } successCallback:^(NSString *fileUrl) {
         NSMutableArray *fileUrlArray = [NSMutableArray array];
         [fileUrlArray addObject:fileUrl];
-        if (self.successCallback) {
-            self.successCallback(fileUrlArray);
+        if (success) {
+            success(fileUrlArray);
         }
     } faliure:^{
-        if (self.faliureCallback) {
-            self.faliureCallback(nil, @"上传文件失败");
+        if (faliure) {
+            faliure(nil, @"上传文件失败");
         }
     }];
 }
 
 - (void)mutilUploadImage:(NSMutableArray *)fileDataArray fileName:(NSString *)fileName successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-    if (success) {
-        self.successCallback = success;
-    }
-    if (faliure) {
-        self.faliureCallback = faliure;
-    }
+
     NSString *folderString = [self getDayFolder];
     NSMutableArray *fileNameArray = [NSMutableArray array];
     if (fileDataArray.count > 1) {
@@ -120,10 +103,10 @@
         NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey), fileName,[UIImage typeForImageData:fileData]];
         [fileNameArray addObject:uploadFileName];
     }
-    [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:[NSMutableArray array] failArray:[NSMutableArray array] fileIndex:0];
+    [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:[NSMutableArray array] failArray:[NSMutableArray array] fileIndex:0 successCallback:success faliure:faliure];
 }
 
-- (void)MutilUploadFile:(NSMutableArray *)fileNameArray fileDataArray:(NSMutableArray *)fileDataArray successArray:(NSMutableArray *)successArray failArray:(NSMutableArray *)failArray fileIndex:(NSInteger)fileIndex {
+- (void)MutilUploadFile:(NSMutableArray *)fileNameArray fileDataArray:(NSMutableArray *)fileDataArray successArray:(NSMutableArray *)successArray failArray:(NSMutableArray *)failArray fileIndex:(NSInteger)fileIndex successCallback:(KSUploadSuccess)successCallback faliure:(KSUploadFailer)faliureCallback {
     if (fileIndex >= fileNameArray.count) {
         return;
     }
@@ -136,10 +119,10 @@
         NSMutableArray *success = [NSMutableArray arrayWithArray:successArray];
         [success addObject:fileUrl];
         if (fileIndex == fileNameArray.count - 1) {
-            [self finishMutilUpload:success failArray:failArray];
+            [self finishMutilUpload:success failArray:failArray successCallback:successCallback faliure:faliureCallback];
         }
         else {
-            [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:success failArray:failArray fileIndex:fileIndex+1];
+            [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:success failArray:failArray fileIndex:fileIndex+1 successCallback:successCallback faliure:faliureCallback];
         }
         
     } faliure:^{
@@ -149,84 +132,68 @@
         [failerArray addObject:desc];
         
         if (fileIndex == fileNameArray.count - 1) {
-            [self finishMutilUpload:successArray failArray:failArray];
+            [self finishMutilUpload:successArray failArray:failerArray successCallback:successCallback faliure:faliureCallback];
         }
         else {
-            [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:successArray failArray:failerArray fileIndex:fileIndex+1];
+            [self MutilUploadFile:fileNameArray fileDataArray:fileDataArray successArray:successArray failArray:failerArray fileIndex:fileIndex+1 successCallback:successCallback faliure:faliureCallback];
         }
     }];
 }
 
-- (void)finishMutilUpload:(NSMutableArray *)successArray failArray:(NSMutableArray *)array {
+- (void)finishMutilUpload:(NSMutableArray *)successArray failArray:(NSMutableArray *)array successCallback:(KSUploadSuccess)successCallback faliure:(KSUploadFailer)faliureCallback {
     if (successArray.count > 0) {
-        if (self.successCallback) {
-            self.successCallback([successArray copy]);
+        if (successCallback) {
+            successCallback([successArray copy]);
         }
     }
     else {
-        if (self.faliureCallback) {
-            self.faliureCallback(nil,@"上传文件失败");
+        if (faliureCallback) {
+            faliureCallback(nil,@"上传文件失败");
         }
     }
 }
 
 
 - (void)videoUpload:(NSData *)fileData fileName:(NSString *)fileName fileSuffix:(NSString *)fileSuffix progress:(KSUploadProgress)uploadProgress successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-    if (success) {
-        self.successCallback = success;
-    }
-    if (faliure) {
-        self.faliureCallback = faliure;
-    }
-    if (uploadProgress) {
-        self.uploadProgress = uploadProgress;
-    }
+
     NSString *folderString = [self getDayFolder];
     NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64], UserDefault(UIDKey),fileName,fileSuffix];
 
     [self uploadFileToOssWithSource:uploadFileName fileData:fileData progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        if (self.uploadProgress) {
-            self.uploadProgress(bytesWritten, totalBytes);
+        if (uploadProgress) {
+            uploadProgress(bytesWritten, totalBytes);
         }
     } successCallback:^(NSString *fileUrl) {
         NSMutableArray *fileUrlArray = [NSMutableArray array];
         [fileUrlArray addObject:fileUrl];
-        if (self.successCallback) {
-            self.successCallback(fileUrlArray);
+        if (success) {
+            success(fileUrlArray);
         }
     } faliure:^{
-        if (self.faliureCallback) {
-            self.faliureCallback(nil, @"上传文件失败");
+        if (faliure) {
+            faliure(nil, @"上传文件失败");
         }
     }];
 }
 
 - (void)uploadFile:(NSData *)fileData fileName:(NSString *)fileName fileSuffix:(NSString *)fileSuffix progress:(KSUploadProgress)uploadProgress successCallback:(KSUploadSuccess)success faliure:(KSUploadFailer)faliure {
-    if (success) {
-        self.successCallback = success;
-    }
-    if (faliure) {
-        self.faliureCallback = faliure;
-    }
-    if (uploadProgress) {
-        self.uploadProgress = uploadProgress;
-    }
+
     NSString *folderString = [self getDayFolder];
     NSString *uploadFileName = [NSString stringWithFormat:@"%@%@%@_%@%@%@",FILE_DOMAIN,folderString,[NSDate getCurrentTimestampFor64],UserDefault(UIDKey), fileName,fileSuffix];
     
     [self uploadFileToOssWithSource:uploadFileName fileData:fileData progress:^(int64_t bytesWritten, int64_t totalBytes) {
-        if (self.uploadProgress) {
-            self.uploadProgress(bytesWritten, totalBytes);
+        if (uploadProgress) {
+            uploadProgress(bytesWritten, totalBytes);
         }
     } successCallback:^(NSString *fileUrl) {
         NSMutableArray *fileUrlArray = [NSMutableArray array];
         [fileUrlArray addObject:fileUrl];
-        if (self.successCallback) {
-            self.successCallback(fileUrlArray);
+        if (success) {
+            success(fileUrlArray);
         }
     } faliure:^{
-        if (self.faliureCallback) {
-            self.faliureCallback(nil, @"上传文件失败");
+        if (faliure) {
+            faliure(nil, @"上传文件失败");
         }
     }];
 }
@@ -293,9 +260,6 @@
         }
     } faliure:^(NSError * _Nonnull error) {
         continueBlock(nil, nil);
-        if (self.faliureCallback) {
-            self.faliureCallback(error, @"获取文件签名失败");
-        }
     }];
 }
 

+ 34 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/KSVideoRecordManager.m

@@ -102,6 +102,8 @@
     }
     if ([_captureSession canAddInput:_videoCaptureDeviceInput]) {
         [_captureSession addInput:_videoCaptureDeviceInput];
+        // 设置帧率
+        [self setMaxFrameRate:10 forDevice:_videoCaptureDeviceInput.device];
     }
     else {
         if (self.callback) {
@@ -492,4 +494,36 @@
     }
     return _videoRecordQueue;
 }
+
+- (void)setMaxFrameRate:(Float64)maxFrameRate forDevice:(AVCaptureDevice *)device {
+    @try
+    {
+        NSError *lockError = nil;
+        if ([device lockForConfiguration:&lockError])
+        {
+            NSArray *videoSupportedFrameRateRanges = device.activeFormat.videoSupportedFrameRateRanges;
+            AVFrameRateRange *minFrameRateRange = videoSupportedFrameRateRanges.firstObject;
+            for (AVFrameRateRange *range in device.activeFormat.videoSupportedFrameRateRanges)
+            {
+                if (range.minFrameRate < minFrameRateRange.minFrameRate)
+                {
+                    minFrameRateRange = range;
+                }
+            }
+            CMTime minFrameDuration = CMTimeMake(1, maxFrameRate);
+            //超出范围就取默认值
+            if (maxFrameRate < minFrameRateRange.minFrameRate || maxFrameRate > minFrameRateRange.maxFrameRate)
+            {
+                minFrameDuration = kCMTimeInvalid;
+            }
+            device.activeVideoMinFrameDuration = minFrameDuration;
+            [device unlockForConfiguration];
+            NSLog(@"OnboardingScan--打印帧数最小: %@, 最大:%@", @((int32_t)device.activeVideoMinFrameDuration.timescale).stringValue, @((int32_t)device.activeVideoMaxFrameDuration.timescale).stringValue);
+        }
+    } @catch (NSException *exception) {
+
+     } @finally {
+
+    }
+}
 @end

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/LoadingManager/KSProgressLoadingView.m

@@ -74,7 +74,7 @@
 - (void)setProgress:(NSInteger)progress {
     _progress = progress;
     CGFloat width = progress;
-    [self.progressFillImage setImage:[self createGradientImageWithColor:@[HexRGB(0x3CD6F9),HexRGB(0x1CACF1)] rect:CGRectMake(0, 0, width, 8) start:CGPointMake(0.41, 0) end:CGPointMake(0.41, 1)]];
+    [self.progressFillImage setImage:[self createGradientImageWithColor:@[HexRGB(0x44F1D0),HexRGB(0x2DC7AA)] rect:CGRectMake(0, 0, width, 8) start:CGPointMake(0.41, 0) end:CGPointMake(0.41, 1)]];
     self.imageWidth.constant = width;
 }
 

+ 20 - 20
KulexiuForStudent/KulexiuForStudent/Common/Define/KSDomain.h

@@ -32,16 +32,16 @@
 
 // 测试环境
 
-#define hostURL (@"https://test.colexiu.com")
-#define SEALCLASSHOST (@"https://test.colexiu.com/api-classroom")
-#define WEBHOST (@"https://test.colexiu.com/student")
-#define TENANT_WEBHOST (@"https://test.colexiu.com/tenant")
-#define SOCKET_URL (@"wss://test.colexiu.com/audioAnalysis")
-#define JSPUSH_ENVIRONMENT (NO)
-#define RCIM_KEY (@"0vnjpoad0jbdz")
-#define SUBMIT_UUID (NO)
-#define CONFIG_TXSDKAPPID (1400805079)
-#define TXOfflinePushCertificateIDForAPNS (39557)
+//#define hostURL (@"https://test.colexiu.com")
+//#define SEALCLASSHOST (@"https://test.colexiu.com/api-classroom")
+//#define WEBHOST (@"https://test.colexiu.com/student")
+//#define TENANT_WEBHOST (@"https://test.colexiu.com/tenant")
+//#define SOCKET_URL (@"wss://test.colexiu.com/audioAnalysis")
+//#define JSPUSH_ENVIRONMENT (NO)
+//#define RCIM_KEY (@"0vnjpoad0jbdz")
+//#define SUBMIT_UUID (NO)
+//#define CONFIG_TXSDKAPPID (1400805079)
+//#define TXOfflinePushCertificateIDForAPNS (39557)
 
 // 预生产
 //#define hostURL (@"https://ponline.colexiu.com")
@@ -57,16 +57,16 @@
 
 //#else
 
-//#define hostURL (@"https://online.colexiu.com")
-//#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
-//#define WEBHOST (@"https://online.colexiu.com/student")
-//#define TENANT_WEBHOST (@"https://online.colexiu.com//tenant")
-//#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
-//#define JSPUSH_ENVIRONMENT (YES)
-//#define RCIM_KEY (@"e5t4ouvpe42pa")
-//#define SUBMIT_UUID (YES)
-//#define CONFIG_TXSDKAPPID (1400799837)
-//#define TXOfflinePushCertificateIDForAPNS (39560)
+#define hostURL (@"https://online.colexiu.com")
+#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
+#define WEBHOST (@"https://online.colexiu.com/student")
+#define TENANT_WEBHOST (@"https://online.colexiu.com//tenant")
+#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
+#define JSPUSH_ENVIRONMENT (YES)
+#define RCIM_KEY (@"e5t4ouvpe42pa")
+#define SUBMIT_UUID (YES)
+#define CONFIG_TXSDKAPPID (1400799837)
+#define TXOfflinePushCertificateIDForAPNS (39560)
 
 //#endif
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSAudioAnimationView.m

@@ -90,7 +90,7 @@
         [self.music_image setImage:[UIImage imageNamed:@"pub_music_placeholder"]];
     }
     else {
-        [self.music_image sd_setImageWithURL:[NSURL URLWithString:[imageUrl getUrlEndcodeString]]];
+        [self.music_image sd_setImageWithURL:[NSURL URLWithString:imageUrl]];
     }
 }
 

+ 17 - 7
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

@@ -179,7 +179,7 @@
 }
 
 - (void)downloadFileSource {
-    [LOADING_MANAGER showCustomLoading:@"资源下载中..."];
+    [LOADING_MANAGER showCustomLoading:@"资源下载中"];
     
     [self downloadVideo];
     [self downloadAccompany];
@@ -580,6 +580,8 @@
     switch (type) {
         case PUBLISH_ACTION_PUBLISH:
         {
+            // 暂停播放
+            [self stopPlay];
             self.desc = [NSString isEmptyString:self.publishAlert.publishContainView.textView.text] ? @"我发布了一首演奏作品,快来听听吧~" :self.publishAlert.publishContainView.textView.text;
             if (self.settingImage || self.videoCoverImage) { // 上传图片
                 [self updateWithCoverImage];
@@ -591,13 +593,15 @@
             break;
         case PUBLISH_ACTION_CHOOSEIMG:
         {
+            // 暂停播放
+            [self stopPlay];
             // 调用相册
             self.mediaManager = [[KSMediaManager alloc] init];
             self.mediaManager.mediaType = MEDIATYPE_PHOTO;
             self.mediaManager.maxPhotoNumber = 1;
             self.mediaManager.baseCtrl = [self findViewController];
 
-            self.mediaManager.needCropImage = YES;
+            self.mediaManager.needCropImage = NO;
             MJWeakSelf;
             [self.mediaManager noAlertCallback:^(NSString * _Nullable videoUrl, NSMutableArray * _Nullable imageArray, NSMutableArray * _Nullable imageAsset) {
                 // 裁剪
@@ -617,6 +621,8 @@
             break;
         case PUBLISH_ACTION_VIDEOCOVER: // 视频封面
         {
+            // 暂停播放
+            [self stopPlay];
             self.isChooseVideoCover = YES;
             // 调用相册
             self.mediaManager = [[KSMediaManager alloc] init];
@@ -644,6 +650,8 @@
             break;
         case PUBLISH_ACTION_VIDEOCROP:
         {
+            // 暂停播放
+            [self stopPlay];
             KSVideoCropViewController *ctrl = [[KSVideoCropViewController alloc] init];
             [ctrl configWithVideoPath:self.videoUrl];
             UIViewController *baseCtrl = [self findViewController];
@@ -651,6 +659,7 @@
             [ctrl chooseCropImageCallback:^(UIImage * _Nonnull cropImage) {
                 [weakSelf displayCoverImage:cropImage];
             }];
+            ctrl.modalPresentationStyle = UIModalPresentationFullScreen;
             [baseCtrl.navigationController presentViewController:ctrl animated:YES completion:nil];
         }
             break;
@@ -676,7 +685,8 @@
 }
 
 - (void)uploadMusicCover {
-
+    NSString *tips = self.isVideoPlay ? @"视频合成中" : @"音频合成中";
+    [LOADING_MANAGER showProgressLoading:tips progress:0];
     if (self.settingImage) {
         NSData *imgData = [UIImage turnsImaegDataByImage:self.settingImage];
         NSString *fileName = @"musicCoverImg";
@@ -731,10 +741,10 @@
     CGFloat progress = 1.0/3;
     CGFloat rate = 1.0/3;
     if (self.isVideoPlay) {
-        [LOADING_MANAGER showProgressLoading:@"视频合成中..." progress:0];
+        [LOADING_MANAGER showProgressLoading:@"视频合成中" progress:0];
         
         [KSMediaEditor mixVideoWithRecordAudio:self.recordUrl recordVolume:self.recordPlayer.volume bgAudio:self.bgAudioUrl bgAudioVolume:self.bgPlayer.volume offsetTime:self.offsetTime videoUrlStr:self.videoUrl completion:^(NSString * _Nonnull outPath, BOOL isSuccess, NSString * _Nonnull desc) {
-            [LOADING_MANAGER showProgressLoading:@"视频合成中..." progress:progress];
+            [LOADING_MANAGER showProgressLoading:@"视频合成中" progress:progress];
             // 保存文件到指定文件夹
             if (isSuccess) {
                 self.filePath = outPath;
@@ -753,11 +763,11 @@
         }];
     }
     else {
-        [LOADING_MANAGER showProgressLoading:@"音频合成中..." progress:0];
+        [LOADING_MANAGER showProgressLoading:@"音频合成中" progress:0];
         NSInteger realOffsetTime = self.offsetTime;
         [KSMediaEditor mixRecordAudio:self.recordUrl recordVolume:self.recordPlayer.volume bgAudio:self.bgAudioUrl bgAudioVolume:self.bgPlayer.volume offsetTime:realOffsetTime completion:^(NSString * _Nonnull outPath, BOOL isSuccess, NSString * _Nonnull desc) {
             // 保存文件到指定文件夹
-            [LOADING_MANAGER showProgressLoading:@"音频合成中..." progress:progress];
+            [LOADING_MANAGER showProgressLoading:@"音频合成中" progress:progress];
 
             if (isSuccess) {
                 self.filePath = outPath;

+ 17 - 17
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/MediaEditor/KSMediaEditor.m

@@ -42,7 +42,6 @@
     // 音频轨道
     AVMutableCompositionTrack *recordCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
     
-    
     // 伴奏
     AVURLAsset *bgAudioAssest = [AVURLAsset assetWithURL:bgAudioUrl];
     float bgAudioDuration = CMTimeGetSeconds(bgAudioAssest.duration);
@@ -100,6 +99,12 @@
     session.outputFileType = outputFileType;
     session.shouldOptimizeForNetworkUse = YES;
     session.audioMix = audioMix;
+    if ([outputFileType isEqualToString:AVFileTypeQuickTimeMovie]) {
+        AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoCompositionWithPropertiesOfAsset:asset];
+        videoComposition.frameDuration = CMTimeMake(1, 10);
+        videoComposition.renderSize = CGSizeMake(1280, 720);
+        session.videoComposition = videoComposition;
+    }
     
     [session exportAsynchronouslyWithCompletionHandler:^{
         dispatch_async(dispatch_get_main_queue(), ^{
@@ -194,41 +199,36 @@
     
     // 录音
     AVURLAsset *recordAsset = [AVURLAsset assetWithURL:recordUrl];
-    float recordDuration = CMTimeGetSeconds(recordAsset.duration);
     // 音频轨道
     AVMutableCompositionTrack *recordCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
 
     // 伴奏
     AVURLAsset *bgAudioAssest = [AVURLAsset assetWithURL:bgAudioUrl];
-    float bgAudioDuration = CMTimeGetSeconds(bgAudioAssest.duration);
     AVMutableCompositionTrack *bgAudioCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
     
     CMTime offsetCTTime = CMTimeMake(labs(offsetTime), 1000);
-    CMTime duration = recordDuration > bgAudioDuration ? bgAudioAssest.duration : recordAsset.duration;
-    
-    // 如果时长超过视频的时长
-    if (CMTimeGetSeconds(duration) > videoDuration) {
-        duration = videoAsset.duration;
-    }
     
     // 合成
     AVAssetTrack *recordAssetTrack = [[recordAsset tracksWithMediaType:AVMediaTypeAudio] firstObject];
     AVAssetTrack *bgAudioAssetTrack = [[bgAudioAssest tracksWithMediaType:AVMediaTypeAudio] firstObject];
     
     // 录音文件
-    [recordCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, recordAsset.duration) ofTrack:recordAssetTrack atTime:kCMTimeZero error:nil];
+    CMTime recordCMTime = recordAsset.duration.value > videoAsset.duration.value ? videoAsset.duration : recordAsset.duration;
+    [recordCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, recordCMTime) ofTrack:recordAssetTrack atTime:kCMTimeZero error:nil];
+    
     // 伴奏文件
-    CMTime bgTime = kCMTimeZero;
-    if (bgAudioDuration >= offsetTime/1000.0 + recordDuration) {
-        bgTime = recordAsset.duration;
-    }
-    else {
-        bgTime = bgAudioAssest.duration;
-    }
+    CMTime bgTime = bgAudioAssest.duration.value > videoAsset.duration.value ? videoAsset.duration : bgAudioAssest.duration;
+    
     if (offsetTime > 0) {
+        if (bgTime.value + offsetCTTime.value > videoAsset.duration.value) {
+            bgTime.value = videoAsset.duration.value - offsetCTTime.value;
+        }
         [bgAudioCompositionTrack insertTimeRange:CMTimeRangeMake(offsetCTTime, bgTime) ofTrack:bgAudioAssetTrack atTime:kCMTimeZero error:nil];
     }
     else {
+        if (bgTime.value + offsetCTTime.value > videoAsset.duration.value) {
+            bgTime.value = videoAsset.duration.value - offsetCTTime.value;
+        }
         [bgAudioCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, bgTime) ofTrack:bgAudioAssetTrack atTime:offsetCTTime error:nil];
     }
     

+ 2 - 1
KulexiuForStudent/KulexiuForStudent/Common/Tools/Extension/NSString+Extension.m

@@ -235,7 +235,8 @@
 
 // url encoding
 - (NSString *)getUrlEndcodeString {
-    return [self stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];;
+    NSString *url = [self stringByRemovingPercentEncoding];
+    return [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];;
 }
 
 /**

+ 38 - 6
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/Controller/KSVideoCropViewController.m

@@ -79,6 +79,11 @@
 - (void)downloadUrl {
     [LOADING_MANAGER showCustomLoading:@"视频下载中..."];
     [KSNetworkingManager downloadFileRequestWithFileUrl:self.remoteUrl progress:^(int64_t bytesRead, int64_t totalBytes) {
+        NSInteger progress = (NSInteger)(bytesRead*1.0 / totalBytes) * 100;
+        NSString *tipsString = [NSString stringWithFormat:@"文件下载中\n%zd%%",progress];
+        dispatch_main_async_safe(^{
+            [LOADING_MANAGER showCustomLoading:tipsString];
+        });
     } success:^(NSURL * _Nonnull fileUrl) {
         [self configImageWallWithPath:fileUrl];
     } faliure:^(NSError * _Nonnull error) {
@@ -92,10 +97,26 @@
 }
 
 - (void)configUI {
+    [self.scrollView removeFromSuperview];
+    self.view.backgroundColor = HexRGB(0x000000);
     self.ks_prefersNavigationBarHidden = YES;
     [self.view addSubview:self.displayImage];
+    CGFloat imageWidth = KLandscapeWidth;
+    CGFloat imageHeight = KLandscapeHeight;
+    if (imageHeight > imageWidth / 16 * 9) {
+        imageWidth = KLandscapeWidth;
+        imageHeight = imageWidth / 16 * 9;
+    }
+    else if (imageWidth > imageHeight / 9 * 16) {
+        imageHeight = KLandscapeHeight;
+        imageWidth = imageHeight / 9 * 16;
+    }
+    
     [self.displayImage mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.top.bottom.mas_equalTo(self.view);
+        make.centerX.mas_equalTo(self.view.mas_centerX);
+        make.centerY.mas_equalTo(self.view.mas_centerY);
+        make.width.mas_equalTo(imageWidth);
+        make.height.mas_equalTo(imageHeight);
     }];
     CGFloat height = 84.0f;
     [self.view addSubview:self.imageSlider];
@@ -122,7 +143,6 @@
     self.videoUrl = fileUrl;
     AVAsset * asset =[AVAsset assetWithURL:fileUrl];
     NSMutableArray * times = [NSMutableArray arrayWithCapacity:0];
-    CGFloat videoTime = CMTimeGetSeconds(asset.duration);
 
     for (int i = 0; i < COVER_COUNT; i++) {
         
@@ -244,17 +264,25 @@
                 [weakSelf backAction];
             }
             else {
+                [weakSelf sureChooseAction];
                 
-                if (weakSelf.callback) {
-                    weakSelf.callback(weakSelf.displayImage.image);
-                }
-                [weakSelf backAction];
             }
         }];
     }
     return _navView;
 }
 
+- (void)sureChooseAction {
+    if (self.displayImage.image == nil) {
+        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"请选择视频封面"];
+        return;
+    }
+    if (self.callback) {
+        self.callback(self.displayImage.image);
+    }
+    [self backAction];
+}
+
 
 - (void)backAction {
     
@@ -263,6 +291,10 @@
         [self changeOrientation:NO];
     }
 }
+
+- (void)dealloc {
+    NSLog(@"----");
+}
 /*
 #pragma mark - Navigation
 

+ 0 - 1
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/Controller/MineWorksViewController.m

@@ -96,7 +96,6 @@
 
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
-    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
     [self refreshAllPage];
 }
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/View/KSVideoImageSlider.m

@@ -80,7 +80,7 @@
 }
 
 - (void) setKnodFrames {
-    _knobWidth = 128;
+    _knobWidth = self.bounds.size.height / 9 * 16;
     _knobHeight = self.bounds.size.height;
     _useableTrackLength = self.bounds.size.width - _knobWidth;
     

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Works/View/MusicPublistAlert.m

@@ -78,6 +78,9 @@
         }];
         [self.publishContainView musicContentPubAction:^(PUBLISH_ACTION type) {
             [weakSelf endEditing:YES];
+            if (type == PUBLISH_ACTION_PUBLISH) {
+                [weakSelf hideAlert];
+            }
             if (weakSelf.callback) {
                 weakSelf.callback(type);
             }