Skip to content

Commit 14d8bc5

Browse files
committed
Media statistics code fix
Replaced "startCollector" code in pre-call-diagnostics with "createCollector" code from media-quality-sdk include file media-stats-web. Also ran Acrolinx and edited.
1 parent d67f81a commit 14d8bc5

File tree

3 files changed

+65
-33
lines changed

3 files changed

+65
-33
lines changed

articles/communication-services/concepts/voice-video-calling/includes/media-stats/media-stats-web.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ Media quality statistics is an extended feature of the core `Call` API. You firs
2323
const mediaStatsFeature = call.feature(Features.MediaStats);
2424
```
2525

26-
To receive the media statistics data, you can subscribe `sampleReported` event or `summaryReported` event.
26+
To receive the media statistics data, you can subscribe to the `sampleReported` event or the `summaryReported` event.
2727

28-
`sampleReported` event triggers every second. It's suitable as a data source for UI display or your own data pipeline.
28+
The `sampleReported` event triggers every second. It's suitable as a data source for UI display or your own data pipeline.
2929

30-
`summaryReported` event contains the aggregated values of the data over intervals, which is useful when you just need a summary.
30+
The `summaryReported` event contains the aggregated values of the data over intervals, which is useful when you just need a summary.
3131

32-
If you want control over the interval of the `summaryReported` event, you need to define `mediaStatsCollectorOptions` of type `MediaStatsCollectorOptions`.
33-
Otherwise, the SDK uses default values.
32+
If you want control over the interval of the `summaryReported` event, you need to define `mediaStatsCollectorOptions` of type `MediaStatsCollectorOptions`. Otherwise, the SDK uses default values.
3433

3534

3635
```js
@@ -50,12 +49,13 @@ mediaStatsCollector.on('summaryReported', (summary) => {
5049
});
5150
```
5251

53-
In case you don't need to use the media statistics collector, you can call `dispose` method of `mediaStatsCollector`.
52+
If you don't need to use the media statistics collector, you can call `dispose` method of `mediaStatsCollector`.
5453

5554
```js
5655
mediaStatsCollector.dispose();
5756
```
58-
It's not necessary to call `dispose` method of `mediaStatsCollector` every time when the call ends, as the collectorsare reclaimed internally when the call ends.
57+
58+
You don't need to call `dispose` method of `mediaStatsCollector` every time when the call ends, because the collectors are reclaimed internally when the call ends.
5959

6060
### MediaStatsCollectorOptions
6161

@@ -86,9 +86,9 @@ The `summaryReported` event is raised every 60 seconds and contains 1 unique uni
8686

8787
If you want to collect the data for offline inspection, we recommend that you collect the data and send it to your pipeline ingestion after your call ends. If you transmit the data during a call, it could use internet bandwidth needed to continue an Azure Communication Services call (especially when available bandwidth is low).
8888

89-
In either `sampleReported` event or `summaryReported` event, the media statistics data are not just a simple key-value mapping.
89+
In either `sampleReported` event or `summaryReported` event, the media statistics data aren't just a simple key-value mapping.
9090

91-
Here is the type declaration of the event data reported by `sampleReported` event.
91+
Here's the type declaration of the event data reported by `sampleReported` event.
9292

9393
```typescript
9494
export interface MediaStatsReportSample {
@@ -106,11 +106,11 @@ export interface MediaStatsReportSample {
106106
};
107107
transports: TransportMediaStats<number>[];
108108
}
109-
110109
```
110+
111111
The event data provide the statistics data for each media stream in the call, including both send and receive directions.
112112

113-
It's recommended that you print the event using the `console.log` to observe its layout and value changes, so you can find a proper way to display or process the data according to your usage scenario.
113+
We recommended that you print the event using the `console.log` to observe its layout and value changes, so you can find a proper way to display or process the data according to your usage scenario.
114114

115115
### Audio send metrics
116116

@@ -130,7 +130,7 @@ It's recommended that you print the event using the `console.log` to observe its
130130

131131
### Audio receive metrics
132132

133-
In the SDK versions ealier than 1.20.1, `jitterBufferDelayInMs` existed as `jitterBufferInMs`.
133+
In the SDK versions earlier than 1.20.1, `jitterBufferDelayInMs` existed as `jitterBufferInMs`.
134134

135135
| Metric name | Description | Comments |
136136
| ----------- | ----------- | -------- |
@@ -149,7 +149,7 @@ In the SDK versions ealier than 1.20.1, `jitterBufferDelayInMs` existed as `jitt
149149

150150
### Video send metrics
151151

152-
Starting from SDK version 1.20.1, the video send metrics included the `altLayouts` metric field, which allows for a better representation of simulcast stream statistics.
152+
Starting from SDK version 1.20.1, the video send metrics included the `altLayouts` metric field, which enable a better representation of simulcast stream statistics.
153153

