Search in sources :

Example 1 with PlaylistStatus

use of com.google.api.services.youtube.model.PlaylistStatus in project opencast by opencast.

the class YouTubeAPIVersion3ServiceImpl method createPlaylist.

@Override
public Playlist createPlaylist(final String title, final String description, final String... tags) throws IOException {
    final PlaylistSnippet playlistSnippet = new PlaylistSnippet();
    playlistSnippet.setTitle(title);
    playlistSnippet.setDescription(description);
    if (tags.length > 0) {
        playlistSnippet.setTags(Collections.list(tags));
    }
    // Playlists are always public. The videos therein might be private.
    final PlaylistStatus playlistStatus = new PlaylistStatus();
    playlistStatus.setPrivacyStatus("public");
    // Create playlist with metadata and status.
    final Playlist youTubePlaylist = new Playlist();
    youTubePlaylist.setSnippet(playlistSnippet);
    youTubePlaylist.setStatus(playlistStatus);
    // The first argument tells the API what to return when a successful insert has been executed.
    final YouTube.Playlists.Insert command = youTube.playlists().insert("snippet,status", youTubePlaylist);
    return execute(command);
}
Also used : Playlist(com.google.api.services.youtube.model.Playlist) PlaylistStatus(com.google.api.services.youtube.model.PlaylistStatus) PlaylistSnippet(com.google.api.services.youtube.model.PlaylistSnippet)

Aggregations

Playlist (com.google.api.services.youtube.model.Playlist)1 PlaylistSnippet (com.google.api.services.youtube.model.PlaylistSnippet)1 PlaylistStatus (com.google.api.services.youtube.model.PlaylistStatus)1