sukov / CachingPlayerItem

An AVPlayerItem subclass that lets you stream and cache media content on iOS
MIT License
75 stars 19 forks source link

Still got crash when play with AVPlayerLooper #8

Closed hungnguyen1791 closed 1 year ago

hungnguyen1791 commented 1 year ago

Using CachingPlayerItem with code like this will make the crash happen ` let url = URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")! let playerItem = CachingPlayerItem(url: url, avUrlAssetOptions: nil)

    let queuePlayer = AVQueuePlayer(playerItem: playerItem)

    // Create a new player looper with the queue player and template item
    self.avPlayerLooper = AVPlayerLooper(player: queuePlayer, templateItem: playerItem)

    let playerLayer = AVPlayerLayer(player: queuePlayer)
    playerLayer.frame = self.view.bounds
    playerLayer.videoGravity = .resizeAspect
    self.view.layer.addSublayer(playerLayer)

    queuePlayer.play()

`

Screen Shot 2023-05-30 at 08 59 15

DemoCrash.zip

hungnguyen1791 commented 1 year ago

Hi @sukov I raise this PR to solve the above issue, it works fine on my project now. Please help to review, merge, and release a new version if possible. Thanks

sukov commented 1 year ago

Thank you for raising awareness about this issue. Fixed in 1.0.8.