Background Music and Play/Pause Button

Hi,


I’m currently making a SpriteKit game in tvOS and am using the Play/Pause button on the remote as my games secondary button. The code to make this work is as follows:


let pushPlay = UITapGestureRecognizer(target: self, action: #selector(pushedPlay))

pushPlay.allowedPressTypes = [NSNumber(value: UIPress.PressType.playPause.rawValue)]

self.view?.addGestureRecognizer(pushPlay)


This works great, but stops any music from playing in the background from the Apple Music app. As my game is a card game I would prefer to allow users to play their own music if they wish to. I’ve noticed this behavior on most Apple apps on tvOS and wondered if there was any way to override the pausing of music when the play/pause button is pushed?


Thanks,

Liam

Replies

did you ever get help for this? and was it in Swift?