You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -113,49 +113,60 @@ To play audio using Text-To-Speech through Azure Cognitive Services you need to
113
113
```java
114
114
var playSource =newTextSource();
115
115
playSource.setText("some text to play");
116
+
117
+
//you can provide SourceLocale and VoiceGender as one option for playing audio
116
118
playSource.setSourceLocale("en-US");
117
119
playSource.setVoiceGender(GenderType.M);
118
-
playSource.setVoiceName("LULU");
119
120
```
120
121
121
-
## Play audio to a specific participant
122
+
```java
123
+
var playSource =newTextSource();
124
+
playSource.setText("Welcome to Contoso");
122
125
123
-
In this scenario audio is played to a specific participant.
126
+
//you can provide VoiceName
127
+
playSource.setVoiceName("en-US-ElizabethNeural");
128
+
```
129
+
Once you've decided on which playSource you wish to use for playing audio you can then choose whether you want to play it to a specific participant or to all participants.
124
130
125
-
```java
126
-
var targetUser =newPhoneNumberIdentifier(<target>);
131
+
## Play audio to all participants
132
+
133
+
In this scenario audio is played to all participants on the call.
134
+
135
+
```java
127
136
var callConnection = callAutomationAsyncClient.getCallConnectionAsync(<callConnectionId>);
128
137
129
138
var playOptions =newPlayOptions()
130
139
.setLoop(false)
131
140
.setOperationContext("operationContext");
132
141
133
-
var playResponse = callConnection.getCallMediaAsync().playWithResponse(
142
+
var playResponse = callConnection.getCallMediaAsync().playToAllWithResponse(
134
143
playSource,
135
-
Collections.singletonList(targetUser), // Can be a list of multiple users
136
144
playOptions
137
145
).block();
138
146
assertEquals(202, playResponse.getStatusCode()); // The request was accepted
139
147
```
140
148
141
-
## Play audio to all participants
149
+
## Play audio to a specific participant
142
150
143
-
In this scenario audio is played to all participants on the call.
151
+
In this scenario audio is played to a specific participant.
144
152
145
-
```java
153
+
```java
154
+
var targetUser =newPhoneNumberIdentifier(<target>);
146
155
var callConnection = callAutomationAsyncClient.getCallConnectionAsync(<callConnectionId>);
147
156
148
157
var playOptions =newPlayOptions()
149
158
.setLoop(false)
150
159
.setOperationContext("operationContext");
151
160
152
-
var playResponse = callConnection.getCallMediaAsync().playToAllWithResponse(
161
+
var playResponse = callConnection.getCallMediaAsync().playWithResponse(
153
162
playSource,
163
+
Collections.singletonList(targetUser), // Can be a list of multiple users
154
164
playOptions
155
165
).block();
156
166
assertEquals(202, playResponse.getStatusCode()); // The request was accepted
157
167
```
158
168
169
+
159
170
## Handle play action event updates
160
171
161
172
Your application receives action lifecycle event updates on the callback URL that was provided to Call Automation service at the time of answering the call. An example of a successful play event update.
0 commit comments