0

视频显示在 iPad 上。您可以点击以调出控件。全屏按钮显示在右下方,但点击它没有任何作用。它应该让播放器进入全屏模式。有什么我可以添加到此代码中以使其工作的吗?

NSString *htmlStr = [NSString stringWithFormat:@"<body style=\"margin:0;padding:0;\" ><iframe class=\"youtube-player\" type=\"text/html\" width=\"420\" height=\"226\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\" allowfullscreen></iframe>",video_ID];

UIWebView *videoView = [[UIWebView alloc] initWithFrame:thumb.frame];
            videoView.backgroundColor = [UIColor darkGrayColor];
            videoView.scrollView.scrollEnabled = NO; 
            [videoView loadHTMLString:htmlStr baseURL:nil];
            [videoCcontainer addSubview:videoView];
4

1 回答 1

0

尝试使用嵌入,而不是 iframe:http: //mobiledevelopertips.com/video/display-youtube-videos-without-exiting-your-application.html

NSString *youTubeVideoHTML = @"<html><head>\
                      <body style=\"margin:0\">\
                      <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
                      width=\"%0.0f\" height=\"%0.0f\"></embed>\
                      </body></html>";
于 2012-09-04T19:30:55.903 回答