开发者

can I check youtube videos on simulator using this code?

I am using this code to see youtube videos

- (YouTubeView *)initWithStringAsURL:(NSString *)urlString frame:(CGRect)frame;
 {
if (self = [super init]) 
{
    // Create webview with requested frame size
    self = [[UIWebView alloc] initWithFrame:frame];

    // HTML to embed YouTube video
    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>";

    // Populate HTML with the URL开发者_如何转开发 and requested frame size
    NSString *html = [NSString stringWithFormat:youTubeVideoHTML, urlString, frame.size.width, frame.size.height];

    // Load the html into the webview
    [self loadHTMLString:html baseURL:nil];
}
return self;  

}

Now I am not able to see the relative video on the simulator..however white webview is coming there..

so is there anything like that that I cannot see youtube videos on simulator or there is any other problem in the code?


You can't see Youtube video in simulator. If white webview is showing, I think your code works.

Try installing on your iPhone/iPod touch.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