The actual video link in GData

244 views
Skip to first unread message

sammy

unread,
Sep 2, 2009, 12:22:50 AM9/2/09
to Google Data APIs Objective-C Client Library Discussion
Hi guys; am new to this group and the first think I want to do is
thank those who made this library available so thanks.

I have 1 question and it is very simple. I have looked at the examples
and at the YouTube application provided and have picked up lots from
it. However, I spent few hours already trying to find a way to get at
the actual video link in either GDataEntryYouTubeVideo or
GDataEntryBase but without any luck. It must be a simple thing to find
and do yet it hasn't been for me. I want to access the one property
that I can have so that when a user clicks on the video image I can
open it up in the YouTube player (example in the iPhone).

Any help would be great.

Greg Robbins

unread,
Sep 2, 2009, 1:08:25 AM9/2/09
to gdata-objec...@googlegroups.com
A video entry's media:content elements contain the URLs for the playable video. The yt:format attribute indicates the kind of video for each media:content.

For example, here's a snippet to print out the URLs for all videos in Flash format (yt:format=5) in a feed:

  for (GDataEntryYouTubeVideo *videoEntry in [videoFeed entries]) {
    GDataYouTubeMediaGroup *mediaGroup = [videoEntry mediaGroup];
    NSArray *mediaContents = [mediaGroup mediaContents];
    NSNumber *flashFormatNum = [NSNumber numberWithInt:5];
    GDataMediaContent *flashContent;
   
    flashContent = [GDataUtilities firstObjectFromArray:mediaContents
                                              withValue:flashFormatNum
                                             forKeyPath:@"youTubeFormatNumber"];
    if (flashContent != nil) {
      NSLog(@"%@", [flashContent URLString]);
    }
  }

Also take a look at this blog post on playing videos on the iPhone:

http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html

sammy

unread,
Sep 2, 2009, 2:41:02 AM9/2/09
to Google Data APIs Objective-C Client Library Discussion
Hi Greg;

Thanks a lot for your post back to my question. I am pretty ok on the
iPhone end, i just struggled a bit with the google api. Your post
helped and it was all that I needed to get things moving. Thanks
again.
> http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-ap...
Reply all
Reply to author
Forward
0 new messages