简体   繁体   English

AVAudioPlayer是从磁盘流式传输文件还是将其一次全部加载到内存中?

[英]Does AVAudioPlayer stream a file from disk, or does it load it into memory all at once?

I want to play very long audio files of up to an hour. 我想播放长达一个小时的超长音频文件。 AVAudioPlayer seems to be the easiest solution. AVAudioPlayer似乎是最简单的解决方案。 But is it also efficient or does it load the whole file into memory before playing? 但这是否还有效,还是在播放之前将整个文件加载到内存中?

Apple's doc for AVAudioPlayer say: 苹果公司针对AVAudioPlayer的文档说:

An instance of the AVAudioPlayer class, called an audio player, provides playback of audio data from a file or memory. AVAudioPlayer类的实例称为音频播放器,可播放文件或内存中的音频数据。

Applerecommends that you use this class for audio playback unless you are playing audio captured from a network stream or require very low I/O latency. Apple建议您使用此类进行音频播放,除非您正在播放从网络流捕获的音频或需要非常低的I / O延迟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM