Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS App prevents device from sleep mode

Tags:

ios

standby

I've a really strange behavior of my iOS app. It prevents the device from going to standby. I've already searched if there is anywhere the idleTimeDisabled flag set, but this isn't the case. The idle timer inside the settings app is set to 2 minutes and works within other apps. The device isn't jailbroken and the even restarting the device didn't help. The app was written by somebody else and I'm new to it. So in the moment I don't have any idea what to look for. Has anybody of you an idea, why this could be the case or how I could figure out what's the reason for this behavior?

Thank you very much!

like image 310
Alex Avatar asked Mar 04 '14 06:03

Alex


1 Answers

If your app is using AVPlayer or some other similar AVFoundation functionality, this can be the cause.

If AVPlayer is playing a video, a device will not go to sleep while a video is playing.

If the video is playing in a loop, the device will never go to sleep.

Edit: With iOS 12 this is now possible by setting

player.preventsDisplaySleepDuringVideoPlayback = false
like image 154
ancajic Avatar answered Oct 04 '22 05:10

ancajic