mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
forward webrtc sdp for debugging, #15.
This commit is contained in:
parent
5f9c565df6
commit
6312ae2cd2
@ -11,6 +11,8 @@ export interface NekoEvents {
|
||||
// connection events
|
||||
['connection.websocket']: (state: 'connected' | 'connecting' | 'disconnected') => void
|
||||
['connection.webrtc']: (state: 'connected' | 'connecting' | 'disconnected') => void
|
||||
['connection.webrtc.sdp']: (type: 'local' | 'remote', data: string) => void
|
||||
['connection.webrtc.sdp.candidate']: (type: 'local' | 'remote', data: RTCIceCandidateInit) => void
|
||||
['connection.disconnect']: (message: string) => void
|
||||
|
||||
// drag and drop events
|
||||
@ -106,16 +108,18 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
||||
// Signal Events
|
||||
/////////////////////////////
|
||||
|
||||
protected [EVENT.SIGNAL_PROVIDE]({ event, video, videos }: message.SignalProvide) {
|
||||
protected [EVENT.SIGNAL_PROVIDE]({ event, sdp, video, videos }: message.SignalProvide) {
|
||||
this._log.debug('EVENT.SIGNAL_PROVIDE')
|
||||
Vue.set(this.state.connection.webrtc, 'video', video)
|
||||
Vue.set(this.state.connection.webrtc, 'videos', videos)
|
||||
// TODO: Handle.
|
||||
this.emit('connection.webrtc.sdp', 'remote', sdp)
|
||||
}
|
||||
|
||||
protected [EVENT.SIGNAL_CANDIDATE]({ event, ...candidate }: message.SignalCandidate) {
|
||||
this._log.debug('EVENT.SIGNAL_CANDIDATE')
|
||||
// TODO: Handle.
|
||||
this.emit('connection.webrtc.sdp.candidate', 'remote', candidate)
|
||||
}
|
||||
|
||||
protected [EVENT.SIGNAL_VIDEO]({ event, video }: message.SignalVideo) {
|
||||
|
@ -369,6 +369,7 @@
|
||||
try {
|
||||
let sdp = await this.webrtc.connect(payload.sdp, payload.iceservers)
|
||||
this.websocket.send(EVENT.SIGNAL_ANSWER, { sdp })
|
||||
this.events.emit('connection.webrtc.sdp', 'local', sdp)
|
||||
} catch (e) {}
|
||||
break
|
||||
case EVENT.SIGNAL_CANDIDATE:
|
||||
@ -417,6 +418,7 @@
|
||||
})
|
||||
this.webrtc.on('candidate', (candidate: RTCIceCandidateInit) => {
|
||||
this.websocket.send(EVENT.SIGNAL_CANDIDATE, candidate)
|
||||
this.events.emit('connection.webrtc.sdp.candidate', 'local', candidate)
|
||||
})
|
||||
|
||||
let webrtcCongestion: number = 0
|
||||
|
Loading…
Reference in New Issue
Block a user