If you have a Apple TV Surely you use your iPad to play content on your TV, be it 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 it happens that it is cut with the automatic lock, in addition, the playback control is more comfortable from the iPad than from the Apple TV Remote.
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.
More information - View your iPad screen on Mac with AirServer