title: Allow "auto lock" while video is being played
body: <p>No matter whether I am using <code>MPMoviePlayerController</code> or <code>AVPlayer</code> (<code>AVFoundation</code>), the iOS does not allow the device to <em>auto lock</em> (to enter <em>sleep mode</em>) while the video is playing.</p>
  
  <p>I have a case where an extremely slow video is constantly being played in a loop in the background.
  While this video is playing, the device never goes to sleep.</p>
  
  <p>So far, the only option I have is to detect when a user did not make any actions for a while and then pause the video. After that, the device counts down the "auto lock" duration that is specified in iOS Settings.</p>
  
  <p>I am looking for an alternative to <code>AVPlayer</code> that will make this possible.</p>
  
  <p>Similar questions:</p>
  
  <p><a href="https://stackoverflow.com/questions/10267776/how-to-allow-iphone-auto-lock-while-playing-a-video">How to allow iPhone auto-lock while playing a video</a></p>
  
  <p><a href="https://stackoverflow.com/questions/29480997/is-it-possible-to-set-avplayer-to-allow-the-device-to-go-to-sleep-during-video-p">Is it possible to set AVPlayer to allow the device to go to sleep during video playback?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2489270/how-to-enable-iphone-auto-lock-during-mpmovieplayer-playback">How to enable iPhone auto lock during MPMoviePlayer playback?</a></p>
  
  <p>I had an idea to use HTML5 video inside a <code>UIWebView</code>, but iOS does not allow autoplay on those.</p>