Browse Source

视频时长限制

Steven 4 months ago
parent
commit
3a7373a0b4

+ 12 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Custom/KSMediaManager.m

@@ -174,9 +174,19 @@
     [self extracted:imagePickerVc];
     
     [imagePickerVc setDidFinishPickingVideoHandle:^(UIImage *coverImage, PHAsset *asset) {
-        if (asset.duration >= 481) {
+        NSInteger maxDuration = self.videoMaxDuration == 0 ? 480 : self.videoMaxDuration;
+        if (asset.duration >= maxDuration + 1) {
+            NSString *tipsMessage = @"";
+            // 如果不是整分钟,提示秒 如果是整数分钟,提示分钟
+            if (maxDuration % 60 == 0) {
+                NSInteger minuteNum = maxDuration / 60;
+                tipsMessage = [NSString stringWithFormat:@"视频长度不能超过%zd分钟", minuteNum];
+            }
+            else {
+                tipsMessage = [NSString stringWithFormat:@"视频长度不能超过%zd秒",self.videoMaxDuration];
+            }
             dispatch_main_async_safe(^{
-                [LOADING_MANAGER MBShowAUTOHidingInWindow:@"视频长度不能超过8分钟"];
+                [LOADING_MANAGER MBShowAUTOHidingInWindow:tipsMessage];
             });
             return;
         }

File diff suppressed because it is too large
+ 100 - 118
KulexiuForTeacher/Pods/Pods.xcodeproj/project.pbxproj


Some files were not shown because too many files changed in this diff