0

I am loading a video in YTPlayerView, but for loading playlist in YTPlayerView we need playlistId. I don't see this in the response

playerVars = @{
               @"autoplay" : @1
               ,@"rel" : @0
               ,@"playsinline" : @1
               ,@"showinfo" : @0
               ,@"modestbranding" : @1
               ,@"listType":@"playlist"
               ,@"autohide":@1
               };

 [[YTPlayerInstance instance] loadWithVideoId:@"jrmilwr1y6w" playerVars:playerVars];

This is OK

[[YTPlayerInstance instance] loadWithPlaylistId:playListId playerVars:playerVars];

Where is this playListId in response. How can I get this playListId?

JAL
  • 41,701
  • 23
  • 172
  • 300
Jagveer Singh
  • 2,258
  • 19
  • 34

1 Answers1

1

You can get a playlist id with the YouTube Data API: https://developers.google.com/youtube/v3/docs/

From what I understand in your example you've hardcoded the video's id. Obviously you can do the same with a playlist's id.
The best way to get IDs (and data in general) from YouTube is through the YouTube Data API.

As you can see in this example https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlists.list?part=snippet&channelId=UC-lHJZR3Gqxm24_Vd_AJ5Yw&maxResults=50&fields=items&_h=2&
i'm asking for all the playlist of a particular channel. You can find each playlist id at the field "id". For example: "id": "PLYH8WvNV1YEmuUM8tmQ2BJx3Uq9QzSivx"

Pierfrancesco Soffritti
  • 1,678
  • 1
  • 18
  • 22