UIMoviePlayerControllerDidEnterFullscreenNotification doesn’t work in iOS8

The implementation by markussvensson has some false alarms, since any UIWindowDidBecomeVisibleNotification is considered as a full screen video playback which is not true.

The implementation “AVPlayerItemBecameCurrentNotification” by Selvin can catch movie playback start, but cannot catch movie playback stop.

So I combined both implementations and it works as expected.

  1. Add observer to both AVPlayerItemBecameCurrentNotification & UIWindowDidBecomeHiddenNotification;

  2. When AVPlayerItemBecameCurrentNotification happens, set a flag;

  3. When UIWindowDidBecomeHiddenNotification happens, check the flag to see if it is a “video stop playing event”.

BTW, AVPlayerItemBecameCurrentNotification is undocumented and might be broken for the next iOS major release.

Leave a Comment