kmrmediaremotenowplayingapplicationisplayingdidchangenotification notificatoin不起作用

发布于 2025-02-06 16:51:29 字数 449 浏览 2 评论 0原文

我正在尝试使用Mediaremote框架在Mac上访问音乐状态。我试图以这种方式获得游戏状态:

NotificationCenter.default.addObserver(self,
                                       selector: #selector(onChange),
                                       name: Notification.Name("kMRMediaRemoteNowPlayingApplicationIsPlayingDidChangeNotification"),
                                       object: nil)

但是,如果我尝试播放和停止音乐,则方法不会被调用。 我不知道我是否必须做其他事情,因为Mediaremote是一个私人框架。

I'm trying to use the MediaRemote framework to get access to music status on my mac. I tried to get the playing status in this way:

NotificationCenter.default.addObserver(self,
                                       selector: #selector(onChange),
                                       name: Notification.Name("kMRMediaRemoteNowPlayingApplicationIsPlayingDidChangeNotification"),
                                       object: nil)

but if i try to play and stop the music the method onChange doesn't get called.
I don't know if i have to do anything else due the fact that MediaRemote is a private framework.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墟烟 2025-02-13 16:51:29

找到了解决方案,实际上要收到通知我必须称之为此方法

void MRMediaRemoteRegisterForNowPlayingNotifications(dispatch_queue_t queue);

Found the solution, actually to get notified i had to call this method

void MRMediaRemoteRegisterForNowPlayingNotifications(dispatch_queue_t queue);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文