Skip to content

Commit a91c580

Browse files
Merge pull request #231658 from akania/patch-26
Update manage-video-web.md
2 parents 97d0f91 + 62c3b88 commit a91c580

File tree

1 file changed

+42
-20
lines changed

1 file changed

+42
-20
lines changed

articles/communication-services/how-tos/calling-sdk/includes/manage-video/manage-video-web.md

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: rifox
88
[!INCLUDE [Install SDK](../install-sdk/install-sdk-web.md)]
99

1010
## Device management
11-
To begin using video with Calling, you will need to know how to manage devices. Devices allow you to control what transmits Audio and Video to the call.
11+
To begin using video with Calling, you need to know how to manage devices. Devices allow you to control what transmits Audio and Video to the call.
1212

1313
In `deviceManager`, you can enumerate local devices that can transmit your audio and video streams in a call. You can also use it to request permission to access the local device's microphones and cameras.
1414

@@ -35,7 +35,7 @@ const localSpeakers = await deviceManager.getSpeakers(); // [AudioDeviceInfo, Au
3535

3636
### Set the default microphone and speaker
3737

38-
In `deviceManager`, you can set a default device that you'll use to start a call. If client defaults aren't set, Communication Services uses operating system defaults.
38+
In `deviceManager`, you can set a default device that you use to start a call. If client defaults aren't set, Communication Services uses operating system defaults.
3939

4040
```js
4141
// Get the microphone device that is being used.
@@ -72,7 +72,7 @@ Prompt a user to grant camera and/or microphone permissions:
7272
const result = await deviceManager.askDevicePermission({audio: true, video: true});
7373
```
7474

75-
This resolves with an object that indicates whether `audio` and `video` permissions were granted:
75+
The output returns with an object that indicates whether `audio` and `video` permissions were granted:
7676

7777
```js
7878
console.log(result.audio);
@@ -81,8 +81,8 @@ console.log(result.video);
8181
#### Notes
8282
- The 'videoDevicesUpdated' event fires when video devices are plugging-in/unplugged.
8383
- The 'audioDevicesUpdated' event fires when audio devices are plugged
84-
- When the DeviceManager is created, at first it does not know about any devices if permissions have not been granted yet, and so initially its device list is empty. If we then call the DeviceManager.askPermission() API, the user is prompted for device access and if the user clicks on 'allow' to grant the access, then the device manager will learn about the devices on the system, update it's device lists and emit the 'audioDevicesUpdated' and 'videoDevicesUpdated' events. Lets say we then refresh the page and create device manager, the device manager will be able to learn about devices because user has already previously granted access, and so it will initially it will have it's device lists filled and it will not emit 'audioDevicesUpdated' nor 'videoDevicesUpdated' events.
85-
- Speaker enumeration/selection is not supported on Android Chrome, iOS Safari, nor macOS Safari.
84+
- When the DeviceManager is created, at first it doesn't know about any devices if permissions haven't been granted yet so initially its device list will be empty. If we then call the DeviceManager.askPermission() API, the user is prompted for device access. When the user clicks on 'allow' to grant the access the device manager learns about the devices on the system, update it's device lists and emit the 'audioDevicesUpdated' and 'videoDevicesUpdated' events. If a user refreshes the page and creates a device manager, the device manager will be able to learn about devices because user has already previously granted access, and so it will initially it will have its device lists filled and it will not emit 'audioDevicesUpdated' nor 'videoDevicesUpdated' events.
85+
- Speaker enumeration/selection isn't supported on Android Chrome, iOS Safari, nor macOS Safari.
8686

8787
## Place a call with video camera
8888

@@ -139,12 +139,12 @@ const camera = cameras[1];
139139
localVideoStream.switchSource(camera);
140140
```
141141

142-
If the specified video device is being used by another process, or if it is disabled in the system:
143-
- While in a call, if your video is off and you start video using `call.startVideo()`, this method will throw with a `SourceUnavailableError` and `cameraStartFiled` will be set to true.
144-
- A call to the `localVideoStream.switchSource()` method will cause `cameraStartFailed` to be set to true.
142+
If the specified video device is being used by another process, or if it's disabled in the system:
143+
- While in a call, if your video is off and you start video using `call.startVideo()`, this method throws a `SourceUnavailableError` and `cameraStartFiled` will be set to true.
144+
- A call to the `localVideoStream.switchSource()` method causes `cameraStartFailed` to be set to true.
145145
Our Call Diagnostics guide provides additional information on how to diagnose call related issues.
146146

