In iOS, how to open a YouTube user or channel (not video) in the native app?

3.9k views Asked by At

I know how to open the YouTube native app for a particular video with these url strings:

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

Source

But how to open the YouTube app with a particular user's page? An equivalent web browser url looks like this: https://www.youtube.com/user/someUser

Using the this url opens the Youtube mobile web app in Safari. But I'd like it to open in the native YouTube app.

3

There are 3 answers

0
bendigi On BEST ANSWER

I use the custom url schema defined as follows: youtube://user/[username]. I didn't find documentation for this but discovered it by means of experimentation. Here is a also a cool way to test if the native App is installed.

NSString* social   = @"http://www.youtube.com/user/CanadianMortgageApp";
NSString* socialApp = @"youtube://user/CanadianMortgageApp";

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:socialApp]]) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:socialApp]];
} else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:social]];
}
0
Kristofor Carle On

Using the custom URL for the channel worked for me:

 NSURL *youTubeURL = [NSURL URLWithString:@"youtube://www.youtube.com/c/yourcustomurl"];
        if ([[UIApplication sharedApplication] canOpenURL:youTubeURL]) {
            [[UIApplication sharedApplication] openURL:youTubeURL];
        } else {
            NSURL *youTubeWebURL = [NSURL URLWithString:@"http://www.youtube.com/c/yourcustomurl"];
            [[UIApplication sharedApplication] openURL:youTubeWebURL];
        }
0
Jay On

Not possible at this time. (Source: extensive personal testing.)