Aliaksandr B.
Aliaksandr B.

Reputation: 146

How to get a link of the video I uploaded to YouTube

My code can upload the video to YouTube successfully, I want to get the embed link of the uploaded video, and put this link to another website, so that I can see the video from that website.

How can I get that link?

I use code below to upload the video, but I can not see any useful information from the returned ticket.

GDataServiceTicket *ticket;
ticket = [service fetchEntryByInsertingEntry:entry
                                  forFeedURL:url
                                    delegate:self 
                           didFinishSelector:@selector(uploadTicket:finishedWithEntry:error];

Is there anyone can help me out here?

Thanks a lot

Upvotes: 3

Views: 1129

Answers (1)

picciano
picciano

Reputation: 22701

You should be able to get the url from the entry object in your callback handler.

- (void)uploadTicket:(GDataServiceTicket *)ticket
   finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
               error:(NSError *)error {
  if (error == nil) {
    NSString *url = [[[[video mediaGroup] mediaContents] objectAtIndex:0] URLString];
  }
}

Upvotes: 6

Related Questions