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

关于选择视频时出现的问题 #3

Open
IOSBrickhouse opened this issue Apr 20, 2021 · 1 comment
Open

关于选择视频时出现的问题 #3

IOSBrickhouse opened this issue Apr 20, 2021 · 1 comment

Comments

@IOSBrickhouse
Copy link

楼主您好,在选择视频界面时,点击后放大查看,播放按钮后面是黑色,点击播放按钮没反应。
经调试发现以下方法中的playerItem为空,想请教下楼主这个问题怎么处理呢?期待您的回复。

  • (void)getVideoWithAsset:(PHAsset *)asset completion:(void (^)(AVPlayerItem * _Nullable, NSDictionary * _Nullable))completion {
    [[PHImageManager defaultManager] requestPlayerItemForVideo:asset options:nil resultHandler:^(AVPlayerItem * _Nullable playerItem, NSDictionary * _Nullable info) {
    if (completion) completion(playerItem,info);
    }];
    }
@IOSBrickhouse
Copy link
Author

在上述方法中做出如下修改

  • (void)getVideoWithAsset:(PHAsset *)asset completion:(void (^)(AVPlayerItem * _Nullable, NSDictionary * _Nullable))completion {

    PHVideoRequestOptions *option = [[PHVideoRequestOptions alloc] init];
    option.networkAccessAllowed = YES;

    [[PHImageManager defaultManager] requestPlayerItemForVideo:asset options:option resultHandler:^(AVPlayerItem * _Nullable playerItem, NSDictionary * _Nullable info) {
    if (completion) completion(playerItem,info);
    }];
    }
    视频现在可以播放
    不过还有如下问题:
    1 播放按钮下是一片黑色,没有展示出首帧缩略图。
    2 点击播放按钮 会出现一幕上个播放的视频的画面,然后才播放现在已选中的视频。
    请问这个问题有什么办法可以解决么?期待您的回复。

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

1 participant