AVPlayer replaceCurrentItemWithPlayerItem not working on iOS 4.3.3+

前端 未结 2 1808
予麋鹿
予麋鹿 2021-02-19 04:35

I have an audio player that I\'m building using AVPlayer.

Currently, I keep the player instance around and when I need to swap tracks (either from a manual

2条回答
  •  别那么骄傲
    2021-02-19 05:07

    I had this issue with iOS 5 (including 5.0.1). It used to work fine on iOS 4.x.

    There are two ways to workaround this, release and recreate your AVPlayer with the desired AVPlayerItems each time you need to swap tracks. Or, simply call replaceCurrentItemWithPlayerItem: on the main thread.

    I tried both options and they worked fine.

    Credits to: Apple Developer Forums

提交回复
热议问题