mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
connection type event.
This commit is contained in:
parent
3d48152ccf
commit
d3d37de009
@ -10,6 +10,7 @@ import NekoState from '../types/state'
|
|||||||
export interface NekoEvents {
|
export interface NekoEvents {
|
||||||
// connection events
|
// connection events
|
||||||
['connection.status']: (status: 'connected' | 'connecting' | 'disconnected') => void
|
['connection.status']: (status: 'connected' | 'connecting' | 'disconnected') => void
|
||||||
|
['connection.type']: (status: 'fallback' | 'webrtc' | 'none') => void
|
||||||
['connection.webrtc.sdp']: (type: 'local' | 'remote', data: string) => void
|
['connection.webrtc.sdp']: (type: 'local' | 'remote', data: string) => void
|
||||||
['connection.webrtc.sdp.candidate']: (type: 'local' | 'remote', data: RTCIceCandidateInit) => void
|
['connection.webrtc.sdp.candidate']: (type: 'local' | 'remote', data: RTCIceCandidateInit) => void
|
||||||
['connection.closed']: (error?: Error) => void
|
['connection.closed']: (error?: Error) => void
|
||||||
|
@ -489,14 +489,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Watch('state.connection.status')
|
|
||||||
onConnectionChange(status: 'connected' | 'connecting' | 'disconnected') {
|
|
||||||
this.events.emit('connection.status', status)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Watch('screencast')
|
@Watch('screencast')
|
||||||
onScreencastChange(value: boolean) {
|
@Watch('state.connection.webrtc.connected')
|
||||||
if (value) {
|
updateConnectionType() {
|
||||||
|
if (this.screencast) {
|
||||||
Vue.set(this.state.connection, 'type', 'fallback')
|
Vue.set(this.state.connection, 'type', 'fallback')
|
||||||
} else if (this.state.connection.webrtc.connected) {
|
} else if (this.state.connection.webrtc.connected) {
|
||||||
Vue.set(this.state.connection, 'type', 'webrtc')
|
Vue.set(this.state.connection, 'type', 'webrtc')
|
||||||
@ -505,6 +501,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Watch('state.connection.status')
|
||||||
|
onConnectionStatusChange(status: 'connected' | 'connecting' | 'disconnected') {
|
||||||
|
this.events.emit('connection.status', status)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Watch('state.connection.type')
|
||||||
|
onConnectionTypeChange(type: 'fallback' | 'webrtc' | 'none') {
|
||||||
|
this.events.emit('connection.type', type)
|
||||||
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
// destroy video
|
// destroy video
|
||||||
if (this._video) {
|
if (this._video) {
|
||||||
|
Loading…
Reference in New Issue
Block a user