154154
| Metric name | Description | Comments |
155155
| ----------- | ----------- | -------- |
@@ -234,11 +234,10 @@ In earlier versions, `rttInMs` existed as `pairRttInMs` in the stats for audio,
234234
We now support MediaStats feature API in 1.20.1 (GA).
235235
Compared to the previous beta versions, we also made some minor changes to the API interface in this GA version.
236236

237-
In the previous beta versions, `pairRttInMs`, `availableBitrate` were included in audio, video, and screenShare statistics.
238-
Now, these metrics have been separated into transport metrics.
237+
In the previous beta versions, `pairRttInMs`, `availableBitrate` were included in audio, video, and screenShare statistics. Now these metrics are separated into transport metrics.
239238

240-
We introduced `packets`, `packetsLost` metric fields in audio, video, screenShare statistics. These metrics are useful for calculating the total number of packets sent or recieved between two different time points.
239+
We introduced `packets` and `packetsLost` metric fields in audio, video, screenShare statistics. These metrics are useful for calculating the total number of packets sent or recieved between two different time points.
241240

242241
The `frameRateOutput` in video and screenShare statistics is removed. You can use `frameRateDecoded` instead.
243242

244-
The metric field `jitterBufferInMs` has been renamed to `jitterBufferDelayInMs` to provide a clearer description, as this metric indicates the duration of a packet stay in the jitter buffer.
243+
The metric field `jitterBufferInMs` has been renamed to `jitterBufferDelayInMs` to provide a clearer description, because this metric indicates the duration of a packet stay in the jitter buffer.

articles/communication-services/concepts/voice-video-calling/media-quality-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ zone_pivot_groups: acs-plat-web-ios-android-windows
1616

1717
# Media quality statistics
1818

19-
To help you understand media quality in VoIP and video calls that use Azure Communication Services, there's a feature called *media quality statistics*. Use it to examine the low-level audio, video, and screen-sharing quality metrics for incoming and outgoing call metrics.
19+
To help you better understand media quality in VoIP and video calls that use Azure Communication Services, there's a feature called *media quality statistics*. Use it to examine the low-level audio, video, and screen-sharing quality metrics for incoming and outgoing call metrics.
2020

2121
::: zone pivot="platform-web"
2222
[!INCLUDE [Media Stats for Web](./includes/media-stats/media-stats-web.md)]

articles/communication-services/concepts/voice-video-calling/pre-call-diagnostics.md

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ ms.service: azure-communication-services
1515

1616
[!INCLUDE [Public Preview Disclaimer](../../includes/public-preview-include.md)]
1717

18-
The Pre-Call API enables developers to programmatically validate a client’s readiness to join an Azure Communication Services Call. The Pre-Call APIs can be accessed through the Calling SDK. They provide multiple diagnostics including device, connection, and call quality. Pre-Call APIs are available only for Web (JavaScript). We'll be enabling these capabilities across platforms in the future, provide us with feedback on what platforms you would like to see Pre-Call APIs on.
18+
The Pre-Call API enables developers to programmatically validate a client’s readiness to join an Azure Communication Services Call. You can only access Pre-Call APIs through the Calling SDK. They provide multiple diagnostics including device, connection, and call quality. Pre-Call APIs are available only for Web (JavaScript). We'll be enabling these capabilities across platforms in the future. Provide us with [feedback](../../support.md) on which platforms you want to see Pre-Call APIs enabled.
1919

2020
## Prerequisites
2121

