如何在iphone中的特定时间戳启动嵌入式YouTube视频

Avi*_*ash 3 youtube iphone video video-streaming ipad

我想从时间戳开始一个嵌入式YouTube视频.我知道如何在浏览器上执行此操作,但这似乎不适用于iPhone.这是MATT CUTTS的详细教程.

在特定时间戳启动嵌入式视频

在上面的链接中你可以看到我们是否在url中附加了#t = 31m08s或&start = 200但是当我在UiWebView中使用相同的url时,默认的youtube播放器从第一帧开始播放视频.任何人都可以有想法或已实现相同.我正在使用带有嵌入标签的UIWebView来播放YouTube视频.我在UIWebView中使用下面的embed标签.

 <embed id="yt" src="http://www.youtube.com/watch?v=dsFQ9kM1qDs" type="application/x-shockwave-flash" width= "500" height="400"></embed>
Run Code Online (Sandbox Code Playgroud)

下面是我用来在UIWebView中播放此视频的代码

- (IBAction) playYoutube {
    [self embedYouTube:@"http://www.youtube.com/watch?v=dsFQ9kM1qDs#t=2m08s"];
}

- (void)embedYouTube:(NSString*)url
{  
    [webView setFrame:CGRectMake(0, 0, 480, 320)];
    NSString* embedHTML = @"\
    <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=\"%0.0f\" height=\"%0.0f\"></embed>"
    "   </body></html>";  

    NSString* html = [NSString stringWithFormat:embedHTML, url, webView.frame.size.width,  webView.frame.size.height]; 
    [webView loadHTMLString:html baseURL:nil];  
}  
Run Code Online (Sandbox Code Playgroud)

Yah*_*hia 5

根据Youtube API团队的说法,iPhone/iPad等无法做到这一点 - 请参阅https://groups.google.com/group/youtube-api-gdata/browse_thread/thread/ef4f434347622448/0f65f465d671d74c