Open MrdotSpock opened 3 years ago
Same for me, crash appeared in analytics for all iOS14 users.
I have the same problem ,it's not stable sometimes it crashes please help if you have find a solution ? i don't understand what happen in iOS 14 ! this is really odd
same here, if anyone has a solution please help
Hi has anyone tested on the iOS 14,2 ? please provide us your feedback so we can find a solution Regards
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]?) { fatalError("not implemented") }
Can we have a quick look into this.
+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:
override init(asset: AVAsset, automaticallyLoadedAssetKeys: [String]?) {
self.url = URL(fileURLWithPath: "")
super.init(asset: asset, automaticallyLoadedAssetKeys: automaticallyLoadedAssetKeys)
}
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:
let playerItem = CachePlayerItem(url: url, avUrlAssetOptions: nil) <<< make sure to set this to nil
This is the incorrect one to use and what causes the crash
let playerItem = CachePlayerItem(url: url)
<<< DON'T USE THIS alone without the avUrlAssetOptions
param
The solution given by @QEllis and @dreampowder works even when you are using AVQueuePlayer and AVPlayerLooper.
To everyone with this issue. When initializing your playerItem use:
let playerItem = CachePlayerItem(url: url, avUrlAssetOptions: nil) <<< make sure to set this to nil
This is the incorrect one to use and what causes the crash
let playerItem = CachePlayerItem(url: url)
<<< DON'T USE THIS alone without theavUrlAssetOptions
param
Thanks @lsamaria! This solution works for me
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) }
Big thanks! 🙏
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