Iphone 如何为ipad嵌入视频url -(void)embeddeYouTube:(NSString*)url帧:(CGRect)帧{ NSString*htmlString=[NSString stringWithFormat:\ \ \ \ \ \ \ “,url,url]; webView=[[UIWebView alloc]initWithFrame:frame]; webView.delegate=self; [webView setScalesPageToFit:TRUE]; [webView setContentMode:UIViewContentModeTop]; [self.view addSubview:webView]; [webView加载htmlString:htmlString基URL:nil]; }

Iphone 如何为ipad嵌入视频url -(void)embeddeYouTube:(NSString*)url帧:(CGRect)帧{ NSString*htmlString=[NSString stringWithFormat:\ \ \ \ \ \ \ “,url,url]; webView=[[UIWebView alloc]initWithFrame:frame]; webView.delegate=self; [webView setScalesPageToFit:TRUE]; [webView setContentMode:UIViewContentModeTop]; [self.view addSubview:webView]; [webView加载htmlString:htmlString基URL:nil]; },iphone,ipad,Iphone,Ipad,我已经实现了上面的代码。它在iPhone上运行良好,但在iPad上我只听到音频,视频不显示 如何在这两种类型的设备上都能做到这一点?这样就可以了。请尝试以下代码: (请注意,它只能在设备上工作,不能在模拟器上工作) 这就可以了。请尝试以下代码: (请注意,它只能在设备上工作,不能在模拟器上工作) 我在工作了两天之后得到了解决方案。。。 解决方案是我需要在视图中添加和iphone不同的控制器。 但请记住一件事,在忽略视图的同时写下这两行 NSURL *videoURL = [NSURL URL

我已经实现了上面的代码。它在iPhone上运行良好,但在iPad上我只听到音频,视频不显示


如何在这两种类型的设备上都能做到这一点?

这样就可以了。请尝试以下代码:

(请注意,它只能在设备上工作,不能在模拟器上工作)


这就可以了。请尝试以下代码:

(请注意,它只能在设备上工作,不能在模拟器上工作)


我在工作了两天之后得到了解决方案。。。 解决方案是我需要在视图中添加和iphone不同的控制器。 但请记住一件事,在忽略视图的同时写下这两行

  NSURL *videoURL = [NSURL URLWithString: @"http://www.youtube.com/embed/iyKsSPHM0wE"];



    NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; 
    [NSURLCache setSharedURLCache:sharedCache]; [sharedCache release];
    //

    NSURLRequest *request = [[NSURLRequest alloc] initWithURL: videoURL cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval: 30.0];  
    [webView loadRequest: request];  
    [request release];

我在工作了两天之后得到了解决方案。。。 解决方案是我需要在视图中添加和iphone不同的控制器。 但请记住一件事,在忽略视图的同时写下这两行

  NSURL *videoURL = [NSURL URLWithString: @"http://www.youtube.com/embed/iyKsSPHM0wE"];



    NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; 
    [NSURLCache setSharedURLCache:sharedCache]; [sharedCache release];
    //

    NSURLRequest *request = [[NSURLRequest alloc] initWithURL: videoURL cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval: 30.0];  
    [webView loadRequest: request];  
    [request release];

感谢您的重播,但它不能像这样帮助您,因为它不能像实现上述代码一样在播放器中直接播放视频,并在设备(真正的iphone或iPod)中播放。感谢您的重播,但它不能像这样帮助您,因为它不能像实现上述代码一样在播放器中直接播放视频,并在设备(真正的iphone或iPod)中播放视频。
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];