On my app I need a button, so when it's tapped a youtube video is launched.
So how can I achieve this?
The iOS device has URL schemes that it recognize. Build your youTube url like the following:
http://www.youtube.com/watch?v=VIDEO_IDENTIFIER
That will launch the youTube player on the device.
NSString *videoName = @"1JynBEX_kg8";
NSString *string = [NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@", videoName];
NSURL *url = [NSURL URLWithString:string];
UIApplication *app = [UIApplication sharedApplication];
[app openURL:url];
For more information on iOS URL Scheme Apple URL Scheme Reference.
You could try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.youtube.com"]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With