No matter whether I am using MPMoviePlayerController or AVPlayer (AVFoundation), the iOS does not allow the device to auto lock
MPMoviePlayerController
AVPlayer
AVFoundation
With iOS 12 this is now possible by setting
let player = AVPlayer() player.preventsDisplaySleepDuringVideoPlayback = false
See: https://developer.apple.com/documentation/avfoundation/avplayer/2990522-preventsdisplaysleepduringvideop#