【问题标题】:Set the volume AVAudioPlayer#play(at:time)设置音量 AVAudioPlayer#play(at:time)
【发布时间】:2022-08-11 15:52:44
【问题描述】:

我在我的应用程序中使用 AVAudioPlayer。我有一个用例,用户指定将来播放声音的时间。我可以使用背景模式在后台播放声音,但我想控制音量并在声音播放时将其设置为最大(这是客户端的要求)。调用[self.player prepareToPlay]; 后,我通过调用[self.player setVolume: 1.0]; 将音量设置为最大,但似乎没有效果。声音随设备声级播放。我有什么办法可以做到这一点?

提前致谢。

    标签: ios objective-c xcode avplayer


    【解决方案1】:

    据我所知,无法直接更改设备音量。

    请检查 Apple 的文档以使用 MPVolumeView - https://developer.apple.com/documentation/mediaplayer/mpvolumeview 来满足这种情况

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-22
      • 2010-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多