UIMoviePlayerControllerDidEnterFullscreenNotification在iOS8中不起作用

时间:2014-08-29 04:40:29

标签: uiwebview youtube ios8

我正在使用UIWebView使用iFrame播放YouTube视频 我正在使用UIMoviePlayerControllerDidEnterFullscreenNotification将youtube屏幕检测到全屏 如下代码:

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

适用于iOS7 但我尝试在iOS8中运行它 它不起作用。
我认为通知名称已经更改 有没有办法在ios8中检测youtube全屏事件?

5 个答案:

答案 0 :(得分:14)

markussvensson的实施有一些误报,因为任何UIWindowDidBecomeVisibleNotification都被认为是全屏视频播放,但事实并非如此。

实施" AVPlayerItemBecameCurrentNotification"通过Selvin可以捕捉电影播放开始,但无法捕捉电影播放停止。

所以我结合了两种实现,它按预期工作。

  1. 将观察者添加到AVPlayerItemBecameCurrentNotification& UIWindowDidBecomeHiddenNotification;

  2. 当AVPlayerItemBecameCurrentNotification发生时,设置一个标志;

  3. 当UIWindowDidBecomeHiddenNotification发生时,请检查该标记是否为"视频停止播放事件"。

  4. BTW,AVPlayerItemBecameCurrentNotification未记录,可能会在下一个iOS主要版本中被破坏。

答案 1 :(得分:10)

我有同样的问题。我找不到真正的解决方案,但我能够使用UIWindowDidBecomeVisibleNotification / UIWindowDidBecomeHiddenNotification通知解决它。

[[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");
}

答案 2 :(得分:5)

我同意@markussvensson。我确认iOS8上没有发布UIMoviePlayerControllerDidEnterFullscreenNotification

或者,您可以观察AVPlayerItemBecameCurrentNotification以查看YouTube视频是否全部来自UIWebView

检查我是否在NSNotificationCenter上写了一个钩子,以观察在视频播放过程中传递的所有通知。

#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

播放器全屏时记录数据

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) 

答案 3 :(得分:0)

我尝试使用下面的代码来查找备用通知名称。

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

但没有找到。
现在我正在使用HCYoutubeParser来获取直接视频网址 并通过MPMoviePlayerController播放 但这很危险。
您不知道Google什么时候更改直接网址的规则。

答案 4 :(得分:0)

你以错误的方式解决这个问题。

不是将整个应用程序限制为纵向,然后尝试使视频播放器允许横向,而是应该允许整个应用程序中的横向,然后将您的视图控制器(或根视图控制器)限制为仅允许纵向模式,像这样:

在目标设置中,允许应用的横向显示:

enter image description here

在视图控制器中,添加此项以将其限制为纵向:

-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}