-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from dyte-io/docs/media-score-update
docs(media-score-update): added sample score stats objects
- Loading branch information
Showing
9 changed files
with
142 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Subscribe to the `mediaScoreUpdate` event to monitor network | ||
|
||
```ts | ||
meeting.participants.joined.on( | ||
'mediaScoreUpdate', | ||
({ participantId, kind, isScreenshare, score, scoreStats }) => { | ||
if (kind === 'video') { | ||
console.log( | ||
`Participant ${participantId}'s ${ | ||
isScreenshare ? 'screenshare' : 'video' | ||
} quality score is `, | ||
score | ||
); | ||
} | ||
|
||
if (kind === 'audio') { | ||
console.log( | ||
`Participant ${participantId}'s audio quality score is `, | ||
score | ||
); | ||
} | ||
|
||
if (score < 5) { | ||
console.log(`Participant ${participantId}'s media quality is poor`); | ||
} | ||
} | ||
); | ||
``` | ||
|
||
The `scoreStats` object contains the statistics that contributed to the calculated media score. | ||
|
||
The `mediaScoreUpdate` event will be emitted with an object similar to the following example as its first parameter, every few seconds, if any participant's media is being shared. | ||
|
||
``` | ||
// Audio Consumer | ||
{ | ||
"kind": "audio", | ||
"isScreenshare": false, | ||
"score": 10, | ||
"participantId": "f9b947d2-c9ca-4ea9-839b-c10304b0fffc", | ||
"scoreStats": { | ||
"score": 10, | ||
"packetsLostPercentage": 0, | ||
"jitter": 0.004, // seconds | ||
"isScreenShare": false, | ||
"bitrate": 1595 // bytes per second | ||
} | ||
} | ||
// Video Consumer | ||
{ | ||
"kind": "video", | ||
"isScreenshare": false, | ||
"score": 10, | ||
"participantId": "f9b947d2-c9ca-4ea9-839b-c10304b0fffc", | ||
"scoreStats": { | ||
"score": 10, | ||
"frameWidth": 640, | ||
"frameHeight": 480, | ||
"framesPerSecond": 24, | ||
"packetsLostPercentage": 0, | ||
"jitter": 0.002, // seconds | ||
"isScreenShare": false, | ||
"bitrate": 340460 // bytes per second | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Subscribe to the `mediaScoreUpdate` event to monitor network | ||
|
||
```ts | ||
meeting.self.on('mediaScoreUpdate', ({ kind, isScreenshare, score, scoreStats }) => { | ||
if (kind === 'video') { | ||
console.log( | ||
`Your ${isScreenshare ? 'screenshare' : 'video'} quality score is `, | ||
score | ||
); | ||
} | ||
|
||
if (kind === 'audio') { | ||
console.log('Your audio quality score is ', score); | ||
} | ||
|
||
if (score < 5) { | ||
console.log('Your media quality is poor'); | ||
} | ||
}); | ||
``` | ||
|
||
The `scoreStats` object contains the statistics that contributed to the calculated media score. | ||
|
||
The `mediaScoreUpdate` event will be emitted with an object similar to the following example as its first parameter, every few seconds, if media is being shared. | ||
|
||
``` | ||
// Audio Producer | ||
{ | ||
"kind": "audio", | ||
"isScreenshare": false, | ||
"score": 10, | ||
"participantId": "c8aa91f6-0316-4025-8240-80d130e5acca", // meeting.self.id | ||
"scoreStats": { | ||
"score": 10, | ||
"bitrate": 22452, // bytes per second | ||
"packetsLostPercentage": 0, | ||
"jitter": 0, // seconds | ||
"isScreenShare": false | ||
} | ||
} | ||
// Video Producer | ||
{ | ||
"kind": "video", | ||
"isScreenshare": false, | ||
"score": 10, | ||
"participantId": "c8aa91f6-0316-4025-8240-80d130e5acca", // meeting.self.id | ||
"scoreStats": { | ||
"score": 10, | ||
"frameWidth": 640, | ||
"frameHeight": 480, | ||
"framesPerSecond": 24, | ||
"jitter": 0, // seconds | ||
"isScreenShare": false, | ||
"packetsLostPercentage": 0, | ||
"bitrate": 576195, // bytes per second | ||
"cpuLimitations": false, | ||
"bandwidthLimitations": false | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters