Search This Blog

Thursday 24 July 2014

Youtube Embeded not playing in landscape mode in iOS6 and above

Just Copy and paste below code in your AppDelegate

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    
    id presentedViewController = [window.rootViewController presentedViewController];
    NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil;
    
    if (window && [className isEqualToString:@"MPInlineVideoFullscreenViewController"]) {
        return UIInterfaceOrientationMaskAll;
    } else {
        return UIInterfaceOrientationMaskPortrait;
    }
    

}

Saturday 12 July 2014

Play Youtube video in webview with HTML

Copy and Paste below code and load in your webview:

NSURL *myURL =[NSURL URLWithString:@"http://www.youtube.com/v/zah99ETVOz4"];

NSString *embedHTML = @"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"212\" height=\"172\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\"type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"320\" height=\"270\"></embed></object></div></body></html>";

NSString *html = [NSString stringWithFormat:embedHTML, myURL,myURL,myURL];





[YourWebView loadHTMLString:html baseURL:nil];