Iphone Youtube视频崩溃Xcode ios6

Iphone Youtube视频崩溃Xcode ios6,iphone,ios,ios6,uiwebview,youtube,Iphone,Ios,Ios6,Uiwebview,Youtube,在UIWebview中,当我试图在youtube上播放任何视频时,它会使我的xcode崩溃,我正在使用iOS6。。我只是简单地使用了UIWebview,将url youtube加载到其中……我需要嵌入mediaplayer来播放视频吗 在youtube上播放UIWebView 代码 - (void)viewDidLoad { [super viewDidLoad]; NSString *newVersionHTML = @"<html>\ <style>body{p

UIWebview
中,当我试图在
youtube上播放任何视频时,它会使我的xcode崩溃,我正在使用iOS6。。我只是简单地使用了
UIWebview
,将url youtube加载到其中……我需要嵌入mediaplayer来播放视频吗

在youtube上播放
UIWebView

代码

- (void)viewDidLoad
{
[super viewDidLoad];


 NSString *newVersionHTML = @"<html>\
<style>body{padding:0;margin:0;}</style>\
<iframe width=\"%0.0f\" height=\"%0.0f\" src=\"http://www.youtube.com/embed/%@?modestbranding=1;title=;showinfo=0;rel=0;controls=0\" frameborder=\"0\" allowfullscreen></iframe>\
</html>";

  NSString *htmlToLoad = [NSString stringWithFormat:newVersionHTML, webView.frame.size.width, webView.frame.size.height,videoId];
 [webView loadHTMLString:htmlToLoad baseURL:nil];
 webView.delegate = self;
// self.webView.mediaPlaybackRequiresUserAction = NO;


webView=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 1024, 768)];


[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.youtube.com/"]]]];
 [self.view addSubview:webView];

}
-(void)viewDidLoad
{
[超级视图下载];
NSString*newVersionHTML=@”\
正文{填充:0;边距:0;}\
\
";
NSString*htmlToLoad=[NSString stringWithFormat:newVersionHTML,webView.frame.size.width,webView.frame.size.height,videoId];
[webView loadHTMLString:HtmlLoad baseURL:nil];
webView.delegate=self;
//self.webView.mediaplaybackrequiresseraction=否;
webView=[[UIWebView alloc]initWithFrame:CGRectMake(0,0,1024,768)];
[self.webView加载请求:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@]http://www.youtube.com/"]]]];
[self.view addSubview:webView];
}
新错误

