We have a radio player app for appleTV, that plays background music, but I can't find the API to catch the stop button press event ouside the app, or other app starting music too.
NotificationCenter.default.addObserver(self, selector: #selector(notification), name: NSNotification.Name.AVAudioSessionInterruption, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(notification), name: NSNotification.Name.AVAudioSessionSilenceSecondaryAudioHint, object: nil)
but this notifications are never called...
I don’t have experience with this on tvOS but on iOS you do this by:
becoming the Now Playing app
handling remote commands using MPRemoteCommandCenter
That infrastructure is present in the tvOS SDK so I believe it works the same there. See the Remote Control Events section of Event Handling Guide for iOS for details.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"