0

Can anyone please guide how to access the videos from youtube and play it in iphone. Since i am new to iphone development a better tutorial is mostly appreciated.,

Thanks in Advance.

Adhees
  • 13
  • 1
  • 2
  • 6

2 Answers2

0

Google provides youtube API for the same purpose

Please go through he link to get to know more how the API can be used http://code.google.com/apis/youtube/overview.html

Any examples/tutorials on using Google GData API - Youtube on iphone?

Community
  • 1
  • 1
Hanuman
  • 642
  • 5
  • 19
0

This GData sample Code might help you to get data from GData API for fetching info regarding Youtube videos. I use to play videos in UIWebView with help of the following Code

- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
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, urlString, frame.size.width, frame.size.height];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];
[videoView release];}

Call this function

[self embedYouTube:self.youTubeLink frame:CGRectMake(0, 0, 320, 370)];

where self.youTubeLink will contain a stringURL to load the YouTube video.

sandy
  • 2,127
  • 4
  • 28
  • 50