scheme to open a youtube playlist on a iOS device

2019-07-29 11:30发布

问题:

I want to know a scheme to open a Youtube playlist.

I have this code:

if ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString      stringWithFormat:@"youtube://playlist?list=PLgrYntDWyYDdHwZney5QoTDFQrphRmYoK"]]]//https://twitter.com/cms24es
    ) {

}else if ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://twitter.com/TmrrrsApp"]]]//https://twitter.com/cms24es
          ) {

}

I know a scheme to open a video, if I use youtube://, but to open a playlist instead I don't know how.

回答1:

Well I guess youtube doesn't understand browser URL of playlist like this -

http://www.youtube.com/playlist?list=PLgrYntDWyYDdHwZney5QoTDFQrphRmYoK

Alternatively, go to your video->playlist -

Right click on the playlist and select "copy link address"

It provides a link something like this -

http://www.youtube.com/watch?v=ILwOQV32rHg&list=FLLpWow4PGIVkCJifJxrMfwA

Use this as a URI to play in native youtube app.

youtube://www.youtube.com/watch?v=ILwOQV32rHg&list=FLLpWow4PGIVkCJifJxrMfwA