Cocoa webview - html5视频全屏不工作 [英] Cocoa webview - html5 video fullscreen not working
问题描述
我在网页上使用html5视频元素,用户应该使用这些视频元素能够全屏播放。
但全屏只是显示一个黑色的屏幕山狮(10.8.2)音频仍在玩,但osx狮子它的工作,这是一个错误,或者我错过了一些。
最低样本:
步骤:
创建可可应用程序add a webview connect the property 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
#importAppDelegate.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
FIXED IN OSX 10.8.3:
问题似乎在OSX 10.8.3全屏正在工作,即使没有沙盒,因为它在OSX 10.8.2
我使用您发布的确切代码设置项目。这对我来说确实失败,并且在全屏模式下只显示一个黑屏。
但这似乎是一个沙盒问题与WebKit。沙箱后,应用程序的全屏幕按预期工作。 (使用10.8.2)
该应用程序是沙箱,没有任何额外的权限,使这项工作:
>
I'm trying to build an osx cocoa application with an integrated webkit webview to display a web page.
On the webpage are html5 video elements which the user should be able to play in fullscreen. But fullscreen just shows a black screen on mountain lion (10.8.2) audio is still playing but on osx lion it worked, is this a bug or did I miss something.
Minimum Sample:
Steps:
Create a cocoa app add a webview connect the property "web" and add the webkit framework
Code:
#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
FIXED IN OSX 10.8.3:
Problem seems to be fixed in OSX 10.8.3 fullscreen is working now, even without sandboxing as it did prior to OSX 10.8.2
I setup a project with the exact code you posted. This did indeed fail for me, and only showed a black screen in full-screen mode.
However this seems to be a sandboxing issue with WebKit. After sandboxing the app full screen worked as expected. (Using 10.8.2)
The app was sandbox without any additional permissions needed to make this work:
这篇关于Cocoa webview - html5视频全屏不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!