Youtube video is not showing controllers in uiwebview in ipad
hi all i am playing YouTube videos in ipad and iphone it is universal app.in iphone it is showing controlles but in ipad it is not showing the controllers.the code wha开发者_高级运维t i have writeen is as below.
-(void)viewWillAppear:(BOOL)animated
{if(self.interfaceOrientation == UIInterfaceOrientationPortrait||self.interfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown)
{
NSLog(@" before portrait videowebveiw frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
CGRect webviewframe=self.videowebveiw.frame;
webviewframe.size.width=748.0;
webviewframe.size.height=1024.0;
self.videowebveiw.frame=webviewframe;
embedHTML=[NSString stringWithFormat:@"<html><head><style type=\"text/css\">body {background-color: transparent;color: white; }</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\"width=768.0 height=1024.0></embed></body></html>",self.weburl];
NSLog(@" after portrait videowebveiw frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
}
else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft||self.interfaceOrientation== UIInterfaceOrientationLandscapeRight)
{
NSLog(@" before landscape webview frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
CGRect webviewframe=self.videowebveiw.frame;
webviewframe.size.width=1024.0;
webviewframe.size.height=748.0;
self.videowebveiw.frame=webviewframe;
embedHTML=[NSString stringWithFormat:@"<html><head><style type=\"text/css\">body {background-color: transparent;color: white; }</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\"width=1024.0 height=768.0></embed></body></html>",self.weburl];
NSLog(@" After landscape webview frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
}
[self loadwebview];
}
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if(toInterfaceOrientation == UIInterfaceOrientationPortrait||toInterfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown)
{
NSLog(@" before portrait videowebveiw frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
CGRect webviewframe=self.videowebveiw.frame;
webviewframe.size.width=748.0;
webviewframe.size.height=1024.0;
self.videowebveiw.frame=webviewframe;
embedHTML=[NSString stringWithFormat:@"<html><head><style type=\"text/css\">body {background-color: transparent;color: white; }</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\"width=768.0 height=1024.0></embed></body></html>",self.weburl];
NSLog(@" after portrait videowebveiw frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft||toInterfaceOrientation== UIInterfaceOrientationLandscapeRight)
{
NSLog(@" before landscape webview frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
CGRect webviewframe=self.videowebveiw.frame;
webviewframe.size.width=1024.0;
webviewframe.size.height=748.0;
self.videowebveiw.frame=webviewframe;
embedHTML=[NSString stringWithFormat:@"<html><head><style type=\"text/css\">body {background-color: transparent;color: white; }</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\"width=1024.0 height=768.0></embed></body></html>",self.weburl];
NSLog(@" After landscape webview frame is %f %f %f %f",self.videowebveiw.frame.origin.x,self.videowebveiw.frame.origin.y,self.videowebveiw.frame.size.width,self.videowebveiw.frame.size.height);
}
}
精彩评论