Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.stitcher;

// [START video_stitcher_create_vod_session]

import com.google.cloud.video.stitcher.v1.CreateVodSessionRequest;
import com.google.cloud.video.stitcher.v1.LocationName;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodSession;
import java.io.IOException;

public class CreateVodSession {

public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "my-project-id";
String location = "us-central1";
// Uri of the media to stitch; this URI must reference either an MPEG-DASH
// manifest (.mpd) file or an M3U playlist manifest (.m3u8) file.
String sourceUri = "https://storage.googleapis.com/my-bucket/main.mpd";
// See VMAP Pre-roll
// (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags)
String adTagUri = "https://pubads.g.doubleclick.net/gampad/ads...";
createVodSession(projectId, location, sourceUri, adTagUri);
}

public static void createVodSession(
String projectId, String location, String sourceUri, String adTagUri) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (VideoStitcherServiceClient videoStitcherServiceClient =
VideoStitcherServiceClient.create()) {
CreateVodSessionRequest createVodSessionRequest =
CreateVodSessionRequest.newBuilder()
.setParent(LocationName.of(projectId, location).toString())
.setVodSession(
VodSession.newBuilder().setSourceUri(sourceUri).setAdTagUri(adTagUri).build())
.build();

VodSession response = videoStitcherServiceClient.createVodSession(createVodSessionRequest);
System.out.println("Created VOD session: " + response.getName());
}
}
}
// [END video_stitcher_create_vod_session]
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.stitcher;

// [START video_stitcher_get_vod_ad_tag_detail]

import com.google.cloud.video.stitcher.v1.GetVodAdTagDetailRequest;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodAdTagDetail;
import com.google.cloud.video.stitcher.v1.VodAdTagDetailName;
import java.io.IOException;

public class GetVodAdTagDetail {

public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "my-project-id";
String location = "us-central1";
String sessionId = "my-session-id";
String adTagDetailId = "my-ad-tag-id";

getVodAdTagDetail(projectId, location, sessionId, adTagDetailId);
}

public static void getVodAdTagDetail(
String projectId, String location, String sessionId, String adTagDetailId)
throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (VideoStitcherServiceClient videoStitcherServiceClient =
VideoStitcherServiceClient.create()) {
GetVodAdTagDetailRequest getVodAdTagDetailRequest =
GetVodAdTagDetailRequest.newBuilder()
.setName(
VodAdTagDetailName.of(projectId, location, sessionId, adTagDetailId).toString())
.build();

VodAdTagDetail response =
videoStitcherServiceClient.getVodAdTagDetail(getVodAdTagDetailRequest);
System.out.println("VOD ad tag detail: " + response.getName());
}
}
}
// [END video_stitcher_get_vod_ad_tag_detail]
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.stitcher;

// [START video_stitcher_get_vod_session]

import com.google.cloud.video.stitcher.v1.GetVodSessionRequest;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodSession;
import com.google.cloud.video.stitcher.v1.VodSessionName;
import java.io.IOException;

public class GetVodSession {

public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "my-project-id";
String location = "us-central1";
String sessionId = "my-session-id";

getVodSession(projectId, location, sessionId);
}

public static void getVodSession(String projectId, String location, String sessionId)
throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (VideoStitcherServiceClient videoStitcherServiceClient =
VideoStitcherServiceClient.create()) {
GetVodSessionRequest getVodSessionRequest =
GetVodSessionRequest.newBuilder()
.setName(VodSessionName.of(projectId, location, sessionId).toString())
.build();

VodSession response = videoStitcherServiceClient.getVodSession(getVodSessionRequest);
System.out.println("VOD session: " + response.getName());
}
}
}
// [END video_stitcher_get_vod_session]
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.stitcher;

// [START video_stitcher_get_vod_stitch_detail]

import com.google.cloud.video.stitcher.v1.GetVodStitchDetailRequest;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodStitchDetail;
import com.google.cloud.video.stitcher.v1.VodStitchDetailName;
import java.io.IOException;

public class GetVodStitchDetail {

public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "my-project-id";
String location = "us-central1";
String sessionId = "my-session-id";
String stitchDetailId = "my-stitch-id";

getVodStitchDetail(projectId, location, sessionId, stitchDetailId);
}

public static void getVodStitchDetail(
String projectId, String location, String sessionId, String stitchDetailId)
throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (VideoStitcherServiceClient videoStitcherServiceClient =
VideoStitcherServiceClient.create()) {
GetVodStitchDetailRequest getVodStitchDetailRequest =
GetVodStitchDetailRequest.newBuilder()
.setName(
VodStitchDetailName.of(projectId, location, sessionId, stitchDetailId).toString())
.build();

VodStitchDetail response =
videoStitcherServiceClient.getVodStitchDetail(getVodStitchDetailRequest);
System.out.println("VOD stitch detail: " + response.getName());
}
}
}
// [END video_stitcher_get_vod_stitch_detail]
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.stitcher;

// [START video_stitcher_list_vod_ad_tag_details]

import com.google.cloud.video.stitcher.v1.ListVodAdTagDetailsRequest;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodAdTagDetail;
import com.google.cloud.video.stitcher.v1.VodSessionName;
import java.io.IOException;

public class ListVodAdTagDetails {

public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "my-project-id";
String location = "us-central1";
String sessionId = "my-session-id";

listVodAdTagDetails(projectId, location, sessionId);
}

public static void listVodAdTagDetails(String projectId, String location, String sessionId)
throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (VideoStitcherServiceClient videoStitcherServiceClient =
VideoStitcherServiceClient.create()) {
ListVodAdTagDetailsRequest listVodAdTagDetailsRequest =
ListVodAdTagDetailsRequest.newBuilder()
.setParent(VodSessionName.of(projectId, location, sessionId).toString())
.build();

VideoStitcherServiceClient.ListVodAdTagDetailsPagedResponse response =
videoStitcherServiceClient.listVodAdTagDetails(listVodAdTagDetailsRequest);
System.out.println("VOD ad tag details:");

for (VodAdTagDetail adTagDetail : response.iterateAll()) {
System.out.println(adTagDetail.toString());
}
}
}
}
// [END video_stitcher_list_vod_ad_tag_details]
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.stitcher;

// [START video_stitcher_list_vod_stitch_details]

import com.google.cloud.video.stitcher.v1.ListVodStitchDetailsRequest;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodSessionName;
import com.google.cloud.video.stitcher.v1.VodStitchDetail;
import java.io.IOException;

public class ListVodStitchDetails {

public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "my-project-id";
String location = "us-central1";
String sessionId = "my-session-id";

listVodStitchDetails(projectId, location, sessionId);
}

public static void listVodStitchDetails(String projectId, String location, String sessionId)
throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
try (VideoStitcherServiceClient videoStitcherServiceClient =
VideoStitcherServiceClient.create()) {
ListVodStitchDetailsRequest listVodStitchDetailsRequest =
ListVodStitchDetailsRequest.newBuilder()
.setParent(VodSessionName.of(projectId, location, sessionId).toString())
.build();

VideoStitcherServiceClient.ListVodStitchDetailsPagedResponse response =
videoStitcherServiceClient.listVodStitchDetails(listVodStitchDetailsRequest);
System.out.println("VOD stitch details:");

for (VodStitchDetail stitchDetail : response.iterateAll()) {
System.out.println(stitchDetail.toString());
}
}
}
}
// [END video_stitcher_list_vod_stitch_details]
Loading