|
@ -9,18 +9,17 @@
|
9
|
9
|
#import "IPUCameraPlugin.h"
|
10
|
10
|
|
11
|
11
|
#import <AVFoundation/AVFoundation.h>
|
12
|
|
#import <IPULib/KRVideoPlayerController.h>
|
13
|
12
|
#import <IPUMobileUI/IPUMobileUI.h>
|
14
|
13
|
#import <IPUFoundation/IPUFoundation.h>
|
15
|
14
|
|
16
|
15
|
#import "UIImage+IPUCompress.h"
|
17
|
16
|
|
18
|
17
|
#import <CoreImage/CoreImage.h>
|
|
18
|
#import <AVKit/AVKit.h>
|
19
|
19
|
|
20
|
20
|
@interface IPUCameraPlugin ()
|
21
|
21
|
{
|
22
|
22
|
NSURL *videoPath;
|
23
|
|
KRVideoPlayerController *videoController;
|
24
|
23
|
|
25
|
24
|
CGFloat maxLength;
|
26
|
25
|
CGFloat minWidth;
|
|
@ -210,14 +209,16 @@
|
210
|
209
|
[self error:@"播放文件地址错误,请核查!"];
|
211
|
210
|
}
|
212
|
211
|
|
213
|
|
if (!videoController) {
|
214
|
|
videoController = [[KRVideoPlayerController alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
215
|
|
[videoController setDimissCompleteBlock:^{
|
216
|
|
videoController = nil;
|
217
|
|
}];
|
218
|
|
[videoController showInWindow];
|
|
212
|
// 系统播放器,MPMoviePlayerController,在iOS13已经废弃了,需要更换成AVPlayerViewController(available(iOS 8.0), *)。
|
|
213
|
AVPlayerViewController *playerVC = [[AVPlayerViewController alloc] init];
|
|
214
|
NSURL *videoURL = [NSURL URLWithString:path];
|
|
215
|
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
|
|
216
|
playerVC.player = player;
|
|
217
|
if(@available(iOS 9.0, *)) {
|
|
218
|
playerVC.allowsPictureInPicturePlayback = YES;
|
219
|
219
|
}
|
220
|
|
videoController.contentURL = [NSURL URLWithString:path];
|
|
220
|
UIViewController *rootVC = [self getViewController];
|
|
221
|
[rootVC presentViewController:playerVC animated:YES completion:nil];
|
221
|
222
|
|
222
|
223
|
[self callback:@""];
|
223
|
224
|
}
|