Any reasons why AVQueuePlayer sometimes worked or sometimes not?

I am creating a video player view where I download URLs from the Internet to play using AVQueuePlayer. It usually works very well, except that sometimes I get a game icon and AVQueuePlayer breaks.

I am not sure what causes this broken state of AVQueuePlayer.

I create new AVQueuePlayers on viewappear and on viewdisappear I run these lines on the player

ViewAppear

    if (self.player == nil){
        self.player = AVQueuePlayer()
    }

ViewDisappear

    self.player.pause()
    self.player.replaceCurrentItemWithPlayerItem(nil)

The main thing that I'm curious about is there any potential reasons why AVQueuePlayer sometimes works, and sometimes not? (It will stop working after I call viewAppear, viewDisappear, viewAppear, etc. several times)

, , (0 ).

:

1) , - AVPlayers, ?

2) . , avplayer ?

.

EDIT: , , , . Snapchat Youtube . , .

UPDATE: AVPlayer AVPlayerItem

Optional(Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.})
+4

Source: https://habr.com/ru/post/1650381/


All Articles