mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
webrtc stats ignote when no connection.
This commit is contained in:
parent
7858edb8ec
commit
817ea28379
@ -260,13 +260,16 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
|||||||
let packetsReceived: number
|
let packetsReceived: number
|
||||||
|
|
||||||
const timer = setInterval(async () => {
|
const timer = setInterval(async () => {
|
||||||
|
if (!this._peer) return
|
||||||
|
|
||||||
let stats: RTCStatsReport | undefined = undefined
|
let stats: RTCStatsReport | undefined = undefined
|
||||||
if (this._peer!.getStats.length === 0) {
|
if (this._peer.getStats.length === 0) {
|
||||||
stats = await this._peer!.getStats()
|
stats = await this._peer.getStats()
|
||||||
} else {
|
} else {
|
||||||
|
// callback browsers support
|
||||||
await new Promise((res, rej) => {
|
await new Promise((res, rej) => {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
this._peer!.getStats((stats) => res(stats))
|
this._peer.getStats((stats) => res(stats))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user