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");
}
}
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());
}
}
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());
}
}
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());
}
}
}
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());
}
}
Aggregations