use of com.google.api.services.youtube.model.PlaylistItemSnippet in project opencast by opencast.
the class YouTubeAPIVersion3ServiceImpl method addPlaylistItem.
@Override
public PlaylistItem addPlaylistItem(final String playlistId, final String videoId) throws IOException {
// Resource type (video,playlist,channel) needs to be set along with resource id.
final ResourceId resourceId = new ResourceId();
resourceId.setKind("youtube#video");
resourceId.setVideoId(videoId);
// Set the required snippet properties.
final PlaylistItemSnippet playlistItemSnippet = new PlaylistItemSnippet();
playlistItemSnippet.setTitle("First video in the test playlist");
playlistItemSnippet.setPlaylistId(playlistId);
playlistItemSnippet.setResourceId(resourceId);
// Create the playlist item.
final PlaylistItem playlistItem = new PlaylistItem();
playlistItem.setSnippet(playlistItemSnippet);
// The first argument tells the API what to return when a successful insert has been executed.
final YouTube.PlaylistItems.Insert playlistItemsInsertCommand = youTube.playlistItems().insert("snippet,contentDetails", playlistItem);
return execute(playlistItemsInsertCommand);
}
Aggregations