我正在使用 AVPlayer
,它通过 AVPlayerItem
连接到远程 URL
。问题是我想立即播放来自 URL
的声音,不要让用户等待 AVPlayer
缓冲。
问题在于,如果远程 URL 的
Assets 媒体非常短,那么它根本不会缓冲很长时间,但如果媒体稍长一点,则需要一段时间。
有没有办法跳过缓冲过程或至少大大缩短缓冲过程?
最佳答案
swift 5
您只需要使用 automaticallyWaitsToMinimizeStalling属性(property)。
player.automaticallyWaitsToMinimizeStalling = false
player.playImmediately(atRate: 1.0)
关于swift - 如何立即播放 AVPlayerItems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40628601/