UIMoviePlayerControllerDidEnterFullscreenNotification doesn't work in iOS8
Asked Answered
H

5

23

I am using UIWebView to play a youtube video with iFrame.
I am using UIMoviePlayerControllerDidEnterFullscreenNotification to detect youtube screen into fullscreen.
Like below code :

[[NSNotificationCenter defaultCenter] addObserver: self
                                         selector: @selector(myMovieEnterFullScreen:)
                                             name: @"UIMoviePlayerControllerDidEnterFullscreenNotification"
                                           object: nil];

It works in iOS7.
But I try to run it in iOS8.
It doesn't work.
I think the notification name has be changed.
Has any alternative to detect the youtube fullscreen event in ios8?

Hebel answered 29/8, 2014 at 4:40 Comment(2)
I have same problem... :(Alarick
going through same issue, anyhelp would be greatMarlysmarmaduke
F
13

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.

Frodeen answered 8/10, 2014 at 18:23 Comment(3)
+1 good thought! 1 caveat in my approach is that the second time when the playback starts we do not receive the AVPlayerItemBecameCurrentNotification. See the comments below my answer.Propriety
Any thoughts on a work around for WKWebView? The AVPlayerItemBecameCurrentNotification doesn't get triggered in WKWebView. This does appear to work for UIWebView, though.Azov
@SteveE can find any solution for WKWebView detect video playing if you find please help me on #55378177Would
M
10

I have the same problem. I have found no real solution, but I was able to work around it with UIWindowDidBecomeVisibleNotification / UIWindowDidBecomeHiddenNotification notifications.

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(windowVisible:)
                                             name:UIWindowDidBecomeVisibleNotification
                                           object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(windowHidden:)
                                             name:UIWindowDidBecomeHiddenNotification
                                           object:self.view.window];

- (void)windowVisible:(NSNotification *)notification
{
    NSLog(@"-windowVisible");
}

- (void)windowHidden:(NSNotification *)notification
{
    NSLog(@"-windowHidden");
}
Mountie answered 20/9, 2014 at 20:1 Comment(0)
P
5

I agree with @markussvensson. And I confirm that there is no UIMoviePlayerControllerDidEnterFullscreenNotification posted on iOS8.

Alternatively you can observe to AVPlayerItemBecameCurrentNotification to find out if the youtube video goes full screen from the UIWebView.

To check that I wrote a hook on NSNotificationCenter to observe all notifications that are passed around during the video playback.

#import "NSNotificationCenter+Hook.h"
#import <objc/runtime.h>

@implementation NSNotificationCenter (Hook)

+ (void)load
{
    Method original = class_getInstanceMethod([NSNotificationCenter class], @selector(postNotificationName:object:userInfo:));
    Method swizzled = class_getInstanceMethod([NSNotificationCenter class], @selector(swizzle_postNotificationName:object:userInfo:));

    method_exchangeImplementations(original, swizzled);

    original = class_getInstanceMethod([NSNotificationCenter class], @selector(postNotificationName:object:));
    swizzled = class_getInstanceMethod([NSNotificationCenter class], @selector(swizzle_postNotificationName:object:));

    method_exchangeImplementations(original, swizzled);

    original = class_getInstanceMethod([NSNotificationCenter class], @selector(postNotification:));
    swizzled = class_getInstanceMethod([NSNotificationCenter class], @selector(swizzle_postNotification:));

    method_exchangeImplementations(original, swizzled);
}

- (void)swizzle_postNotificationName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo{

    NSLog(@"HOOK_NOTIFICATION_With_UserInfo: %@",aName);
    [[NSNotificationCenter defaultCenter]swizzle_postNotificationName:aName object:anObject userInfo:aUserInfo];

}

- (void)swizzle_postNotificationName:(NSString *)aName object:(id)anObject{
    NSLog(@"HOOK_NOTIFICATION_Without_UserInfo: %@",aName);
    [[NSNotificationCenter defaultCenter]swizzle_postNotificationName:aName object:anObject];
}

- (void)swizzle_postNotification:(NSNotification *)notification
{
    NSLog(@"HOOK_NOTIFICATION_NSNotification: %@",notification.name);
    [[NSNotificationCenter defaultCenter]swizzle_postNotification:notification];
}

@end

Log data when the player becomes full screen

