fallback on webrtc disconnect.

This commit is contained in:
Miroslav Šedivý 2021-07-14 15:49:28 +02:00
parent 1905d7fcd2
commit a43ed3f6ba
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,7 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
this._state = state this._state = state
// initial state // initial state
Vue.set(this._state, 'type', 'webrtc') Vue.set(this._state, 'type', 'screencast')
// websocket // websocket
this.websocket.on('connected', () => { this.websocket.on('connected', () => {
@ -56,12 +56,15 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
if (this.websocket.connected && this.webrtc.connected) { if (this.websocket.connected && this.webrtc.connected) {
Vue.set(this._state, 'status', 'connected') Vue.set(this._state, 'status', 'connected')
} }
Vue.set(this._state, 'type', 'webrtc')
}) })
this.webrtc.on('disconnected', () => { this.webrtc.on('disconnected', () => {
if (this._state.status === 'connected') { if (this._state.status === 'connected') {
Vue.set(this._state, 'status', 'disconnected') Vue.set(this._state, 'status', 'disconnected')
} }
Vue.set(this._state, 'type', 'screencast')
this._webrtcReconnect() this._webrtcReconnect()
}) })

View File

@ -8,7 +8,7 @@
:muted="autoplay" :muted="autoplay"
playsinline playsinline
/> />
<neko-screencast v-if="state.connection.type == 'screencast'" :api="api.room" /> <neko-screencast v-if="state.connection.type == 'screencast' && state.connection.screencast" :api="api.room" />
<neko-overlay <neko-overlay
:webrtc="connection.webrtc" :webrtc="connection.webrtc"
:scroll="state.control.scroll" :scroll="state.control.scroll"