Domanda

Quando guardo la connettività della mia rete di Mac, posso dire che un film è ancora buffering anche dopo aver rimosso la vista che ha avuto l'AVPlayer su di esso.

Qualcuno sa come forzare AvPlayer per interrompere il caricamento dei dati?

È stato utile?

Soluzione 4

I figured it out.

When you want to stop an AVPlayerItem from loading, use AVQueuePlayer's removeAllItems and then re-initialize it.

  [self.avPlayer removeAllItems];
  self.avPlayer = [AVQueuePlayer playerWithURL:[NSURL URLWithString:@""]];
  self.avPlayer = nil;

This will stop the current item from loading -- it is the only way I found to accomplish this.

Altri suggerimenti

Forse è tardi per rispondere a questa domanda, ma ho appena risolto lo stesso. Salva qui nel caso in cui qualcuno abbia bisogno ...

    [self.player.currentItem cancelPendingSeeks];
    [self.player.currentItem.asset cancelLoading];
.

Non c'è il metodo di annullamento nella classe AVPlayer, ma in AVPlayerItem e AVAsset Class, ci sono!

PS: player Ecco la classe AVPlayer, non la classe non AVQueuePlayer.

Ho avuto lo stesso problema e questa linea lo ha risolto ..

self.avPlayer?.replaceCurrentItem(with: AVPlayerItem(url: URL.init(string: "https://www.asdfasdfasdfasdfasdfasd.net/")!))
.

Chiamò anche la funzione

asset?.cancelLoading()
.

Dove Asset è il mio oggetto AVURLAsset all'interno del mio lettore Gestore Class

An AVPlayer is not a view. You may have "removed the view" but that does not mean you have removed or stopped the AVPlayer. I would guess that the way to do what you want is to destroy the AVPlayer itself.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top