147-
To check or verify if the local video is on or off, you can use isLocalVideoStarted API, which returns true or false:
147+
To verify if the local video is on or off you can use isLocalVideoStarted API, which returns true or false:
148148
```js
149149
// Check if local video is on or off
150150
call.isLocalVideoStarted;
@@ -175,7 +175,7 @@ await call.startScreenSharing();
175175
await call.stopScreenSharing();
176176
```
177177

178-
To check or verify if screen sharing is on or off, you can use isScreenSharingOn API which returns true or false:
178+
To verify if screen sharing is on or off, you can use isScreenSharingOn API, which returns true or false:
179179
```js
180180
// Check if screen sharing is on or off
181181
call.isScreenSharingOn;
@@ -202,10 +202,9 @@ const remoteVideoStream: RemoteVideoStream = call.remoteParticipants[0].videoStr
202202
const streamType: MediaStreamType = remoteVideoStream.mediaStreamType;
203203
```
204204

205-
To render `RemoteVideoStream`, you have to subscribe to it's `isAvailableChanged` event. If the `isAvailable` property changes to `true`, a remote participant is sending a stream. After that happens, create a new instance of `VideoStreamRenderer`, and then create a new `VideoStreamRendererView` instance by using the asynchronous `createView` method. You can then attach `view.target` to any UI element.
205+
To render `RemoteVideoStream`, you have to subscribe to its `isAvailableChanged` event. If the `isAvailable` property changes to `true`, a remote participant is sending a stream. After that happens, create a new instance of `VideoStreamRenderer`, and then create a new `VideoStreamRendererView` instance by using the asynchronous `createView` method. You can then attach `view.target` to any UI element.
206206

207-
Whenever availability of a remote stream changes, you can choose to destroy the whole `VideoStreamRenderer`, a specific `VideoStreamRendererView`
208-
or keep them, but this will result in displaying blank video frame.
207+
Whenever availability of a remote stream changes, you can destroy the whole `VideoStreamRenderer` or a specific `VideoStreamRendererView`. If you do decided to keep them will result in displaying blank video frame.
209208

210209
```js
211210
// Reference to the html's div where we would display a grid of all remote video stream from all participants.
@@ -310,6 +309,29 @@ CSS for styling the loading spinner over the remote video stream.
310309
}
311310
```
312311

312+
### Remote video quality
313+
314+
Starting from 1.12(beta) version, the ACS WebJS SDK provides a new feature called OptimalVideoCount (OVC). This feature can be used to inform applications at run-time how many videos from different participants can be optimally rendered at a given moment in a group call (2+ participants). This feature exposes a property `optimalVideoCount` that is dynamically changing during the call based on the network and hardware capabilities of a local endpoint. The value of `optimalVideoCount` details how many videos from different participants application should render at a given moment. Application should handle these changes and update number of rendered videoes accordingly to the recommendation. There's a cooldown period (around 10s), between updates that to avoid too frequent of changes.
315+
316+
**Usage**
317+
The `optimalVideoCount` feature is a call feature
318+
```typescript
319+
interface OptimalVideoCountCallFeature extends CallFeature {
320+
off(event: 'optimalVideoCountChanged', listener: PropertyChangedEvent): void;
321+
on(event: 'optimalVideoCountChanged', listener: PropertyChangedEvent): void;
322+
readonly optimalVideoCount: number;
323+
}
324+
325+
const optimalVideoCountFeature = call.feature(Features.OptimalVideoCount);
326+
optimalVideoCountFeature.on('optimalVideoCountChanged', () => {
327+
const localOptimalVideoCountVariable = optimalVideoCountFeature.optimalVideoCount;
328+
})
329+
```
330+
331+
Example usage: Application should subscribe to changes of OVC and handle it in group calls by either creating new renderer (`createView` method) or dispose views (`dispose`)
332+
and update layout accordingly either by removing participants from the main call screen area (often called stage or roster ) or replacing their video elements with an avatar and a name of the user.
333+
334+
313335
### Remote video stream properties
314336