2222
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2323
- [Node.js](https://nodejs.org/) active Long Term Support(LTS) versions are recommended.
2424
- An active Communication Services resource. [Create a Communication Services resource](../../quickstarts/create-communication-resource.md).
25-
- A User Access Token to instantiate the call client. Learn how to [create and manage user access tokens](../../quickstarts/identity/access-tokens.md). You can also use the Azure CLI and run the next command with your connection string to create a user and an access token. (Need to grab connection string from the resource through Azure portal.)
25+
- A User Access Token to instantiate the call client. Learn how to [create and manage user access tokens](../../quickstarts/identity/access-tokens.md). You can also use the Azure CLI and run the next command with your connection string to create a user and an access token. Remember to copy the connection string from the resource through Azure portal.
2626

2727
```azurecli-interactive
2828
az communication identity token issue --scope voip --connection-string "yourConnectionString"
2929
```
3030

31-
For details, see [Use Azure CLI to Create and Manage Access Tokens](../../quickstarts/identity/access-tokens.md?pivots=platform-azcli).
31+
For more information, see [Use Azure CLI to Create and Manage Access Tokens](../../quickstarts/identity/access-tokens.md?pivots=platform-azcli).
3232

3333
## Accessing Pre-Call APIs
3434

3535
>[!IMPORTANT]
36-
>Pre-Call diagnostics are available starting on the version [1.9.1-beta.1](https://www.npmjs.com/package/@azure/communication-calling/v/1.9.1-beta.1) of the Calling SDK. Make sure to use that version when trying the next instructions.
36+
>Pre-call diagnostics are available starting on the version [1.9.1-beta.1](https://www.npmjs.com/package/@azure/communication-calling/v/1.9.1-beta.1) of the Calling SDK. Make sure to use that version when following these instructions.
3737
3838
To Access the Pre-Call API, you need to initialize a `callClient`, and provision an Azure Communication Services access token. There you can access the `PreCallDiagnostics` feature and the `startTest` method.
3939

@@ -69,6 +69,7 @@ export declare type PreCallDiagnosticsResult = {
6969
Individual result objects can be accessed as such using the `preCallDiagnosticsResult` constant. Results for individual tests be returned as they're completed with many of the test results being available immediately. If you use the `inCallDiagnostics` test, the results might take up to 1 minute as the test validates quality of the video and audio.
7070

7171
### Browser support
72+
7273
Browser compatibility check. Checks for `Browser` and `OS` compatibility and provides a `Supported` or `NotSupported` value back.
7374

7475
```javascript
@@ -87,6 +88,7 @@ In the case that the test fails and the browser being used by the user is `NotSu
8788
>Known issue: `browser support` test returning `Unknown` in cases where it should be returning a correct value.
8889
8990
### Device access
91+
9092
Permission check. Checks whether video and audio devices are available from a permissions perspective. Provides `boolean` value for `audio` and `video` devices.
9193

9294
```javascript
@@ -99,10 +101,11 @@ Permission check. Checks whether video and audio devices are available from a pe
99101

100102
```
101103

102-
In the case that the test fails and the permissions are false for audio and video, the user shouldn't continue into joining a call. Rather you need to prompt the user to enable the permissions. To do it, the best way is provided the specific instruction on how to access permission access based on the OS, version and browser they are on. For more information on permissions, check out our [recommendations](https://techcommunity.microsoft.com/t5/azure-communication-services/checklist-for-advanced-calling-experiences-in-mobile-web/ba-p/3266312).
104+
In the case that the test fails and the permissions are false for audio and video, the user shouldn't continue into joining a call. Rather you need to prompt the user to enable the permissions. To do it, the best way is provided the specific instruction on how to access permission access based on the OS, version, and browser they are on. For more information on permissions, check out our [recommendations](https://techcommunity.microsoft.com/t5/azure-communication-services/checklist-for-advanced-calling-experiences-in-mobile-web/ba-p/3266312).
103105

104106
### Device enumeration
105-
Device availability. Checks whether microphone, camera and speaker devices are detected in the system and ready to use. Provides an `Available` or `NotAvailable` value back.
107+
108+
Device availability. Checks whether microphone, camera, and speaker devices are detected in the system and ready to use. Provides an `Available` or `NotAvailable` value back.
106109

107110
```javascript
108111

@@ -118,7 +121,8 @@ Device availability. Checks whether microphone, camera and speaker devices are d
118121
In the case that devices aren't available, the user shouldn't continue into joining a call. Rather the user should be prompted to check device connections to ensure any headsets, cameras or speakers are properly connected. For more information on device management, check out our [documentation](../../how-tos/calling-sdk/manage-video.md?pivots=platform-web#device-management)
119122

120123
### InCall diagnostics
121-
Performs a quick call to check in-call metrics for audio and video and provides results back. Includes connectivity (`connected`, boolean), bandwidth quality (`bandWidth`, `'Bad' | 'Average' | 'Good'`) and call diagnostics for audio and video (`diagnostics`). Diagnostic are provided `jitter`, `packetLoss` and `rtt` and results are generated using a simple quality grade (`'Bad' | 'Average' | 'Good'`).
124+
125+
Performs a quick call to check in-call metrics for audio and video and provides results back. Includes connectivity (`connected`, boolean), bandwidth quality (`bandWidth`, `'Bad' | 'Average' | 'Good'`) and call diagnostics for audio and video (`diagnostics`). Diagnostic are provided `jitter`, `packetLoss`, and `rtt` and results are generated using a simple quality grade (`'Bad' | 'Average' | 'Good'`).
122126

123127
InCall diagnostics uses [media quality stats](./media-quality-sdk.md) to calculate quality scores and diagnose issues. During the pre-call diagnostic, the full set of media quality stats are available for consumption. These stats include raw values across video and audio metrics that can be used programatically. The InCall diagnostic provides a convenience layer on top of media quality stats to consume the results without the need to process all the raw data. See section on media stats for instructions to access.
124128

@@ -137,26 +141,55 @@ InCall diagnostics uses [media quality stats](./media-quality-sdk.md) to calcula
137141

138142
At this step, there are multiple failure points to watch out for. The values provided by the API are based on the threshold values required by the service. Those raw thresholds can be found in our [media quality stats documentation](./media-quality-sdk.md#best-practices).
139143

140-
- If connection fails, the user should be prompted to recheck their network connectivity. Connection failures can also be attributed to network conditions like DNS, Proxies or Firewalls. For more information on recommended network setting, check out our [documentation](network-requirements.md).
144+
- If connection fails, the user should be prompted to recheck their network connectivity. Connection failures can also be attributed to network conditions like DNS, proxies, or firewalls. For more information on recommended network setting, check out our [documentation](network-requirements.md).
141145
- If bandwidth is `Bad`, the user should be prompted to try out a different network or verify the bandwidth availability on their current one. Ensure no other high bandwidth activities might be taking place.
142146

143147
### Media stats
144-
For granular stats on quality metrics like jitter, packet loss, rtt, etc. `callMediaStatistics` are provided as part of the `preCallDiagnosticsResult` feature. See the [full list and description of the available metrics](./media-quality-sdk.md) in the linked article. You can subscribe to the call media stats to get full collection of them. This stat is the raw metrics that are used to calculate InCall diagnostic results and which can be consumed granularly for further analysis.
145148

146-
```javascript
149+
For granular stats on quality metrics like jitter, packet loss, rtt, and so on. We provide `callMediaStatistics` as part of the `preCallDiagnosticsResult` feature. For the full list and descriptions of available metrics, see [Media quality statistics](./media-quality-sdk.md). You can subscribe to the call media stats to get the full collection. This stat is the raw metrics used to calculate InCall diagnostic results which can be consumed granularly for further analysis.
150+
151+
Media quality statistics is an extended feature of the core `Call` API. You first need to obtain the `mediaStatsFeature` API object:
152+
153+
```js
154+
const mediaStatsFeature = call.feature(Features.MediaStats);
155+
```
156+
157+
To receive the media statistics data, you can subscribe to the `sampleReported` event or the `summaryReported` event.
158+
159+
The `sampleReported` event triggers every second. It's suitable as a data source for UI display or your own data pipeline.
147160

148-
const mediaStatsCollector = callMediaStatistics.startCollector();
161+
The `summaryReported` event contains the aggregated values of the data over intervals, which is useful when you just need a summary.
149162

150-
mediaStatsCollector.on('mediaStatsEmitted', (mediaStats: SDK.MediaStats) => {
151-
// process the stats for the call.
152-
console.log(mediaStats);
163+
If you want control over the interval of the `summaryReported` event, you need to define `mediaStatsCollectorOptions` of type `MediaStatsCollectorOptions`. Otherwise, the SDK uses default values.
164+
165+
```js
166+
const mediaStatsCollectorOptions: SDK.MediaStatsCollectorOptions = {
167+
aggregationInterval: 10,
168+
dataPointsPerAggregation: 6
169+
};
170+
171+
const mediaStatsCollector = mediaStatsFeature.createCollector(mediaStatsSubscriptionOptions);
172+
173+
mediaStatsCollector.on('sampleReported', (sample) => {
174+
console.log('media stats sample', sample);
153175
});
154176

177+
mediaStatsCollector.on('summaryReported', (summary) => {
178+
console.log('media stats summary', summary);
179+
});
155180
```
156181

182+
If you don't need to use the media statistics collector, you can call `dispose` method of `mediaStatsCollector`.
183+
184+
```js
185+
mediaStatsCollector.dispose();
186+
```
187+
188+
You don't need to call `dispose` method of `mediaStatsCollector` every time when the call ends, because the collectors are reclaimed internally when the call ends.
189+
157190
## Pricing
158191

159-
When the Pre-Call diagnostic test runs, behind the scenes it uses calling minutes to run the diagnostic. The test lasts for roughly 30 seconds, using up 30 seconds of calling which is charged at the standard rate of $0.004 per participant per minute. For the case of Pre-Call diagnostic, the charge will be for 1 participant x 30 seconds = $0.002.
192+
When the pre-call diagnostic test runs behind the scenes, it uses calling minutes to run the diagnostic. The test lasts for roughly 30 seconds, using up 30 seconds of calling time which is charged at the standard rate of $0.004 per participant per minute. For the case of pre-call diagnostics, the charge is for 1 participant x 30 seconds = $0.002.
160193

161194
## Next steps
162195

0 commit comments

Comments
 (0)