com.google.api.services.youtube.model.LiveBroadcastListResponse

Here are the examples of the java api class com.google.api.services.youtube.model.LiveBroadcastListResponse taken from open source projects.

1. YouTubeApi#getLiveEvents()

Project: yt-watchme
Source File: YouTubeApi.java
View license
// TODO: Catch those exceptions and handle them here.
public static List<EventData> getLiveEvents(YouTube youtube) throws IOException {
    Log.i(MainActivity.APP_NAME, "Requesting live events.");
    YouTube.LiveBroadcasts.List liveBroadcastRequest = youtube.liveBroadcasts().list("id,snippet,contentDetails");
    // liveBroadcastRequest.setMine(true);
    liveBroadcastRequest.setBroadcastStatus("upcoming");
    // List request is executed and list of broadcasts are returned
    LiveBroadcastListResponse returnedListResponse = liveBroadcastRequest.execute();
    // Get the list of broadcasts associated with the user.
    List<LiveBroadcast> returnedList = returnedListResponse.getItems();
    List<EventData> resultList = new ArrayList<EventData>(returnedList.size());
    EventData event;
    for (LiveBroadcast broadcast : returnedList) {
        event = new EventData();
        event.setEvent(broadcast);
        String streamId = broadcast.getContentDetails().getBoundStreamId();
        if (streamId != null) {
            String ingestionAddress = getIngestionAddress(youtube, streamId);
            event.setIngestionAddress(ingestionAddress);
        }
        resultList.add(event);
    }
    return resultList;
}