mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-03 08:50:13 +02:00
webrtc stats ignote when no connection.
This commit is contained in:
parent
7858edb8ec
commit
817ea28379
1 changed files with 6 additions and 3 deletions
|
@ -260,13 +260,16 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
|||
let packetsReceived: number
|
||||
|
||||
const timer = setInterval(async () => {
|
||||
if (!this._peer) return
|
||||
|
||||
let stats: RTCStatsReport | undefined = undefined
|
||||
if (this._peer!.getStats.length === 0) {
|
||||
stats = await this._peer!.getStats()
|
||||
if (this._peer.getStats.length === 0) {
|
||||
stats = await this._peer.getStats()
|
||||
} else {
|
||||
// callback browsers support
|
||||
await new Promise((res, rej) => {
|
||||
//@ts-ignore
|
||||
this._peer!.getStats((stats) => res(stats))
|
||||
this._peer.getStats((stats) => res(stats))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue