Skip to content

Commit

Permalink
表示用の変数に frameWidth が入ってくるまでは rid の表示指定を設定しない
Browse files Browse the repository at this point in the history
  • Loading branch information
tnamao committed Jun 10, 2024
1 parent 9985f1f commit 1907646
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/Video/LocalVideoCapabilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,20 @@ const useLocalVideoTrackStats = (stream: MediaStream) => {
)
if (selected === null) {
// selected が未指定の場合は frameWidth が最大のものを選択
setSelected(
videoStats.sort((a, b) => {
const selectedVideoStats = videoStats
.filter((s) => s.outboundRtpStats.frameWidth !== undefined)
.sort((a, b) => {
if (a.outboundRtpStats.frameWidth === undefined) {
return 1
}
if (b.outboundRtpStats.frameWidth === undefined) {
return -1
}
return b.outboundRtpStats.frameWidth - a.outboundRtpStats.frameWidth
})[0],
)
})
if (selectedVideoStats.length > 0) {
setSelected(selectedVideoStats[0])
}
}
})()
}, [statsReport, stream, selected])
Expand Down

0 comments on commit 1907646

Please sign in to comment.