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
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With