How to save the state of an audio file when a user pauses my application?

In my application, I need to play 50 MB audio recording. If the user presses the home button near the 27-minute mark, the sound pauses. When they resume the application, the sound resumes where it was stopped.

I use AVAudioPlayer to play this audio file, but I am worried about keeping this large audio file in memory when my application goes to the background. What do you advise to minimize the effect of saving / resuming memory on an audio file like this?

+3
source share
3 answers

( ), , Apple .

0

AVAudioPlayer - . , , - , applicationDidReceiveMemoryWarning. OS , , , .

, currentTime, , , . , , , , .

OpenAL, , , - , ,

+1

OpenAL: http://www.gamedev.net/reference/articles/article2008.asp

Then set AL_SEC_OFFSET (second offset) to the saved position to start where the user left off.

0
source

Source: https://habr.com/ru/post/1772665/


All Articles