Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa webview - html5 video fullscreen not working

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

like image 795
tripplet Avatar asked Nov 27 '22 10:11

tripplet


1 Answers

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:

enter image description here

like image 52
Joris Kluivers Avatar answered Nov 28 '22 22:11

Joris Kluivers