ios - Allow "auto lock" while video is being played -


no matter whether using mpmovieplayercontroller or avplayer (avfoundation), ios not allow device auto lock (to enter sleep mode) while video playing.

i have case extremely slow video being played in loop in background. while video playing, device never goes sleep.

so far, option have detect when user did not make actions while , pause video. after that, device counts down "auto lock" duration specified in ios settings.

i looking alternative avplayer make possible.

similar questions:

how allow iphone auto-lock while playing video

is possible set avplayer allow device go sleep during video playback?

how enable iphone auto lock during mpmovieplayer playback?

i had idea use html5 video inside uiwebview, ios not allow autoplay on those.

remember private api, i'm not sure if can use appstore release or not.

tested on ios 9.

avplayer *player = // alloc init... if ([player respondstoselector:nsselectorfromstring(@"_preventssleepduringvideoplayback")]) {     [player setvalue:@(no) forkey:@"preventssleepduringvideoplayback"]; } 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -