diff --git a/.env-example b/.env-example index 88bab12..58b823d 100644 --- a/.env-example +++ b/.env-example @@ -144,11 +144,19 @@ VERIFY_TEMPLATE_NAME="verify" VERIFY_TEMPLATE_ID="bcdef09-8765-4321-8cde-0123456789ab" VERIFY_TEMPLATE_FRAGMENT_ID="aaaaaaaa-bbbb-4ccc-8ddd-0123456789ab" +# Video +VIDEO_SESSION_ID="flR1ZSBPY3QgMjkgMTI6MTM6MjMgUERUIDIwMTN" +VIDEO_TOKEN="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhcHBsaWNhdGlvbl9pZCI6ImFhYWFhYWFhLWJiYmItNGNjYy04ZGRkLTAxMjM0NTY3ODlhYiJ9.o3U506EejsS8D5Tob90FG1NC1cR69fh3pFOpxnyTHVFfgqI6NWuuN8lEwrS3Zb8bGxE_A9LyyUZ2y4uqLpyXRw" +VIDEO_CONNECTION_ID="bcdef09-8765-4321-8cde-0123456789ab" +VIDEO_STREAM_ID="bcdef09-8765-4321-8cde-0123456789ab" +VIDEO_ARCHIVE_ID="aaaaaaaa-bbbb-4ccc-8ddd-0123456789ab" +VIDEO_BROADCAST_ID="aaaaaaaa-bbbb-4ccc-8ddd-0123456789ab" + # Voice VOICE_CALL_ID="aaaaaaaa-bbbb-4ccc-8ddd-0123456789ab" VOICE_TO_NUMBER="447700900000" VOICE_TEXT="Hello from Vonage! Would you like to learn more?" -VOICE_LANGUAGE="en-US" +VOICE_LANGUAGE="AMERICAN_ENGLISH" VOICE_DTMF_DIGITS="2468#" VOICE_CONFERENCE_NAME="My conference call room" VOICE_NCCO_URL="https://nexmo-community.github.io/ncco-examples/talk.json" diff --git a/src/main/java/com/vonage/quickstart/EnvironmentVariables.java b/src/main/java/com/vonage/quickstart/EnvironmentVariables.java index 9ff0910..3b98a7c 100644 --- a/src/main/java/com/vonage/quickstart/EnvironmentVariables.java +++ b/src/main/java/com/vonage/quickstart/EnvironmentVariables.java @@ -150,6 +150,12 @@ public static String envVar(String key) { VERIFY_FROM_EMAIL = envVar("VERIFY_FROM_EMAIL"), VERIFY_WHATSAPP_NUMBER = envVar("VERIFY_WHATSAPP_NUMBER"), VERIFY_TEMPLATE_NAME = envVar("VERIFY_TEMPLATE_NAME"), + VIDEO_STREAM_ID = envVar("VIDEO_STREAM_ID"), + VIDEO_ARCHIVE_ID = envVar("VIDEO_ARCHIVE_ID"), + VIDEO_BROADCAST_ID = envVar("VIDEO_BROADCAST_ID"), + VIDEO_CONNECTION_ID = envVar("VIDEO_CONNECTION_ID"), + VIDEO_SESSION_ID = envVar("VIDEO_SESSION_ID"), + VIDEO_TOKEN = envVar("VIDEO_TOKEN"), VOICE_CALL_ID = envVar("VOICE_CALL_ID"), VOICE_TO_NUMBER = envVar("VOICE_TO_NUMBER"), VOICE_TEXT = envVar("VOICE_TEXT"), @@ -189,10 +195,10 @@ public static String envVar(String key) { public static final Type NUMBER_TYPE = Type.fromString(envVar("NUMBER_TYPE")); - public static final Feature[] + public static final com.vonage.client.numbers.Feature[] NUMBER_FEATURES = Arrays.stream(envVar("NUMBER_FEATURES").split(",")) - .map(Feature::fromString) - .toArray(Feature[]::new); + .map(com.vonage.client.numbers.Feature::fromString) + .toArray(com.vonage.client.numbers.Feature[]::new); public static final SearchPattern NUMBER_SEARCH_PATTERN = SearchPattern.values()[Integer.parseInt(envVar("NUMBER_SEARCH_PATTERN"))]; diff --git a/src/main/java/com/vonage/quickstart/video/AddArchiveStream.java b/src/main/java/com/vonage/quickstart/video/AddArchiveStream.java new file mode 100644 index 0000000..3a244fc --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/AddArchiveStream.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class AddArchiveStream { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.addArchiveStream(VIDEO_ARCHIVE_ID, VIDEO_STREAM_ID); + + System.out.println("Added archive stream"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/AddBroadcastStream.java b/src/main/java/com/vonage/quickstart/video/AddBroadcastStream.java new file mode 100644 index 0000000..24ba890 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/AddBroadcastStream.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class AddBroadcastStream { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.addBroadcastStream(VIDEO_BROADCAST_ID, VIDEO_STREAM_ID); + + System.out.println("Added broadcast stream"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/CreateArchive.java b/src/main/java/com/vonage/quickstart/video/CreateArchive.java new file mode 100644 index 0000000..7217a73 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/CreateArchive.java @@ -0,0 +1,42 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class CreateArchive { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + Archive archive = videoClient.createArchive( + Archive.builder(VIDEO_SESSION_ID) + .streamMode(StreamMode.AUTO) + .hasVideo(true) + .hasAudio(true) + .resolution(Resolution.HD_LANDSCAPE) + .outputMode(OutputMode.COMPOSED).name("My recording") + .build() + ); + + System.out.println("Started archive: " + archive.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/CreateBroadcast.java b/src/main/java/com/vonage/quickstart/video/CreateBroadcast.java new file mode 100644 index 0000000..35fb80f --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/CreateBroadcast.java @@ -0,0 +1,42 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; +import java.time.Duration; + +public class CreateBroadcast { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + Broadcast broadcast = videoClient.createBroadcast( + Broadcast.builder(VIDEO_SESSION_ID) + .hls(Hls.builder().lowLatency(true).build()) + .resolution(Resolution.HD_LANDSCAPE) + .streamMode(StreamMode.AUTO) + .maxDuration(Duration.ofMinutes(45)) + .build() + ); + + System.out.println("Started broadcast: " + broadcast.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/CreateSession.java b/src/main/java/com/vonage/quickstart/video/CreateSession.java new file mode 100644 index 0000000..0684a81 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/CreateSession.java @@ -0,0 +1,39 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class CreateSession { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + CreateSessionResponse session = videoClient.createSession( + CreateSessionRequest.builder() + .mediaMode(MediaMode.ROUTED) + .archiveMode(ArchiveMode.MANUAL) + .build() + ); + + System.out.println("Created session: " + session.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/DeleteArchive.java b/src/main/java/com/vonage/quickstart/video/DeleteArchive.java new file mode 100644 index 0000000..8343f64 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/DeleteArchive.java @@ -0,0 +1,19 @@ +package com.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class DeleteArchive { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.deleteArchive(VIDEO_ARCHIVE_ID); + + System.out.println("Deleted archive"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/ForceDisconnect.java b/src/main/java/com/vonage/quickstart/video/ForceDisconnect.java new file mode 100644 index 0000000..a9ddd97 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/ForceDisconnect.java @@ -0,0 +1,19 @@ +package com.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class ForceDisconnect { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.forceDisconnect(VIDEO_SESSION_ID, VIDEO_CONNECTION_ID); + + System.out.println("Force disconnected"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/ForceMute.java b/src/main/java/com/vonage/quickstart/video/ForceMute.java new file mode 100644 index 0000000..77d10d0 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/ForceMute.java @@ -0,0 +1,19 @@ +package com.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class ForceMute { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.muteStream(VIDEO_SESSION_ID, VIDEO_STREAM_ID); + + System.out.println("Force muted"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/GenerateToken.java b/src/main/java/com/vonage/quickstart/video/GenerateToken.java new file mode 100644 index 0000000..c0b5d84 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/GenerateToken.java @@ -0,0 +1,27 @@ +package com.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +import java.time.Duration; + +public class GenerateToken { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + TokenOptions tokenOptions = TokenOptions.builder() + .role(Role.MODERATOR) + .expiryLength(Duration.ofHours(6)) + .data("name=John,id=123") + .build(); + + String jwt = videoClient.generateToken(VIDEO_SESSION_ID, tokenOptions); + + System.out.println("Generated token: " + jwt); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/GetArchive.java b/src/main/java/com/vonage/quickstart/video/GetArchive.java new file mode 100644 index 0000000..662fbe7 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/GetArchive.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class GetArchive { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + Archive archive = videoClient.getArchive(VIDEO_ARCHIVE_ID); + + System.out.println("Retrieved archive: " + archive.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/GetBroadcast.java b/src/main/java/com/vonage/quickstart/video/GetBroadcast.java new file mode 100644 index 0000000..e5a1754 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/GetBroadcast.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class GetBroadcast { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + Broadcast broadcast = videoClient.getBroadcast(VIDEO_BROADCAST_ID); + + System.out.println("Retrieved broadcast: " + broadcast.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/GetStream.java b/src/main/java/com/vonage/quickstart/video/GetStream.java new file mode 100644 index 0000000..bb706a3 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/GetStream.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class GetStream { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + GetStreamResponse stream = videoClient.getStream(VIDEO_SESSION_ID, VIDEO_STREAM_ID); + + System.out.println("Retrieved stream: " + stream.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/ListArchives.java b/src/main/java/com/vonage/quickstart/video/ListArchives.java new file mode 100644 index 0000000..1954ef2 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/ListArchives.java @@ -0,0 +1,35 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; +import java.util.List; + +public class ListArchives { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + List archives = videoClient.listArchives(); + + System.out.println("Retrieved list of archives: " + archives); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/ListBroadcasts.java b/src/main/java/com/vonage/quickstart/video/ListBroadcasts.java new file mode 100644 index 0000000..793fe24 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/ListBroadcasts.java @@ -0,0 +1,35 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; +import java.util.List; + +public class ListBroadcasts { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + List broadcasts = videoClient.listBroadcasts(); + + System.out.println("Retrieved list of broadcasts: " + broadcasts); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/ListStreams.java b/src/main/java/com/vonage/quickstart/video/ListStreams.java new file mode 100644 index 0000000..99eacac --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/ListStreams.java @@ -0,0 +1,36 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +import java.util.List; + +public class ListStreams { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + List streams = videoClient.listStreams(VIDEO_SESSION_ID); + + System.out.println("Retrieved list of streams: " + streams); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/RemoveArchiveStream.java b/src/main/java/com/vonage/quickstart/video/RemoveArchiveStream.java new file mode 100644 index 0000000..865f567 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/RemoveArchiveStream.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class RemoveArchiveStream { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.removeArchiveStream(VIDEO_ARCHIVE_ID, VIDEO_STREAM_ID); + + System.out.println("Removed archive stream"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/RemoveBroadcastStream.java b/src/main/java/com/vonage/quickstart/video/RemoveBroadcastStream.java new file mode 100644 index 0000000..3a32222 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/RemoveBroadcastStream.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class RemoveBroadcastStream { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + videoClient.removeBroadcastStream(VIDEO_BROADCAST_ID, VIDEO_STREAM_ID); + + System.out.println("Removed broadcast stream"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/SendSignal.java b/src/main/java/com/vonage/quickstart/video/SendSignal.java new file mode 100644 index 0000000..7cfaf63 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/SendSignal.java @@ -0,0 +1,39 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class SendSignal { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + SignalRequest signal = SignalRequest.builder() + .type("chat") + .data("Hello, World!") + .build(); + + videoClient.signalAll(VIDEO_SESSION_ID, signal); + + System.out.println("Sent signal to all participants"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/SetStreamLayout.java b/src/main/java/com/vonage/quickstart/video/SetStreamLayout.java new file mode 100644 index 0000000..e2ade1a --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/SetStreamLayout.java @@ -0,0 +1,37 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class SetStreamLayout { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + SessionStream stream = SessionStream.builder(VIDEO_STREAM_ID) + .layoutClassList("full", "focus").build(); + + videoClient.setStreamLayout(VIDEO_SESSION_ID, stream); + + System.out.println("Set session stream layout"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/SipDial.java b/src/main/java/com/vonage/quickstart/video/SipDial.java new file mode 100644 index 0000000..ea14968 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/SipDial.java @@ -0,0 +1,40 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +import java.net.URI; + +public class SipDial { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + SipDialRequest request = SipDialRequest.builder() + .uri(URI.create("sip:user@sip.partner.com"), false) + .sessionId(VIDEO_SESSION_ID).token(VIDEO_TOKEN).build(); + + SipDialResponse parsed = videoClient.sipDial(request); + + System.out.println("Initiated SIP connection: " + parsed.toJson()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/StopArchive.java b/src/main/java/com/vonage/quickstart/video/StopArchive.java new file mode 100644 index 0000000..0ee842d --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/StopArchive.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class StopArchive { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + Archive archive = videoClient.stopArchive(VIDEO_ARCHIVE_ID); + + System.out.println("Stopped archive: " + archive.getId()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/StopBroadcast.java b/src/main/java/com/vonage/quickstart/video/StopBroadcast.java new file mode 100644 index 0000000..2ca926c --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/StopBroadcast.java @@ -0,0 +1,34 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class StopBroadcast { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + Broadcast broadcast = videoClient.stopBroadcast(VIDEO_BROADCAST_ID); + + System.out.println("Stopped broadcast: " + broadcast.getId()); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/UpdateArchiveLayout.java b/src/main/java/com/vonage/quickstart/video/UpdateArchiveLayout.java new file mode 100644 index 0000000..69880e9 --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/UpdateArchiveLayout.java @@ -0,0 +1,35 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class UpdateArchiveLayout { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + StreamCompositionLayout layout = StreamCompositionLayout.standardLayout(ScreenLayoutType.VERTICAL); + videoClient.updateArchiveLayout(VIDEO_ARCHIVE_ID, layout); + + System.out.println("Updated archive layout"); + } +} diff --git a/src/main/java/com/vonage/quickstart/video/UpdateBroadcastLayout.java b/src/main/java/com/vonage/quickstart/video/UpdateBroadcastLayout.java new file mode 100644 index 0000000..ec47ffd --- /dev/null +++ b/src/main/java/com/vonage/quickstart/video/UpdateBroadcastLayout.java @@ -0,0 +1,35 @@ +/* + * Copyright 2025 Vonage + * + * 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.vonage.quickstart.video; + +import com.vonage.client.VonageClient; +import com.vonage.client.video.*; +import static com.vonage.quickstart.EnvironmentVariables.*; + +public class UpdateBroadcastLayout { + public static void main(String[] args) throws Exception { + + VideoClient videoClient = VonageClient.builder() + .applicationId(VONAGE_APPLICATION_ID) + .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) + .build().getVideoClient(); + + StreamCompositionLayout layout = StreamCompositionLayout.standardLayout(ScreenLayoutType.VERTICAL); + videoClient.updateBroadcastLayout(VIDEO_BROADCAST_ID, layout); + + System.out.println("Updated broadcast layout"); + } +}