How to detect when user enters and exits airplay in tvOS (tvml/tvjs) app

109 Views Asked by At

What event should I be looking for in order to detect when a user interrupts my app by streaming other airplay content to their apple TV.

The more important of these two from my perspective is to detect when the user exits airplay and my app regains 'focus' - but both enter and exit would be useful.

1

There are 1 best solutions below

0
On BEST ANSWER

just tested and yes, the onResume and onSuspend callback function is called according to the apple docs:

https://developer.apple.com/documentation/tvmljs/app

I don't think you can tell if it was suspended from Airplay or Siri tho. I would imagine you can add gesture recognizers to see what button is pressed and tell if it was from any of the button clicks.