315337
Remote video streams have the following properties:
@@ -326,7 +348,7 @@ const id: number = remoteVideoStream.id;
326348
const type: MediaStreamType = remoteVideoStream.mediaStreamType;
327349
```
328350

329-
- `isAvailable`: Whether a remote participant endpoint is actively sending a stream.
351+
- `isAvailable`: Defines whether a remote participant endpoint is actively sending a stream.
330352

331353
```js
332354
const isAvailable: boolean = remoteVideoStream.isAvailable;
@@ -337,12 +359,12 @@ const isAvailable: boolean = remoteVideoStream.isAvailable;
337359
> [!NOTE]
338360
> This API is provided as a preview for developers and may change based on feedback that we receive. To use this api please use 1.5.4-beta.1+ release of Azure Communication Services Calling Web SDK
339361
- Will inform the application if remote video stream data is being received or not. Such scenarios are:
340-
- I am viewing the video of a remote participant who is on mobile browser. The remote participant brings the mobile browser app to the background. I now see the RemoteVideoStream.isReceiving flag goes to false and I see his video with black frames / frozen. When the remote participant brings the mobile browser back to the foreground, I now see the RemoteVideoStream.isReceiving flag to back to true, and I see his video playing normally.
341-
- I am viewing the video of a remote participant who is on whatever platforms. There are network issues from either side, his video start to look pretty laggy, bad quality, probbaly because of network issues, so I see the RemoteVideoStream.isReceiving flag goes to false.
342-
- I am viewing the video of a Remote participant who is On MacOS/iOS Safari, and from their address bar, they click on "Pause" / "Resume" camera. I'll see a black/frozen video since they paused their camera and I'll see the RemoteVideoStream.isReceiving flag goes to false. Once they resume playing the camera, then I'll see the RemoteVideoStream.isReceiving flag goes to true.
343-
- I am viewing the video of a remote participant who in on whatever platform. And for whatever reason their network disconnects. This will actually leave the remote participant in the call for a little while and I'll see his video frozen/black frame, and ill see RemoteVideoStream.isReceiving flag goes to false. The remote participant can get network back and reconnect and his audio/video should start flowing normally and I'll see the RemoteVideoStream.isReceiving flag to true.
344-
- I am viewing the video of a remote participant who is on mobile browser. The remote participant terminates/kills the mobile browser. Since that remote participant was on mobile, this will actually leave the participant in the call for a little while and I will still see him in the call and his video will be frozen, and so I'll see the RemoteVideoStream.isReceiving flag goes to false. At some point, service will kick participant out of the call and I would just see that the participant disconnected from the call.
345-
- I am viewing the video of a remote participant who is on mobile browser and they locks device. I'll see the RemoteVideoStream.isReceiving flag goes to false and. Once the remote participant unlocks the device and navigates to the acs call, then ill see the flag go back to true. Same behavior when remote participant is on desktop and the desktop locks/sleeps
362+
- I am viewing the video of a remote participant who is on mobile browser. The remote participant brings the mobile browser app to the background. I now see the RemoteVideoStream.isReceiving flag goes to false and I see their video with black frames / frozen. When the remote participant brings the mobile browser back to the foreground, I now see the RemoteVideoStream.isReceiving flag to back to true, and I see their video playing normally.
363+
- I am viewing the video of a remote participant who is on whatever platforms. There are network issues from either side, their video start to have bad quality, probably because of network issues, so I see the RemoteVideoStream.isReceiving flag goes to false.
364+
- I am viewing the video of a Remote participant who is On MacOS/iOS Safari, and from their address bar, they click on "Pause" / "Resume" camera. I see a black/frozen video since they paused their camera and I see the RemoteVideoStream.isReceiving flag goes to false. Once they resume playing the camera, then I see the RemoteVideoStream.isReceiving flag goes to true.
365+
- I am viewing the video of a remote participant who in on whatever platform. And for whatever reason their network disconnects. This will actually leave the remote participant in the call for a little while and I see their video frozen/black frame, and see RemoteVideoStream.isReceiving flag goes to false. The remote participant can get network back and reconnect and their audio/video should start flowing normally and I see the RemoteVideoStream.isReceiving flag to true.
366+
- I am viewing the video of a remote participant who is on mobile browser. The remote participant terminates/kills the mobile browser. Since that remote participant was on mobile, this will actually leave the participant in the call for a little while and I will still see them on the call and their video will be frozen, and so I see the RemoteVideoStream.isReceiving flag goes to false. At some point, service will kick participant out of the call and I would just see that the participant disconnected from the call.
367+
- I am viewing the video of a remote participant who is on mobile browser and they lock the device. I see the RemoteVideoStream.isReceiving flag goes to false. Once the remote participant unlocks the device and navigates to the acs call, then ill see the flag go back to true. Same behavior when remote participant is on desktop and the desktop locks/sleeps
346368
- This feature improves the user experience for rendering remote video streams.
347369
- You can display a loading spinner over the remote video stream when isReceiving flag changes to false. You don't have to do a loading spinner, you can do anything you desire, but a loading spinner is the most common usage for better user experience.
348370
```js

0 commit comments

Comments
 (0)