|
@@ -82,11 +82,30 @@ JitsiConference.prototype.isJoined = function () {
|
82
|
82
|
|
83
|
83
|
/**
|
84
|
84
|
* Leaves the conference.
|
|
85
|
+ * @returns {Promise}
|
85
|
86
|
*/
|
86
|
87
|
JitsiConference.prototype.leave = function () {
|
87
|
|
- if(this.xmpp && this.room)
|
88
|
|
- this.xmpp.leaveRoom(this.room.roomjid);
|
89
|
|
- this.room = null;
|
|
88
|
+ var conference = this;
|
|
89
|
+
|
|
90
|
+ // leave the conference
|
|
91
|
+ if (conference.xmpp && conference.room) {
|
|
92
|
+ conference.xmpp.leaveRoom(conference.room.roomjid);
|
|
93
|
+ }
|
|
94
|
+
|
|
95
|
+ conference.room = null;
|
|
96
|
+
|
|
97
|
+ // remove local tracks
|
|
98
|
+ return Promise.all(
|
|
99
|
+ conference.getLocalTracks().map(function (track) {
|
|
100
|
+ return conference.removeTrack(track);
|
|
101
|
+ })
|
|
102
|
+ ).then(function () {
|
|
103
|
+
|
|
104
|
+ // remove all participants
|
|
105
|
+ conference.getParticipants().forEach(function (participant) {
|
|
106
|
+ conference.onMemberLeft(participant.getJid());
|
|
107
|
+ });
|
|
108
|
+ });
|
90
|
109
|
};
|
91
|
110
|
|
92
|
111
|
/**
|