Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set AVPlayer to allow the device to go to sleep during video playback?

I am working on an application that involves using AVPlayer to have a video in the background of an interface.

We've found that while video is playing, the app will never go to sleep. Is there a way to tell AVPlayer to allow the app to go to sleep regardless?

like image 812
0x6A75616E Avatar asked Nov 10 '22 16:11

0x6A75616E


1 Answers

Set preventsDisplaySleepDuringVideo to false or NO on the AVPlayer instance.

https://developer.apple.com/documentation/avfoundation/avplayer/2990522-preventsdisplaysleepduringvideop

like image 171
Fabian Avatar answered Nov 14 '22 23:11

Fabian