com.google.api.services.youtube.model.PlaylistItem Java Examples

The following examples show how to use com.google.api.services.youtube.model.PlaylistItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: YouTubeAPI.java    From UTubeTV with The Unlicense 6 votes vote down vote up
private List<YouTubeData> itemsToMap(List<PlaylistItem> playlistItemList) {
  // check parameters
  if (playlistItemList == null)
    return null;

  List<YouTubeData> result = new ArrayList<YouTubeData>();

  // convert the list into hash maps of video info
  for (PlaylistItem playlistItem : playlistItemList) {
    YouTubeData map = new YouTubeData();

    map.mVideo = playlistItem.getContentDetails().getVideoId();

    result.add(map);
  }

  return result;
}
 
Example #2
Source File: GetPlaylistVideos.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<CardData> getNextVideos() {
	setLastException(null);
	List<CardData> videoList = new ArrayList<>();

	if (!noMoreVideoPages()) {
		try {
			playlistItemsList.setPageToken(nextPageToken);

			PlaylistItemListResponse response = playlistItemsList.execute();

			List<String> videoIds = new ArrayList<>();

			List<PlaylistItem> items = response.getItems();
			if(items != null) {
				for(PlaylistItem item : items) {
					videoIds.add(item.getContentDetails().getVideoId());
				}
			}

			// get video details by supplying the videos IDs
			videoList = getVideoListFromIds(videoIds);

			nextPageToken = response.getNextPageToken();

			if(nextPageToken == null)
				noMoreVideoPages = true;
		} catch (IOException e) {
			setLastException(e);
			Logger.e(this, "Error has occurred while getting playlist's videos", e);
		}
	}

	return videoList;
}