Impossible to stop AVPlayer

前端 未结 3 1290
一整个雨季
一整个雨季 2020-12-15 16:41

I am currently testing the use of AVPlayer with audio streaming url, using Swift. There are play() and pause() methods, but the problem is that, pausing onl

3条回答
  •  不知归路
    2020-12-15 17:06

    From this post I found the best solution to completely stop AVPlayer before you leave or start a new player:

    videoPlayer.replaceCurrentItemWithPlayerItem(nil)
    

    [Update] For SWIFT 3:

    player.replaceCurrentItem(with: nil)
    

提交回复
热议问题