【发布时间】:2021-12-10 12:47:52
【问题描述】:
在达到最小/最大输出音量后,用于响应设备音量变化的approved KVO approach 停止检测音量按钮按下。我想在最小/最大之后继续接收这些按钮按下事件,所以我认为我需要尝试this solution,即使它不受 Apple 支持。但是,我是一个非常业余的 iOS 程序员,所以我可以使用提示。这是我一直在做的事情(使用 RxSwift):
NotificationCenter.default.rx.notification(Notification.Name(rawValue: "AVSystemController_AudioVolumeNotificationParameter"))
.subscribe(onNext: { [weak self] notification in
guard let my = self else { return }
my.volumeNotification.accept(notification.userInfo!["AVSystemController_AudioVolumeNotificationParameter"] as! Double)
})
.disposed(by: disposeBag)
我应该订阅名为“MPVolumeControllerDataSource_SystemVolumeDidChange”的通知吗?
提前致谢!
【问题讨论】: