【问题标题】:Xamarin iOS how to get all available SysSound list?Xamarin iOS 如何获取所有可用的 SysSound 列表?
【发布时间】:2017-03-13 14:32:48
【问题描述】:

我正在尝试创建 iOS 设备中所有可用警报声音的列表。 在 Xamarin 的网站上,只有一个例子:

https://developer.xamarin.com/recipes/ios/media/sound/syssound-example/

我想知道我可以通过我的 Apple 设备访问哪些其他声音。

编辑: 如何获取内置警报声音列表

【问题讨论】:

  • SystemSound 是一个包装了AudioServicesCreateSystemSoundID 的辅助类,你需要为它提供一个指向声音文件的NSUrl。在您列出的示例中,项目中唯一的声音文件是 `Sounds/tap.aif.
  • 那么你的意思是SystemSound 中没有其他声音,除非我把它们放在那里?

标签: ios xamarin xamarin.ios system-sounds


【解决方案1】:

在这里找到答案:

https://www.theiphonewiki.com/wiki//System/Library/Audio/UISounds

例如:

string NotificationSoundPath = @"/System/Library/Audio/UISounds/sms-received6.caf";
SystemSound notificationSound = SystemSound.FromFile(NotificationSoundPath);
notificationSound.AddSystemSoundCompletion(SystemSound.Vibrate.PlaySystemSound);
notificationSound.PlaySystemSound();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-04
    • 1970-01-01
    • 1970-01-01
    • 2017-04-04
    • 2016-05-31
    • 2018-09-06
    相关资源
    最近更新 更多