Search code examples
iphoneios7xcode4avplayeravaudiosession

want to keep AVPlayer playing when application goes to background


I have to play a mp3 file using avplayer ,but when i go to background it stops ,How do i keep it playing in background state as well.Any advise will be highly appreciated. Thanks.


Solution

  • in to your plist fine just add one method like:-

    enter image description here

    Or in code:

    <key>UIBackgroundModes</key>
    <array>
        <string>audio</string>
    </array>