Skip to content

Commit 9192dc9

Browse files
authored
Update raw-media-access-javascript.md
1 parent d3f88cf commit 9192dc9

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

articles/communication-services/quickstarts/voice-video-calling/includes/raw-media/raw-media-access-javascript.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
12
---
23
title: Quickstart - Add RAW media access to your app (Web)
34
titleSuffix: An Azure Communication Services quickstart
45
description: In this quickstart, you'll learn how to add raw media access calling capabilities to your app using Azure Communication Services.
56
author: sloanster
67

78
ms.author: micahvivion
8-
ms.date: 1/17/2023
9+
ms.date: 1/26/2023
910
ms.topic: quickstart
1011
ms.service: azure-communication-services
1112
ms.subservice: calling
@@ -18,7 +19,7 @@ As a developer you can access the raw media for incoming and outgoing audio and
1819
[!INCLUDE [Public Preview](../../../../includes/public-preview-include-document.md)]
1920

2021
>[!IMPORTANT]
21-
> The quick start examples here are available starting on the public preview version [1.9.1-beta.1](https://www.npmjs.com/package/@azure/communication-calling/v/1.9.1-beta.1) of the calling Web SDK. Make sure to use that version or newer when trying this quickstart.
22+
> The quick start examples here are available starting on the public preview version [1.10.0-beta.1](https://www.npmjs.com/package/@azure/communication-calling/v/1.10.0-beta.1) of the calling Web SDK. Make sure to use that version or newer when trying this quickstart.
2223
2324
## Accessing Raw audio
2425
Accessing Raw audio media gives access to the incoming call audio stream and the ability to view and send custom outgoing audio stream during a call.
@@ -27,7 +28,7 @@ Accessing Raw audio media gives access to the incoming call audio stream and the
2728
Developers can start a call with a custom audio stream instead of using user's microphone device.
2829

2930
```js
30-
const createBeepAudioTrackToSend = () => {
31+
const createBeepAudioStreamToSend = () => {
3132
const context = new AudioContext();
3233
const dest = context.createMediaStreamDestination();
3334
const os = context.createOscillator();
@@ -36,14 +37,13 @@ const createBeepAudioTrackToSend = () => {
3637
os.connect(dest);
3738
os.start();
3839
const { stream } = dest;
39-
const track = stream.getAudioTracks()[0];
40-
return track;
40+
return stream;
4141
};
4242

4343
...
4444
const userId = 'acs_user_id';
45-
const mediaStreamTrack = createBeepAudioTrackToSend();
46-
const localAudioStream = new LocalAudioStream(mediaStreamTrack);
45+
const mediaStream = createBeepAudioStreamToSend();
46+
const localAudioStream = new LocalAudioStream(mediaStream);
4747
const callOptions = {
4848
audioOptions: {
4949
localAudioStreams: [localAudioStream]
@@ -56,7 +56,7 @@ callAgent.startCall(userId, callOptions);
5656
Developers can switch input device to a custom audio stream instead of using user's microphone device during a call.
5757

5858
```js
59-
const createBeepAudioTrackToSend = () => {
59+
const createBeepAudioStreamToSend = () => {
6060
const context = new AudioContext();
6161
const dest = context.createMediaStreamDestination();
6262
const os = context.createOscillator();
@@ -65,15 +65,14 @@ const createBeepAudioTrackToSend = () => {
6565
os.connect(dest);
6666
os.start();
6767
const { stream } = dest;
68-
const track = stream.getAudioTracks()[0];
69-
return track;
68+
return stream;
7069
};
7170

7271
...
7372

7473
const userId = 'acs_user_id';
75-
const mediaStreamTrack = createBeepAudioTrackToSend();
76-
const localAudioStream = new LocalAudioStream(mediaStreamTrack);
74+
const mediaStream = createBeepAudioStreamToSend();
75+
const localAudioStream = new LocalAudioStream(mediaStream);
7776
const call = callAgent.startCall(userId);
7877
const callStateChangedHandler = () => {
7978
if (call.state === 'Connected') {
@@ -100,7 +99,7 @@ const call = callAgent.startCall(userId);
10099
const callStateChangedHandler = () => {
101100
if (call.state === "Connected") {
102101
const remoteAudioStream = call.remoteAudioStreams[0];
103-
const mediaStreamTrack = remoteAudioStream.getMediaStreamTrack();
102+
const mediaStream = remoteAudioStream.getMediaStream();
104103
// process the incoming call audio media stream track
105104
}
106105
};

0 commit comments

Comments
 (0)