|
@@ -44,18 +44,6 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-- (void)setMediaType:(MEDIATYPE)mediaType {
|
|
|
- _mediaType = mediaType;
|
|
|
- if (mediaType == MEDIATYPE_PHOTO) {
|
|
|
- self.maxPhotoNumber = 9;
|
|
|
- }
|
|
|
- else if (mediaType == MEDIATYPE_VIDEO) {
|
|
|
- self.maxPhotoNumber = 1;
|
|
|
- }
|
|
|
- else if (mediaType == MEDIATYPE_ALL) {
|
|
|
- self.maxPhotoNumber = 2;
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
- (void)showAlertCallbackWithBlock:(MediaCallback)callback {
|
|
|
|
|
@@ -152,9 +140,11 @@
|
|
|
[self extracted:imagePickerVc];
|
|
|
|
|
|
[imagePickerVc setDidFinishPickingVideoHandle:^(UIImage *coverImage, PHAsset *asset) {
|
|
|
- if (asset.duration >= 481) {
|
|
|
+ if (asset.duration >= self.maxDuration +1) {
|
|
|
+ NSInteger minites = self.maxDuration / 60;
|
|
|
+ NSString *tipsString = [NSString stringWithFormat:@"视频长度不能超过%zd分钟",minites];
|
|
|
dispatch_main_async_safe(^{
|
|
|
- [MBProgressHUD ksShowMessage:@"视频长度不能超过8分钟"];
|
|
|
+ [MBProgressHUD ksShowMessage:tipsString];
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -244,6 +234,8 @@
|
|
|
[mediaTypes addObject:(NSString *)kUTTypeImage];
|
|
|
}
|
|
|
self.imagePickerVc.mediaTypes = mediaTypes;
|
|
|
+ self.imagePickerVc.videoMaximumDuration = self.maxDuration;
|
|
|
+
|
|
|
if(kiOS8Later) {
|
|
|
_imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
|
|
}
|
|
@@ -413,4 +405,23 @@
|
|
|
}
|
|
|
#define push clang diagnostic pop
|
|
|
|
|
|
+
|
|
|
+#pragma mark ---- setting
|
|
|
+
|
|
|
+- (void)setMaxDuration:(NSInteger)maxDuration {
|
|
|
+ _maxDuration = maxDuration;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setMediaType:(MEDIATYPE)mediaType {
|
|
|
+ _mediaType = mediaType;
|
|
|
+ if (mediaType == MEDIATYPE_PHOTO) {
|
|
|
+ self.maxPhotoNumber = 9;
|
|
|
+ }
|
|
|
+ else if (mediaType == MEDIATYPE_VIDEO) {
|
|
|
+ self.maxPhotoNumber = 1;
|
|
|
+ }
|
|
|
+ else if (mediaType == MEDIATYPE_ALL) {
|
|
|
+ self.maxPhotoNumber = 2;
|
|
|
+ }
|
|
|
+}
|
|
|
@end
|