iphone – UIWebView Youtube embed sound plays but no video shows in iOS 3.2 (iPad) – Education Career Blog

I’m using a UIWebView to display YouTube videos. It works fine on iOS 4+ but doesn’t work on the iPad (iOS 3.2). The UIWebView loads as expected and displays the thumbnail of the video. When I tap on the thumbnail I see a gray quicktime icon and can hear sound but no video appears.

This is the code I’m using:

UIWebView* webView = UIWebView alloc initWithFrame: CGRectMake(0,0,320,480);
NSURL *url = NSURL URLWithString:@"http://url.to.video/";
NSURLRequest *request = NSURLRequest requestWithURL:url;
webView loadRequest:request;

VideoPlayerController* videoController = VideoPlayerController alloc init;
videoController view addSubview:webView;
UINavigationController*  theNavController = UINavigationController alloc

initWithRootViewController:videoController;
self presentModalViewController:theNavController animated:YES;

videoController release;
theNavController release;
webView release;

,

This is a bug with iOS 3.2 on the iPad. It will (hopefully) be fixed when iOS 4.2 is released in November.

Leave a Comment