2

How can i detect showing on Apple TV?

I've tried already to detect num of screens:

[[UIScreen screens] count]

But it remains on 1.

I've tried also to listen to an event:

    [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(screenDidConnect:)
                                             name:UIScreenDidConnectNotification
                                           object:nil];

But the event never fire.

Any tips/tricks?

Thanks in advance!

3
  • Not sure if I understand your question correctly - but is this a duplicate of stackoverflow.com/questions/9272223/…?
    – rist
    Commented Feb 6, 2014 at 10:11
  • Not exactly, The above question/answer talk about detect airPlay available, and that's all. I need to detect when the user actually show the movie on AppleTV (airPlay). Any idea?
    – gran33
    Commented Feb 6, 2014 at 10:28
  • 1
    So you have a MPMMoviePlayerController, the user clicks the Airplay button and it runs on the Apple TV. What and how the user interacts is probably hard to detect as the stream is handled completely by the AppleTV (just disconnect your device from the wifi and you will see that the stream still runs)
    – rist
    Commented Feb 6, 2014 at 10:31

1 Answer 1

4

Found the answer!

As simple as it could be:

Just do:

self.moviePlayer.isAirPlayVideoActive

It will return me whether the AirPlay is active/not active.

Thanks @rist

Not the answer you're looking for? Browse other questions tagged or ask your own question.