|
| 1 | +Subscribe to the `mediaScoreUpdate` event to monitor network |
| 2 | + |
| 3 | +```ts |
| 4 | +meeting.self.on('mediaScoreUpdate', ({ kind, isScreenshare, score, scoreStats }) => { |
| 5 | + if (kind === 'video') { |
| 6 | + console.log( |
| 7 | + `Your ${isScreenshare ? 'screenshare' : 'video'} quality score is `, |
| 8 | + score |
| 9 | + ); |
| 10 | + } |
| 11 | + |
| 12 | + if (kind === 'audio') { |
| 13 | + console.log('Your audio quality score is ', score); |
| 14 | + } |
| 15 | + |
| 16 | + if (score < 5) { |
| 17 | + console.log('Your media quality is poor'); |
| 18 | + } |
| 19 | +}); |
| 20 | +``` |
| 21 | + |
| 22 | +The `scoreStats` object contains the statistics that contributed to the calculated media score. |
| 23 | + |
| 24 | +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. |
| 25 | + |
| 26 | +``` |
| 27 | +// Audio Producer |
| 28 | +{ |
| 29 | + "kind": "audio", |
| 30 | + "isScreenshare": false, |
| 31 | + "score": 10, |
| 32 | + "participantId": "c8aa91f6-0316-4025-8240-80d130e5acca", // meeting.self.id |
| 33 | + "scoreStats": { |
| 34 | + "score": 10, |
| 35 | + "bitrate": 22452, // bytes per second |
| 36 | + "packetsLostPercentage": 0, |
| 37 | + "jitter": 0, // seconds |
| 38 | + "isScreenShare": false |
| 39 | + } |
| 40 | +} |
| 41 | +
|
| 42 | +// Video Producer |
| 43 | +{ |
| 44 | + "kind": "video", |
| 45 | + "isScreenshare": false, |
| 46 | + "score": 10, |
| 47 | + "participantId": "c8aa91f6-0316-4025-8240-80d130e5acca", // meeting.self.id |
| 48 | + "scoreStats": { |
| 49 | + "score": 10, |
| 50 | + "frameWidth": 640, |
| 51 | + "frameHeight": 480, |
| 52 | + "framesPerSecond": 24, |
| 53 | + "jitter": 0, // seconds |
| 54 | + "isScreenShare": false, |
| 55 | + "packetsLostPercentage": 0, |
| 56 | + "bitrate": 576195, // bytes per second |
| 57 | + "cpuLimitations": false, |
| 58 | + "bandwidthLimitations": false |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
0 commit comments