Search in sources :

Example 6 with LivestreamServiceClient

use of com.google.cloud.video.livestream.v1.LivestreamServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class DeleteChannelEvent method deleteChannelEvent.

public static void deleteChannelEvent(String projectId, String location, String channelId, String eventId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
        var deleteEventRequest = DeleteEventRequest.newBuilder().setName(EventName.of(projectId, location, channelId, eventId).toString()).build();
        livestreamServiceClient.deleteEvent(deleteEventRequest);
        System.out.println("Deleted channel event");
    }
}
Also used : LivestreamServiceClient(com.google.cloud.video.livestream.v1.LivestreamServiceClient)

Example 7 with LivestreamServiceClient

use of com.google.cloud.video.livestream.v1.LivestreamServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class GetChannelEvent method getChannelEvent.

public static void getChannelEvent(String projectId, String location, String channelId, String eventId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
        EventName name = EventName.of(projectId, location, channelId, eventId);
        Event response = livestreamServiceClient.getEvent(name);
        System.out.println("Channel event: " + response.getName());
    }
}
Also used : Event(com.google.cloud.video.livestream.v1.Event) EventName(com.google.cloud.video.livestream.v1.EventName) LivestreamServiceClient(com.google.cloud.video.livestream.v1.LivestreamServiceClient)

Example 8 with LivestreamServiceClient

use of com.google.cloud.video.livestream.v1.LivestreamServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class GetInput method getInput.

public static void getInput(String projectId, String location, String inputId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
        InputName name = InputName.of(projectId, location, inputId);
        Input response = livestreamServiceClient.getInput(name);
        System.out.println("Input: " + response.getName());
    }
}
Also used : Input(com.google.cloud.video.livestream.v1.Input) InputName(com.google.cloud.video.livestream.v1.InputName) LivestreamServiceClient(com.google.cloud.video.livestream.v1.LivestreamServiceClient)

Example 9 with LivestreamServiceClient

use of com.google.cloud.video.livestream.v1.LivestreamServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class ListChannelEvents method listChannelEvents.

public static void listChannelEvents(String projectId, String location, String channelId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
        var listEventsRequest = ListEventsRequest.newBuilder().setParent(ChannelName.of(projectId, location, channelId).toString()).build();
        LivestreamServiceClient.ListEventsPagedResponse response = livestreamServiceClient.listEvents(listEventsRequest);
        System.out.println("Channel events:");
        for (Event event : response.iterateAll()) {
            System.out.println(event.getName());
        }
    }
}
Also used : Event(com.google.cloud.video.livestream.v1.Event) LivestreamServiceClient(com.google.cloud.video.livestream.v1.LivestreamServiceClient)

Example 10 with LivestreamServiceClient

use of com.google.cloud.video.livestream.v1.LivestreamServiceClient in project java-docs-samples by GoogleCloudPlatform.

the class CreateChannelEvent method createChannelEvent.

public static void createChannelEvent(String projectId, String location, String channelId, String eventId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
        var createEventRequest = CreateEventRequest.newBuilder().setParent(ChannelName.of(projectId, location, channelId).toString()).setEventId(eventId).setEvent(Event.newBuilder().setAdBreak(AdBreakTask.newBuilder().setDuration(Duration.newBuilder().setSeconds(30).build()).build()).setExecuteNow(true).build()).build();
        Event response = livestreamServiceClient.createEvent(createEventRequest);
        System.out.println("Channel event: " + response.getName());
    }
}
Also used : Event(com.google.cloud.video.livestream.v1.Event) LivestreamServiceClient(com.google.cloud.video.livestream.v1.LivestreamServiceClient)

Aggregations

LivestreamServiceClient (com.google.cloud.video.livestream.v1.LivestreamServiceClient)19 Channel (com.google.cloud.video.livestream.v1.Channel)6 Input (com.google.cloud.video.livestream.v1.Input)5 Event (com.google.cloud.video.livestream.v1.Event)4 ChannelName (com.google.cloud.video.livestream.v1.ChannelName)3 NotFoundException (com.google.api.gax.rpc.NotFoundException)2 AudioStream (com.google.cloud.video.livestream.v1.AudioStream)2 VideoStream (com.google.cloud.video.livestream.v1.VideoStream)2 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 EventName (com.google.cloud.video.livestream.v1.EventName)1 InputName (com.google.cloud.video.livestream.v1.InputName)1