Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple changes. #22421

Merged
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
10 changes: 10 additions & 0 deletions sdk/communication/azure-communication-callingserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ serverCall.stopRecording(recordingId);
CallRecordingStateResult callRecordingStateResult = serverCall.getRecordingState(recordingId);
```

#### Download a Recording into a file:
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L100-L100 -->
```java
callingServerClient.downloadTo(
recordingUrl,
Paths.get(filePath),
null,
true
);
```
### Play Audio in Call

#### Play Audio:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.azure.communication.common.CommunicationIdentifier;
import com.azure.communication.common.CommunicationUserIdentifier;

import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -88,4 +89,19 @@ public void addParticipant() {
CommunicationIdentifier thirdCallee = new CommunicationUserIdentifier("<acs-user-identity-3>");
callConnection.addParticipant(thirdCallee, "ACS User 3", "<string-for-tracing-responses>");
}

/**
* Sample code for downloading a recording into a file.
*/
public void getRecordingStream() {
String recordingUrl = "https://ams.skype.com/objects/v1/document_id/video";
String filePath = "filePath.mp4";
CallingServerClient callingServerClient = createCallingServerClient();
callingServerClient.downloadTo(
recordingUrl,
Paths.get(filePath),
null,
true
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void downloadMetadataAsync(HttpClient httpClient) {
disabledReason = "Requires human intervention")
public void downloadMetadataRetryingAsync(HttpClient httpClient) {
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadMetadataAsync");
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadMetadataRetryingAsync");

try {
Flux<ByteBuffer> content = conversationAsyncClient.downloadStream(METADATA_URL);
Expand Down Expand Up @@ -142,7 +142,7 @@ public void downloadToFileAsync(HttpClient httpClient) {
disabledReason = "Requires human intervention")
public void downloadToFileRetryingAsync(HttpClient httpClient) {
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadToFileAsync");
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadToFileRetryingAsync");
AsynchronousFileChannel channel = Mockito.mock(AsynchronousFileChannel.class);

doAnswer(invocation -> {
Expand Down Expand Up @@ -171,6 +171,10 @@ public void downloadToFileRetryingAsync(HttpClient httpClient) {

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
@DisabledIfEnvironmentVariable(
named = "SKIP_LIVE_TEST",
matches = "(?i)(true)",
disabledReason = "Requires human intervention")
public void downloadContent404Async(HttpClient httpClient) {
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadContent404Async");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public void downloadVideo(HttpClient httpClient) {

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
@DisabledIfEnvironmentVariable(
named = "SKIP_LIVE_TEST",
matches = "(?i)(true)",
disabledReason = "Requires human intervention")
public void downloadContent404(HttpClient httpClient) {
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
CallingServerClient conversationClient = setupClient(builder, "downloadContent404");
Expand All @@ -91,7 +95,7 @@ public void downloadContent404(HttpClient httpClient) {
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void downloadContentWrongUrl(HttpClient httpClient) {
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
CallingServerClient conversationClient = setupClient(builder, "downloadContent404");
CallingServerClient conversationClient = setupClient(builder, "downloadContentWrongUrl");

ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
IllegalArgumentException ex =
Expand All @@ -107,7 +111,7 @@ public void downloadContentWrongUrl(HttpClient httpClient) {
@DisabledIfEnvironmentVariable(
named = "SKIP_LIVE_TEST",
matches = "(?i)(true)",
disabledReason = "Requires human intervention")
disabledReason = "Requires human intervention")
public void downloadContentStreamFailure(HttpClient httpClient) throws IOException {
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
CallingServerClient conversationClient = setupClient(builder, "downloadContent404");
Expand Down