문제

MAC의 네트워크 연결을 시청할 때 AVPlayer가있는보기를 제거한 후에도 동영상이 아직 버퍼링되는지 알 수 있습니다.

AVPlayer가 데이터로드를 중지하도록 강제하는 방법을 알고 있습니까?

도움이 되었습니까?

해결책 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.

다른 팁

이 질문에 답하는 것이 늦었지만, 방금 같은 것을 해결했습니다. 누구나 필요로하는 경우 여기에 저장하십시오 ...

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

AVPlayer 클래스에서 취소 방법은 없지만 AVPlayerItemAVAsset 클래스에서는!

ps : player 여기에 AVPlayer 클래스가 아닌 AVQueuePlayer 클래스입니다.

나는 같은 문제를 가졌고,이 라인은 그것을 해결했다.

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

또한 함수를 호출합니다

asset?.cancelLoading()
.

여기서 자산은 내 Player Handler 클래스 내부에서 내 AVURLAsset 객체입니다

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top