Question

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.

Was it helpful?

Solution

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]];
}

OTHER TIPS

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

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];
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top