我正在用 Python(3.10 版)創建 MacOS 媒體播放器,并希望將其連接到 MacOS“正在播放”狀態。
我曾使用 PyObjC 來偵聽媒體關鍵事件,但無法連接到 MPNowPlayingInfoCenter 介面。根據MPNowPlayingInfoCenter 檔案,我需要通過該default()方法訪問共享實體,但是該方法MediaPlayer.MPNowPlayingInfoCenter.default()不存在。
有沒有人有通過 PyObjC 開始播放功能的起點?
uj5u.com熱心網友回復:
獲取默認中心的工廠方法在Objective-C 中被命名為“defaultCenter”,這也是您可以在Python 中使用的名稱。
https://developer.apple.com/documentation/mediaplayer/mpnowplayinginfocenter?language=objc
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/359025.html
