objective-c - Cocoa webview - html5 视频全屏不工作

标签 objective-c cocoa webview webkit html5-video

我正在尝试构建一个带有集成 webkit webview 的 osx cocoa 应用程序来显示网页。

网页上有 html5 视频元素,用户应该可以全屏播放。 但是全屏只是在 mountain lion (10.8.2) 上显示黑屏音频仍在播放,但在 osx lion 上它有效,这是一个错误还是我错过了什么。

最小样本:

步骤:

创建一个 cocoa 应用程序添加一个 webview 连接属性“web”并添加 webkit 框架

代码:

#AppDelegate.h

#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (weak) IBOutlet WebView *web;
@end

#AppDelegate.m

#import "AppDelegate.h"

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
  NSString *html = @"<html><body><video src=\"http://video-js.zencoder.com/oceans-clip.mp4\" controls></body></html>";
  [[self.web mainFrame] loadHTMLString:html baseURL:nil];
}
@end

已在 OSX 10.8.3 中修复:

问题似乎已在 OSX 10.8.3 全屏中修复,现在可以正常工作,即使没有像 OSX 10.8.2 之前那样的沙盒

最佳答案

我使用您发布的确切代码设置了一个项目。这对我来说确实失败了,并且只在全屏模式下显示黑屏。

然而,这似乎是 WebKit 的沙盒问题。沙盒化后,应用程序全屏按预期工作。 (使用 10.8.2)

该应用是沙盒,无需任何额外权限即可运行:

enter image description here

关于objective-c - Cocoa webview - html5 视频全屏不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12536897/

相关文章:

iOS 更改引脚注释的颜色

iphone - 核心数据 : multiple copies of the same item linked to another?

swift - 我如何在 swift 中使用在新选项卡中打开?(WEBKIT)

javascript - iPhone webview 键盘将布局上推并保留

iOS iPad Storyboard未被选中

ios - 在 Objective C 中对字典的字典进行排序

ios - MPMoviePlayerViewController 移除 "Audio and Subtitles"控制

ios - 内存管理。 CF 对象的字节副本

objective-c - FSEvents-检测文件夹上的事件类型

Google Play 拒绝 Android 应用