2013-02-13 11:08:20.902 webview[593:c07] [MPAVController] Autoplay: Enabling autoplay
2013-02-13 11:08:20.903 webview[593:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
2013-02-13 11:08:20.903 webview[593:c07] setting movie path: http://r4---sn-ci5gupcc-cage.c.youtube.com/videoplayback?el=watch&itag=18&cp=U0hVRVdQVF9IU0NONV9PSlhFOl9xb2x5ZzMxX3Zw&sver=3&expire=1360756439&yms=_tpjcd07_wk&signature=0659B5710FD8503E5AA5059CE35A9754DD59B90F.5194D7A1B0EC8749FC91CC1B31261B81950E801E&upn=Y8J9bVD4jLE&newshard=yes&ratebypass=yes&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&ipbits=8&source=youtube&id=748bf802989d33fb&app=youtube_mobile&key=yt1&ip=122.179.77.11&fexp=906335%2C901802%2C909917%2C910207%2C914052%2C916613%2C901446%2C920704%2C912806%2C902000%2C922403%2C922405%2C929901%2C913605%2C925710%2C929114%2C925006%2C908529%2C920201%2C911116%2C926403%2C910221%2C901451%2C919114&dnc=1&mt=1360733832&mv=m&ms=au&cpn=dxlJMMz5hJkR_ARd&ptk=Radaantv&oid=bGpsJKyLNbnXo_1YohiEiw&ptchn=RadaanMedia&pltype=content
2013-02-13 11:08:20.904 webview[593:c07] [MPAVController] Autoplay: Enabling autoplay
2013-02-13 11:08:20.908 webview[593:c07] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
2013-02-13 11:08:23.974 webview[593:8817]  <0xb057e000> Error '!obj' trying to fetch default input device's sample rate
2013-02-13 11:08:23.974 webview[593:8817]  <0xb057e000> Error getting audio input device sample rate: '!obj'
2  013-02-13 11:08:23.975 webview[593:8817]  <0xb057e000> AQMEIOManager::FindIOUnit: error 'NoHW'
2013-02-13 11:08:23.975 webview[593:c07]  <com.apple.main-thread> AQMEIOManager::FindIOUnit: error 'NoHW'
2013-02-13 11:08:24.567 webview[593:c07]  <com.apple.main-thread> AQMEIOManager::FindIOUnit: error 'NoHW'
2013-02-13 11:08:24.567 webview[593:c07]  <com.apple.main-thread> AQMEIOManager::FindIOUnit: error 'NoHW'
2013-02-13 11:08:24.569 webview[593:c07]  <com.apple.main-thread> AQMEIOManager::FindIOUnit: error 'NoHW'
2013-02-13 11:08:20.902网络视图[593:c07][MPAVController]自动播放:启用自动播放
2013-02-13 11:08:20.903网络视图[593:c07][MPAVController]自动播放:跳过自动播放,已禁用(对于当前项目:0,在播放器:1上)
2013-02-13 11:08:20.903网络视图[593:c07]设置电影路径:http://r4---sn-ci5gupcc-cage.c.youtube.com/videoplayback?el=watch&itag=18&cp=U0hVRVdQVF9IU0NONV9PSlhFOl9xb2x5ZzMxX3Zw&sver=3&expire=1360756439&yms=_tpjcd07_wk&signature=0659B5710FD8503E5AA5059CE35A9754DD59B90F.5194D7A1B0EC8749FC91CC1B31261B81950E801E&upn=Y8J9bVD4jLE&newshard=yes&ratebypass=yes&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&ipbits=8&source=youtube&id=748bf802989d33fb&app=youtube\u mobile&key=yt1&ip=122.179.77.11&fexp=906335%2C901802%2C909917%2C910207%2C914052%2C916613%2C901446%2C920704%2C912806%2C902000%2C922403%2C922403%2C922405%2C925710%2C929114%2C925006%2C928529%2C92012920291714%2C9191919128912%2C91919191912%2C920291912%2C9191919191912%2C9221892214%2C92014%=m&ms=au&cpn=dxlJMMz5hJkR\U ARd&ptk=Radaantv&oid=bGpsJKyLNbnXo\U 1YohiEiw&ptchn=RadaanMedia&pltype=content
2013-02-13 11:08:20.904网络视图[593:c07][MPAVController]自动播放:启用自动播放
2013-02-13 11:08:20.908 webview[593:c07][MPCloudAssetDownloadController]请求对媒体项ID:0进行优先级排序
2013-02-13 11:08:23.974网络视图[593:8817]错误'!obj'正在尝试获取默认输入设备的采样率
2013-02-13 11:08:23.974 webview[593:8817]获取音频输入设备采样率时出错:'!obj'
2013-02-13 11:08:23.975网络视图[593:8817]AQMEIOManager::FindIOUnit:错误'NoHW'
2013-02-13 11:08:23.975网络视图[593:c07]AQMEIOManager::FindIOUnit:错误'NoHW'
2013-02-13 11:08:24.567网络视图[593:c07]AQMEIOManager::FindIOUnit:错误'NoHW'
2013-02-13 11:08:24.567网络视图[593:c07]AQMEIOManager::FindIOUnit:错误'NoHW'
2013-02-13 11:08:24.569网络视图[593:c07]AQMEIOManager::FindIOUnit:错误'NoHW'

只需在下面的代码中传递youtube视频的videoId即可播放youtube视频

例如,如果链接是

In.m:

- (void)viewDidLoad
{
    [super viewDidLoad];

    _webView=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 1024, 768)];

    [self.view addSubview:self.webView];

    self.webView.delegate = self;


    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.youtube.com/"]]]];

}

从本例中,您正在加载youtube.com而不是视频。您的代码对我有效…@JohnRiselvato好的,我需要什么代码来加载视频???@Sudha ya加载youtube可以正常工作,但在加载videovideoId时崩溃。Id是NSString,您可以从youtube url获取视频Id来播放视频。例如,EDTTqtO-y2I是VideoIDIA,完成但不起作用再次崩溃..检查codeya man中的
新错误
!我只是在我的代码中粘贴了你的代码…你检查问题部分你给我的代码
[webView loadHTMLString:htmlToLoad baseURL:nil]我认为这是为任何特定的视频…它设置帧。。。
@property (nonatomic, retain) UIWebView *webView;
- (void)viewDidLoad
{
    [super viewDidLoad];

    _webView=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 1024, 768)];

    [self.view addSubview:self.webView];

    self.webView.delegate = self;


    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.youtube.com/"]]]];

}