Skip to content

Commit 5cf34a5

Browse files
committed
Serialize properly
1 parent 90cc697 commit 5cf34a5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sdk/ai/Azure.AI.VoiceLive/src/VoiceLiveSession.Commands.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ public virtual async Task SendInputAudioAsync(byte[] audio, CancellationToken ca
3838

3939
string base64Audio = Convert.ToBase64String(audio);
4040
ClientEventInputAudioBufferAppend appendCommand = new(base64Audio);
41-
BinaryData requestData = BinaryData.FromObjectAsJson(appendCommand);
42-
await SendCommandAsync(requestData, cancellationToken).ConfigureAwait(false);
41+
var request = appendCommand.ToRequestContent();
42+
var ms = new MemoryStream();
43+
await request.WriteToAsync(ms, cancellationToken).ConfigureAwait(false);
44+
ms.Seek(0, SeekOrigin.Begin);
45+
var bd = await BinaryData.FromStreamAsync(ms).ConfigureAwait(false);
46+
await SendCommandAsync(bd, cancellationToken).ConfigureAwait(false);
4347
}
4448
}
4549

0 commit comments

Comments
 (0)