delay on screencast failed.

This commit is contained in:
Miroslav Šedivý 2021-08-03 11:14:38 +02:00
parent 8c7030470d
commit 38ba2b8f92

View File

@ -7,6 +7,7 @@
import { RoomApi } from './api' import { RoomApi } from './api'
const REFRESH_RATE = 1e3 const REFRESH_RATE = 1e3
const ERROR_DELAY_MS = 2500
@Component({ @Component({
name: 'neko-screencast', name: 'neko-screencast',
@ -29,6 +30,7 @@
while (this.continue) { while (this.continue) {
const lastLoad = Date.now() const lastLoad = Date.now()
try {
const res = await this.api.screenCastImage({ responseType: 'blob' }) const res = await this.api.screenCastImage({ responseType: 'blob' })
const image = URL.createObjectURL(res.data) const image = URL.createObjectURL(res.data)
@ -42,6 +44,9 @@
} }
URL.revokeObjectURL(image) URL.revokeObjectURL(image)
} catch (e) {
await new Promise((res) => setTimeout(res, ERROR_DELAY_MS))
}
} }
this.running = false this.running = false