Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS open YouTube App with query (url schemes)

Is there an URL Scheme to open the YouTube iOS app with a specified search query?

I tried:

NSString *stringURL = @"http://www.youtube.com/results?search_query=foo";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

But this will open Safari instead of the YouTube Application.

like image 543
1b0t Avatar asked Sep 09 '13 09:09

1b0t


People also ask

How do I get the YouTube app to open links iOS?

When you click on any YouTube link (including youtube.com, m.youtube.com, and youtu.be), your iOS device will automatically open the link in the YouTube App. Universal Links are automatically turned on for all devices that use iOS 9 or above as the operating system.

How do I get YouTube to open links in app instead of browser iOS?

Any video will be fine. From there, press and hold on the YouTube.com link and choose 'Open in YouTube'. After that, go back to Safari and test a different link. The link should automatically route to the YouTube app from this point on.


2 Answers

You can't use this http://www.youtube.com/results?search_query=foo for opening youtube app. If you use the above url it'll open the safari instead of youtube app.

There are only three URLSchemes available for opening youtube app:

  • http://www.youtube.com/watch?v=VIDEO_IDENTIFIER
  • http://www.youtube.com/v/VIDEO_IDENTIFIER
  • youtube://

Reference: iPhoneURLScheme

like image 58
Midhun MP Avatar answered Sep 21 '22 08:09

Midhun MP


this is working fine in iOS 9

youtube://www.youtube.com/channel/<channel-id>

like image 38
Vaibhav Saran Avatar answered Sep 18 '22 08:09

Vaibhav Saran