If you have a Apple TV Surely you use your device to play content on your television or projector, whether they are videos that you have stored or videos that you find on the web. Usually if you lock your device The AirPlay transmission is not cut off, but sometimes if, also with the iPhone locked you cannot control the playback so easily, you can use the Remote control, but you cannot slide the bar.
If you want your device not to lock automatically when you are using AirPlay you just have to install NoAutoLockForAirPlay, this modification will allow your iPhone to lock normally with the lock time that you have configured but not if you are playing content on your Apple TV.
You can download it free on Cydia, You will find it in the BigBoss repo. You need to have done the jailbreak on your device.