2014-09-29 14:07:45.808 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: 
UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.808 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.808 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.809 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.809 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIWindowSystemGestureStateChangedNotification
2014-09-29 14:07:45.809 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.810 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.810 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.810 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.810 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.810 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.812 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.812 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.819 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIWindowSystemGestureStateChangedNotification
2014-09-29 14:07:45.825 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.825 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.825 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.825 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.826 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.826 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.826 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.826 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.826 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.826 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.827 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.827 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.827 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.827 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.827 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.828 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.828 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.828 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.828 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.828 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.829 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.830 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.830 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.830 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.831 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.831 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.831 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.831 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.832 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.832 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.832 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.832 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.833 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.833 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.838 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.839 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.839 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.839 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.839 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.839 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.840 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.840 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.840 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.840 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.840 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.841 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.841 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.841 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.841 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.841 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.842 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.842 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.842 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.842 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.843 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.843 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.843 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.843 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.844 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.844 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.844 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.844 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.844 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.844 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.845 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.845 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.845 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:45.845 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.179 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIWindowFirstResponderDidChangeNotification
2014-09-29 14:07:46.180 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.180 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.180 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.180 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.181 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:46.181 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:46.219 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.219 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.219 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.219 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.220 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.220 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.220 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.220 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.220 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.220 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.221 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:46.221 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:47.398 MyProject***[3459:194167] HOOK_NOTIFICATION_With_UserInfo: AVPixelBufferAttributeMediatorPixelBufferAttributesDidChangeNotification
2014-09-29 14:07:47.398 MyProject***[3459:194167] HOOK_NOTIFICATION_With_UserInfo: AVPixelBufferAttributeMediatorPixelBufferAttributesDidChangeNotification
2014-09-29 14:07:47.398 MyProject***[3459:194167] HOOK_NOTIFICATION_With_UserInfo: AVPixelBufferAttributeMediatorPixelBufferAttributesDidChangeNotification
2014-09-29 14:07:47.399 MyProject***[3459:194167] HOOK_NOTIFICATION_With_UserInfo: AVPixelBufferAttributeMediatorPixelBufferAttributesDidChangeNotification
2014-09-29 14:07:47.400 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: AVPixelBufferAttributeMediatorPixelBufferAttributesDidChangeNotification
2014-09-29 14:07:47.424 MyProject***[3459:193561] HOOK_NOTIFICATION_NSNotification: AVPlayerItemTimebaseChangedNotification
2014-09-29 14:07:47.426 MyProject***[3459:193561] HOOK_NOTIFICATION_NSNotification: AVPlayerItemTimeJumpedNotification
2014-09-29 14:07:47.426 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: AVPixelBufferAttributeMediatorPixelBufferAttributesDidChangeNotification
2014-09-29 14:07:47.702 MyProject***[3459:193561] HOOK_NOTIFICATION_NSNotification: AVPlayerItemTimebaseChangedNotification
2014-09-29 14:07:47.702 MyProject***[3459:193561] HOOK_NOTIFICATION_NSNotification: AVPlayerItemBecameCurrentNotification
2014-09-29 14:07:47.739 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIWindowDidCreateWindowContextNotification
2014-09-29 14:07:47.740 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIWindowContentWillRotateNotification
2014-09-29 14:07:47.741 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIWindowContentWillRotateNotification
2014-09-29 14:07:47.741 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UIWindowDidBecomeVisibleNotification
2014-09-29 14:07:47.741 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIWindowDidBecomeVisibleNotification
2014-09-29 14:07:47.741 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UIWindowDidResignKeyNotification
2014-09-29 14:07:47.741 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIWindowDidResignKeyNotification
2014-09-29 14:07:47.742 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UIWindowDidBecomeKeyNotification
2014-09-29 14:07:47.742 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIWindowDidBecomeKeyNotification
2014-09-29 14:07:47.746 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.747 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.747 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.747 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.747 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.747 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.748 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.748 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.750 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.750 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.750 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.750 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.750 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.751 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.751 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.751 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.765 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.765 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.765 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.766 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.766 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.766 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.766 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.767 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: MPRemoteCommandTargetsDidChangeNotification
2014-09-29 14:07:47.900 MyProject***[3459:193561] HOOK_NOTIFICATION_NSNotification: AVPlayerItemNewAccessLogEntry
2014-09-29 14:07:47.901 MyProject***[3459:193561] HOOK_NOTIFICATION_NSNotification: AVPlayerItemTimeJumpedNotification
2014-09-29 14:07:47.903 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: _UIApplicationDidBeginIgnoringInteractionEventsNotification
2014-09-29 14:07:47.904 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIApplicationDidBeginIgnoringInteractionEventsNotification
2014-09-29 14:07:47.904 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:47.904 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:47.920 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.386 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: _UIApplicationDidEndIgnoringInteractionEventsNotification
2014-09-29 14:07:48.387 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIApplicationDidEndIgnoringInteractionEventsNotification
2014-09-29 14:07:48.387 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.387 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.387 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIApplicationStatusBarHeightChangedNotification
2014-09-29 14:07:48.387 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.387 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.390 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:48.390 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UITextEffectsWindowDidRotateNotification
2014-09-29 14:07:48.432 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.433 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.437 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.437 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.446 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: _UIApplicationDidBeginIgnoringInteractionEventsNotification
2014-09-29 14:07:48.447 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIApplicationDidBeginIgnoringInteractionEventsNotification
2014-09-29 14:07:48.447 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.447 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.450 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: _UIApplicationDidEndIgnoringInteractionEventsNotification
2014-09-29 14:07:48.450 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIApplicationDidEndIgnoringInteractionEventsNotification
2014-09-29 14:07:48.495 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:48.496 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.645 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.696 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:48.699 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:49.491 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:49.491 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:50.037 MyProject***[3459:194254] HOOK_NOTIFICATION_NSNotification: AVURLAssetDownloadCompleteSuccessNotification
2014-09-29 14:07:50.491 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:50.491 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:51.492 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:51.492 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:52.493 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:52.493 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:52.830 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: _UIApplicationDidBeginIgnoringInteractionEventsNotification
2014-09-29 14:07:52.830 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIApplicationDidBeginIgnoringInteractionEventsNotification
2014-09-29 14:07:52.830 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:53.034 MyProject***[3459:193561] HOOK_NOTIFICATION_Without_UserInfo: _UIApplicationDidEndIgnoringInteractionEventsNotification
2014-09-29 14:07:53.034 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: _UIApplicationDidEndIgnoringInteractionEventsNotification
2014-09-29 14:07:53.035 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:53.496 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:53.496 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:54.497 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:54.497 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:55.499 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:55.500 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:56.502 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:56.502 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:57.505 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:57.506 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
2014-09-29 14:07:58.508 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidCommitNotification
2014-09-29 14:07:58.508 MyProject***[3459:193561] HOOK_NOTIFICATION_With_UserInfo: UIViewAnimationDidStopNotification
(lldb) 
Propriety answered 29/9, 2014 at 9:16 Comment(4)
it seem can't detect second time fullscreen event.Hebel
is this happening on iOS 8? let me check that. It fired the AVPlayerItemBecameCurrentNotification whenever entered fullscreen mode from a UIWebView.Propriety
My situation like below: Step 1: play fullscreen video. (fullscreen) Step 2: press "done" button. (not fullscreen) Step 3: Play video again by tapping play icon on UIWebview. (fullscreen) At step 1, AVPlayerItemBecameCurrentNotification is triggered, but not triggered at step 3.Hebel
@Hebel yes you are right. i have not faced this one because after step 2 I am reloading the webview with the youtube URL again. So that the webview shows the initial stage of the youtube video. Then again if I do step 3, i get the AVPlayerItemBecameCurrentNotification. If you do not wish to do the reloading then its better to observe name:UIWindowDidBecomeVisibleNotification.Propriety
H
0

I have tried use below code to find a alternative notification name.

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserverForName:nil
                    object:nil
                     queue:nil
                usingBlock:^(NSNotification *notification)
{
     NSLog(@"%@", notification.name);
}];

but have no found.
now I am using HCYoutubeParser to get direct video url.
and play it through MPMoviePlayerController.
but it will be dangerous.
You have no idea what time Google change rule on direct url.

Hebel answered 15/9, 2014 at 3:2 Comment(0)
T
0

You're going about this the wrong way.

Instead of limiting the entire app to Portrait and then trying to make the video player allow landscape, you should instead allow landscape all over your app and then limit your invididual view controllers (or the root view controller) to only allow Portrait mode, like this:

In the target settings, allow landscape for your app:

enter image description here

In your view controller(s), add this to limit it to portrait orientation:

-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}
Thay answered 24/8, 2015 at 10:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.