diff --git a/src/plugins/conference.js b/src/plugins/conference.js index 2193517d..cd8076cb 100644 --- a/src/plugins/conference.js +++ b/src/plugins/conference.js @@ -32,6 +32,9 @@ export class ConferencePlugin { }) .onConferenceFile((file)=>{ this.events.emit('conferenceFile', file); + }) + .onConferenceEnded(()=>{ + this.events.emit('conferenceEnded'); }); }).onConferenceNetworkDisconnected(()=>{ this.events.emit('disconnected'); @@ -59,11 +62,6 @@ export class ConferencePlugin { await this.getNetwork().leaveConference(); } - onLeft(listener) { - this.events.on('left', listener); - return this; - } - onConferenceParticipantJoined(listener) { this.events.on('participantJoined', listener); return this; @@ -89,6 +87,11 @@ export class ConferencePlugin { return this; } + onConferenceEnded(listener) { + this.events.on('conferenceEnded', listener); + return this; + } + onError(listener) { this.events.on('error', listener); return this; @@ -115,6 +118,7 @@ export class ConferencePlugin { onLocalMediaStreamEnded(listener) { this.events.on('localMediaStreamEnded', listener); + return this; } hasLocalMediaStream() { diff --git a/src/store/index.js b/src/store/index.js index 521c10da..d3a545df 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -117,9 +117,7 @@ export const store = new Vuex.Store({ }); }, function conference(store) { - Vue.$conference.onLeft((conference)=>{ - store.commit('conference/leftSuccessfully', conference); - }).onConferenceParticipantJoined((participant)=>{ + Vue.$conference.onConferenceParticipantJoined((participant)=>{ store.commit('conference/participantJoined', participant); participant.onMediaStream(()=>{ store.commit('conference/removeRemoteMedia', participant.id); @@ -139,6 +137,8 @@ export const store = new Vuex.Store({ store.commit('conference/file', file); }).onLocalMediaStreamEnded(()=>{ store.commit('conference/disposeLocalMedia'); + }).onConferenceEnded(()=>{ + store.dispatch('conference/leave'); }); }, function initI18n(store) {