Skip to content

Commit 872b8c0

Browse files
Merge pull request #238184 from chriswhilar/patch-64
Update raw-media-access-javascript.md
2 parents 45845d7 + b1a5464 commit 872b8c0

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,21 +225,20 @@ const call = callAgent.startCall(userId);
225225
const callStateChangedHandler = async () => {
226226
if (call.state === "Connected") {
227227
const remoteVideoStream = remoteParticipants[0].videoStreams[0];
228-
229-
const processMediaStream = async () => {
230-
if (remoteVideoStream.isAvailable) {
231-
const mediaStream = await remoteVideoStream.getMediaStream();
232-
// remote video stream is turned on, process the video's raw media stream.
233-
} else {
234-
// remote video stream is turned off, handle it
235-
}
236-
}
237-
238-
remoteVideoStream.on('isAvailableChanged', async () => {
239-
await processMediaStream();
240-
})
241-
242-
await processMediaStream();
228+
const processMediaStream = async () => {
229+
if (remoteVideoStream.isAvailable) {
230+
// remote video stream is turned on, process the video's raw media stream.
231+
const mediaStream = await remoteVideoStream.getMediaStream();
232+
} else {
233+
// remote video stream is turned off, handle it
234+
}
235+
};
236+
237+
remoteVideoStream.on('isAvailableChanged', async () => {
238+
await processMediaStream();
239+
});
240+
241+
await processMediaStream();
243242
}
244243
};
245244

0 commit comments

Comments
 (0)