문제

How can I get my video to play via air play when the device falls asleep? I'm finding some things to do like this but it sounds like most of these things will get me banned from the app store. I just want my app's video to play on airplay without the user have to make sure their device stays awake. What should I do?

도움이 되었습니까?

해결책

If I understand correctly, you want to prevent the device from going to sleep so you can play your video without interruptions. You can have your app prevent the device from "going to sleep" like this:

[UIApplication sharedApplication].idleTimerDisabled = YES;

Just remember to set it back to NO when you are done playing your video like this:

[UIApplication sharedApplication].idleTimerDisabled = NO;

I don't know how you are playing your video, but try you can probably just call those functions before you play your video, or immediately after you are done.

다른 팁

You can prevent the device from sleeping like this:

UIApplication* app = [UIApplication sharedApplication];
[app setIdleTimerDisabled:true];

when you're done with the video, don't forget to let it sleep again.

[app setIdleTimerDisabled:false];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top