Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DavidBlack

macrumors 6502a
Original poster
Jan 27, 2013
606
239
Somewhere In Apple's HQ ;)
I am using Webkit to display some content from YouTube in a webview.

Background

OS: OS X 10.10.2
SDK: OS X 10.10

Problem

As I stated before I am using a WebView to display content from YouTube. But, I ran into some problems which I have outlined below

When attempting to use the YouTube's fullscreen action this is what happens:

Test One (Using Flash):

Observations:

What I did: When using the Flash player on YouTube’s website when I attempted to play a video everything worked fine. Additionally, when I clicked the YouTube video’s full screen button the window did appear in full screen. However, it is not completely fullscreen (the menu bar is still visible)

What I expected: I expected that the video would have entered fullscreen entirely. In Safari everything works fine.

Test Two (Using HTML5):

Observations:

What I did: When using the HTML5 player on YouTube’s website when I attempted to play a video everything worked fine. However, when I clicked the YouTube video’s full screen button nothing happened.

What I expected: I expected that the video would have entered full screen. I did noticed when doing this ins Safari everything worked as expected.

Can someone please help me with this matter, I have searched everywhere and found nothing.

Here is a sample of the test app I did to illustrate this problem:
Code:
#import "AppDelegate.h"

@interface AppDelegate ()

@property (weak) IBOutlet NSWindow *window;
@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application
    
    NSURL *url = [NSURL URLWithString:@"https://www.youtube.com"];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    [[[self webView] mainFrame] loadRequest:urlRequest];
    [self.window setContentView:self.webView];
    
    BOOL shouldUsPlugin = YES; //When yes WebView will use Flash if available, else will use HTML5
    
    if (shouldUsPlugin == YES) {
        
        [[[self webView]preferences]setPlugInsEnabled:YES];
        
        //Test 1: Using Flash
        
   /* Observations:
        What I did: When using the Flash player on YouTube’s website when I attempted to play a video everything worked fine. Additionally, when I clicked the YouTube video’s full screen button the window did appear in full screen. However, it is not completely fullscreen (the menu bar is still visible)
        What I expected: I expected that the video would have entered fullscreen entirely. Again in Safari everything works fine.

       
      */
   
    } else{
        
        [[[self webView]preferences]setPlugInsEnabled:NO];
        
        //Test 2: Using HTML5
        
        /* Observations:
         What I did: When using the HTML5 player on YouTube’s website when I attempted to play a video everything worked fine. However, when I clicked the YouTube video’s full screen button nothing happened.
         What I expected: I expected that the video would have entered full screen. I did noticed when doing this ins Safari everything worked as expected.
         */

    }
    
    
}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
    // Insert code here to tear down your application
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.