add connection status event.

This commit is contained in:
Miroslav Šedivý 2021-07-11 22:38:48 +02:00
parent 78c3613f3e
commit 471b26ace5
2 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import NekoState from '../types/state'
export interface NekoEvents { export interface NekoEvents {
// connection events // connection events
['connection.status']: (status: 'connected' | 'connecting' | 'disconnected') => 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.disconnect']: (message: string) => void ['connection.disconnect']: (message: string) => void

View File

@ -455,6 +455,11 @@
} }
} }
@Watch('state.connection.status')
onConnectionChange(status: 'connected' | 'connecting' | 'disconnected') {
this.events.emit('connection.status', status)
}
clear() { clear() {
// destroy video // destroy video
if (this._video) { if (this._video) {