Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKPlayerView 不能播放短视频 #10

Open
erduoniba opened this issue Nov 14, 2016 · 4 comments
Open

PKPlayerView 不能播放短视频 #10

erduoniba opened this issue Nov 14, 2016 · 4 comments

Comments

@erduoniba
Copy link

-湛蓝_大神你好!
我这边在使用 PKPlayerView 不能播放短视频;具体代码如下:

录制视频:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *fileName = [NSProcessInfo processInfo].globallyUniqueString;
NSString *path = [paths[0] stringByAppendingPathComponent:[fileName stringByAppendingPathExtension:@"mp4"]];
//跳转默认录制视频ViewController
PKRecordShortVideoViewController *viewController = [[PKRecordShortVideoViewController alloc] initWithOutputFilePath:path outputSize:CGSizeMake(320, 240) themeColor:[UIColor colorWithRed:0/255.0 green:153/255.0 blue:255/255.0 alpha:1]];
//通过代理回调
viewController.delegate = self;
[self presentViewController:viewController animated:YES completion:nil];
播放视频:

  • (void)didFinishRecordingToOutputFilePath:(NSString *)outputFilePath{
    _outputFilePath = outputFilePath;
    _playerView = [[PKPlayerView alloc] initWithFrame:CGRectMake(30, 30, kScreenWidth - 60, 200)
    videoPath:_outputFilePath
    previewImage:[UIImage pk_previewImageWithVideoURL:[NSURL fileURLWithPath:_outputFilePath]]];
    [self.view addSubview:_playerView];

    UITapGestureRecognizer *tapp = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(playViewAction)];
    [_playerView addGestureRecognizer:tapp];
    }

  • (void)playViewAction{
    //跳转全屏播放小视频界面
    [_playerView play];
    }

谢谢!

@pepsikirk
Copy link
Owner

呃,你这样说和贴代码并没有什么用,你下载demo后可以录制和播放视频吗 @erduoniba

@erduoniba
Copy link
Author

下载你的demo后是可以播放的。然后我这边其实和demo的代码也一致。

@pepsikirk
Copy link
Owner

@erduoniba 那就是在你的项目中用不了吗,那你确认以下权限相关问题?

@xt0612
Copy link

xt0612 commented Aug 8, 2017

目前测试iOS10.0.1短视频不能播放,其他系统版本可以,相同代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants