GData / YouTube 接口 (XCode/ObjectiveC) - 上传文件并获取上传的 URL 或 videoID

发布于 2024-12-22 01:15:33 字数 443 浏览 0 评论 0原文

我一直在研究 YouTubeTest 示例,以充分理解 GData / YouTube 界面以及它如何将文件上传到 YouTube。

我已经设法很容易地让它在我的设备上工作,但我希望能够在我的应用程序中做的一件事是,在上传完成后,共享我刚刚上传到 youtube 的视频的 URL。

URL 通常采用以下形式:

http://www.youtube.com/watch?v=HRzVPfFIXtY< /a>

有人能告诉我如何找出上传的 URL 或 videoID 吗,因为 videoID 似乎(我认为)是 URL 的一部分(例如HRzVPfFIXtY)。

非常感谢任何提示或示例代码。

干杯

史蒂夫

I've been working with the YouTubeTest example a bit to fully understand the GData / YouTube interface and how it uploads files to YouTube.

I've managed to get this to work on my device quite easily but one of the things I wanted to be able to do in my app was, upon completion of the upload, is share the URL of the video I just uploaded to youtube.

URL's are normally of the form :

http://www.youtube.com/watch?v=HRzVPfFIXtY

Would anyone be able to tell me how to find out what the uploaded URL would be or the videoID, as the videoID seems (I think) to be part of the URL (e.g. HRzVPfFIXtY).

Any tips or sample code greatly appreciated.

Cheers

Steve

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

源来凯始玺欢你 2024-12-29 01:15:33

当您的文件上传时,下面调用的函数

- (void)uploadTicket:(GDataServiceTicket *)ticket
   finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
               error:(NSError *)error

if (error == nil) {
        // tell the user that the add worked
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Uploaded!"
                                                        message:[NSString stringWithFormat:@"%@ succesfully uploaded", 
                                                                 [[videoEntry title] stringValue]]                    
                                                       delegate:nil 
                                              cancelButtonTitle:@"Ok" 
                                              otherButtonTitles:nil];
}

VideoEntryGDataEntryYoutubeVideo 类型,其中包含有关上传视频的所有信息。

我通过分隔字符串来获取 url。

When your file gets uploaded , function called is below

- (void)uploadTicket:(GDataServiceTicket *)ticket
   finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
               error:(NSError *)error

if (error == nil) {
        // tell the user that the add worked
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Uploaded!"
                                                        message:[NSString stringWithFormat:@"%@ succesfully uploaded", 
                                                                 [[videoEntry title] stringValue]]                    
                                                       delegate:nil 
                                              cancelButtonTitle:@"Ok" 
                                              otherButtonTitles:nil];
}

here VideoEntry is GDataEntryYoutubeVideo type which contains all information about the uploaded video.

I get the url by separating the string.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文