在应用程序内锁定 iPhone 真实音量
我在应用程序商店中有一个闹钟应用程序,想要对其进行设置,以便用户在闹钟响起时无法降低音量(使用侧面按钮)。我在文档中找不到如何执行此操作,我错过了什么吗?
iHandySoft Inc. 的 Alarm Clock Free(流行的绿色闹钟)做到了这一点,使之成为可能。如果您同时降低主控和主控。将铃声音量设置为 0 并将 iPhone 设置为静音,闹钟仍会全力播放。然后你会发现你的主音量已经恢复到80%左右了。
我目前正在使用 AV 音频。
非常感谢所有帮助!
I have an alarm app in the appStore and want to set it up so that the user can NOT lower the volume(using side buttons) while the alarm is sounding. I cant find how to do this in the documentation, did I miss something?
Alarm Clock Free(the popular green one) by iHandySoft Inc. does it so it's possible. If you lower both the master & ringer volume to 0 and set the iphone on silent the alarm will still play full blast. Then you will find that your master volume has been raised back up to like 80%.
I am currently using AV Audio.
All help is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚想出了这个。
我创建了一个循环并使用 MPMusicPlayerController 每十分之一秒将音量恢复到最大。
循环功能:
然后只需 NSTimer 循环此功能:(
您可以更慢地运行循环,但用户会注意到音量又调高了)
&完成后不要忘记使循环无效:
这是基于此主题的:
在 iPhone 上设置设备音量< /a>
I just figured this one out.
I created a loop and used MPMusicPlayerController to return the volume to full every 10th of a second.
Loop function:
Then just NSTimer to loop this function:
(You can run the loop slower but the user will notice the volume being raised back up)
& Dont forget to invalidate your loop when done:
This is based on this Thread:
Set device volume on iPhone
您尝试过AVAudioPlayer的音量功能吗? IE
Have you tried AVAudioPlayer's volume function? i.e