mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add signal close.
This commit is contained in:
parent
a482267839
commit
1fdcac5826
@ -191,6 +191,11 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
||||
Vue.set(this._state.connection.webrtc, 'video', video)
|
||||
}
|
||||
|
||||
protected [EVENT.SIGNAL_CLOSE]() {
|
||||
this._localLog.debug(`EVENT.SIGNAL_CLOSE`)
|
||||
this._connection.webrtc.close()
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Session Events
|
||||
/////////////////////////////
|
||||
|
@ -230,6 +230,14 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
||||
await this._peer.setRemoteDescription({ type: 'answer', sdp })
|
||||
}
|
||||
|
||||
public async close() {
|
||||
if (!this._peer) {
|
||||
throw new Error('attempting to close nonexistent peer')
|
||||
}
|
||||
|
||||
this._peer.close()
|
||||
}
|
||||
|
||||
public addTrack(track: MediaStreamTrack, ...streams: MediaStream[]): RTCRtpSender {
|
||||
if (!this._peer) {
|
||||
throw new Error('attempting to add track for nonexistent peer')
|
||||
|
@ -10,6 +10,7 @@ export const SIGNAL_ANSWER = 'signal/answer'
|
||||
export const SIGNAL_PROVIDE = 'signal/provide'
|
||||
export const SIGNAL_CANDIDATE = 'signal/candidate'
|
||||
export const SIGNAL_VIDEO = 'signal/video'
|
||||
export const SIGNAL_CLOSE = 'signal/close'
|
||||
|
||||
export const SESSION_CREATED = 'session/created'
|
||||
export const SESSION_DELETED = 'session/deleted'
|
||||
|
Loading…
Reference in New Issue
Block a user