I am creating a MacOS media player in Python (version 3.10) and want to connect it to the MacOS "Now Playing" status.
I have worked with PyObjC a bit in order to listen for media key events, but have not been able to connect to the MPNowPlayingInfoCenter interface. According to the MPNowPlayingInfoCenter documentation I need access to a shared instance via the default()
method, however the method MediaPlayer.MPNowPlayingInfoCenter.default()
does not exist.
Does anyone have a starting point for Now Playing functionality via PyObjC?
CodePudding user response:
The factory method for getting the default center is named “defaultCenter” in Objective-C, and that’s the name you can use in Python as well.
https://developer.apple.com/documentation/mediaplayer/mpnowplayinginfocenter?language=objc