Keep playing sound with MPMoviePlayerController and locked screen?

后端 未结 1 689
慢半拍i
慢半拍i 2021-01-21 03:33

When you\'re watching a video with MPMoviePlayerController and the user presses the top button to lock the screen, the app goes to sleep and so does the sound from

相关标签:
1条回答
  • 2021-01-21 04:14

    Sounds like you haven't set your audio session category. Set the AVAudioSession's category property to AVAudioSessionCategoryPlayback to indicate that the app's major purpose is to play back audio, and it therefore should ignore the screen lock button and ring/silent switch. If you're working with the lower-level C API, you'll be using AudioSessionSetProperty(kAudioSessionCategory_MediaPlayback), but it's the same concept.

    0 讨论(0)
提交回复
热议问题