开发者

Youtube video is not showing controllers in uiwebview in ipad

开发者 https://www.devze.com 2023-04-03 23:37 出处:网络
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 i

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);

    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号