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

iOS18播放相册视频失败 #1432

Open
climlove opened this issue Jul 22, 2024 · 8 comments
Open

iOS18播放相册视频失败 #1432

climlove opened this issue Jul 22, 2024 · 8 comments

Comments

@climlove
Copy link

在目前iOS18beta版中播放相册的视频会失败,但是在相册中打开该视频,再播放,又没有问题

@climlove
Copy link
Author

是只要相册里随便选中一个视频播放,然后再回到APP播放就可以 不知道是什么原因

@yznote
Copy link

yznote commented Aug 28, 2024

那应该是视频在云端iCloud上

@yechunxi
Copy link

这个问题有解决方案么?

@xuanweiH
Copy link

是只要相册里随便选中一个视频播放,然后再回到APP播放就可以 不知道是什么原因

蹲个后续

@xuxueyong
Copy link

我也蹲点, 我没用这个ZFPlayer, 用 AVPlatyer 也播放不了

@xuxueyong
Copy link

没有人解决这个问题吗?

@xuxueyong
Copy link

https://juejin.cn/post/7420006486952116262 大家可以试试这个方案, 可以不?

@SmallWeed
Copy link

<AVURLAsset: 0x300c70c20, URL = file:///var/mobile/Media/DCIM/100APPLE/IMG_0154.MP4#YnBsaXN0MDDRAQJfEBtSZWNvbW1lbmRlZEZvckltbWVyc2l2ZU1vZGUQAAgLKQAAAAAAAAEBAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAr>

<AVURLAsset: 0x2837cc500, URL = file:///var/mobile/Media/DCIM/100APPLE/IMG_0442.MP4>

iOS 18 AVURLAsset 有一些附加信息,# 之后, 判断iOS18 处理字符串

AVURLAsset *urlAsset = (AVURLAsset *)asset;
NSURL *url = urlAsset.URL;

if (@available(iOS 18.0, *)) {

          NSString *urlString = [url absoluteString];
           // 查找 # 的位置
          NSRange range = [urlString rangeOfString:@"#"];
          if (range.location != NSNotFound) {
          // 如果找到 #,截取到 # 之前的部分
          urlString = [urlString substringToIndex:range.location];
     }
                    
   url = [NSURL URLWithString:urlString];

}

model.urlAsset = urlAsset;

持有urlAsset,防止过了作用于被释放 导致不能播放 就可以正常播放了

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

6 participants