[英]Screen Lock & sound stop iPhone dev (FLASH CS5.5)
I'm trying to create iPhone apps using Flash CS5.5 and I have a doubt.我正在尝试使用 Flash CS5.5 创建 iPhone 应用程序,但我有疑问。 I just created a simple app which plays a long sound (more than 5 min).我刚刚创建了一个简单的应用程序,它可以播放很长的声音(超过 5 分钟)。
When the phone auto-locks, my sounds stop.当手机自动锁定时,我的声音停止。 If I unlock the phone, my audio resumes.如果我解锁手机,我的音频会恢复。
What could I do to avoid the lock, or don't interrupt the sound when the device auto-locks?我该怎么做才能避免锁定,或者在设备自动锁定时不中断声音?
[[UIApplication sharedApplication] setIdleTimerDisabled:YES] [[UIApplication sharedApplication] setIdleTimerDisabled:YES]
set this for stoping lock the screen.设置它以停止锁定屏幕。
set this for stoping to lock the screen in ActionScript 3.0,将此设置为停止在 ActionScript 3.0 中锁定屏幕,
Import classes:导入类:
import flash.desktop.NativeApplication
import flash.desktop.SystemIdleMode;
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
Don't forget to check不要忘记检查
WAKE_LOCK WAKE_LOCK
in the permission in AIR settings,在 AIR 设置中的权限中,
If you want normal then use,如果你想要正常然后使用,
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
To avoid the lock, you can look at idleTimerDisabled of UIApplication property.要避免锁定,您可以查看 UIApplication 属性的 idleTimerDisabled。 Or to run the sound even if the screen is locked, check the link below:或者即使屏幕被锁定也要运行声音,请查看以下链接:
AVAudioPlayer will not play when device is locked 设备锁定时,AVAudioPlayer 不会播放
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.