Skip to content

Commit 5f2d87b

Browse files
Merge pull request #250094 from enricohuang/patch-8
Update mediastats doc
2 parents d178f86 + 31c2ffa commit 5f2d87b

File tree

1 file changed

+30
-3
lines changed
  • articles/communication-services/concepts/voice-video-calling/includes/media-stats

1 file changed

+30
-3
lines changed

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ The `mediaStatsEmitted` or `summaryReported` event is raised every 60 seconds an
5656
### SDK version 1.8.0 or later
5757

5858
As a developer, you can invoke the `createCollector` method with optional `mediaStatsSubscriptionOptions`.
59+
To receive the media statistics data, you can subscribe `sampleReported` event or `summaryReported` event.
60+
`sampleReported` event triggers every second. It is suitable as a data source for UI display or your own data pipeline.
61+
`summaryReported` event contains the aggregated values of the data over intervals, which is useful when you just need a summary.
5962

6063
```js
6164
const mediaStatsCollector = mediaStatsFeature.createCollector(mediaStatsSubscriptionOptions);
@@ -69,20 +72,44 @@ mediaStatsCollector.on('summaryReported', (summary) => {
6972
});
7073
```
7174

72-
To dispose of the media statistics collector, invoke the `dispose` method of `mediaStatsCollector`.
75+
In case you don't need to use the media statistics collector, you can call `dispose` method of `mediaStatsCollector`.
7376

7477
```js
7578
mediaStatsCollector.dispose();
7679
```
77-
78-
We removed the `disposeAllCollectors` method. The collectors will be reclaimed when you dispose of `mediaStatsFeature`.
80+
It is not necessary to call `dispose` method of `mediaStatsCollector` every time when the call ends, as the collectors will be reclaimed internally when the call ends.
81+
However, if you are using SDK version less than 1.8.0-beta.1, you need use `disposeAllCollectors` API to release the resource.
7982

8083
## Best practices
8184

8285
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 that's needed to continue an Azure Communication Services call (especially when available bandwidth is low).
8386

8487
## Media quality statistics metrics for SDK version 1.8.0 or later
8588

89+
In either `sampleReported` event or `summaryReported` event, the media statistics data are not just a simple key-value mapping.
90+
91+
Here is the type declaration of the event data reported by `sampleReported` event.
92+
```typescript
93+
export interface MediaStatsReportSample {
94+
audio: {
95+
send: AudioSendMediaStats<MediaStatRawValue>[];
96+
receive: AudioRecvMediaStats<MediaStatRawValue>[];
97+
};
98+
video: {
99+
send: VideoSendMediaStats<MediaStatRawValue>[];
100+
receive: VideoRecvMediaStats<MediaStatRawValue>[];
101+
};
102+
screenShare: {
103+
send: ScreenShareSendMediaStats<MediaStatRawValue>[];
104+
receive: ScreenShareRecvMediaStats<MediaStatRawValue>[];
105+
};
106+
}
107+
108+
```
109+
The event data provide the statistics data for each media stream in the call, including both send and recv directions.
110+
It is recommended that you print out 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.
111+
112+
86113
The bandwidth metrics have changes to `availableBitrate` in audio send and video send metrics.
87114

88115
### Audio send metrics

0 commit comments

Comments
 (0)