-
Notifications
You must be signed in to change notification settings - Fork 91
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
CachingPlayerItem crashes on iOS 14 #39
Comments
Same for me, crash appeared in analytics for all iOS14 users. |
I have the same problem ,it's not stable sometimes it crashes |
same here, if anyone has a solution please help |
Hi has anyone tested on the iOS 14,2 ? |
This issue still persists on iOS 14.7 as well. If I setup a playerItem -> CachingPlayerItem, and set it to some AVPlayer or AVQueuePlayer it plays fine. but when I try to launch it for next cells/items in my pagerViewCotroller, it does not start download automatically and when user scrolls to next page or cell/item -> it crashes with fatalError breakpoint on line override init(asset: AVAsset, automaticallyLoadedAssetKeys: [String]?) {
|
+1 this is still broken. It appears AVQueuePlayer and AVPlayerLooper are not compatible with this project |
I was able to solve this issue by adding override of the init it is complaining about:
Making sure to set empty URL before super.init call. |
i had to add these lines too for @QEllis 's answer: override init(asset: AVAsset, automaticallyLoadedAssetKeys: [String]?) {
self.url = URL(fileURLWithPath: "")
self.initialScheme = nil
super.init(asset: asset, automaticallyLoadedAssetKeys: automaticallyLoadedAssetKeys)
addObserver(self, forKeyPath: "status", options: NSKeyValueObservingOptions.new, context: nil)
NotificationCenter.default.addObserver(self, selector: #selector(playbackStalledHandler), name:NSNotification.Name.AVPlayerItemPlaybackStalled, object: self)
} |
To everyone with this issue. When initializing your playerItem use:
This is the incorrect one to use and what causes the crash
|
The solution given by @QEllis and @dreampowder works even when you are using AVQueuePlayer and AVPlayerLooper. |
Thanks @lsamaria! This solution works for me |
Big thanks! 🙏 |
Thanks to everyone who posted this solution. I wanted to note that the responses given do not set the This resolved it for me:
|
Hi,
Whenever I initialize CachingPlayerItem the app crashes because also
override init(asset: AVAsset, automaticallyLoadedAssetKeys: [String]?)
is called multiple times. But this initializer is not implemented. I tried to implement it myself but it creates a huge delay before the playing starts and I don't know which track I should play anyway.This happens only on iOS 14. I've checked multiple times that I do not call the initializer myself and I really don't understand why it is happening. It seems like multiple instances of CachingPlayerItem are being created. (One with correct initializer and the rest with this one) Does anyone else also encounter this issue? Did anyone find a solution?
Thanks
The text was updated successfully, but these errors were encountered: