Skip to content

Commit

Permalink
fix(MeetingSdkAdapter): emit stopped events for remote media
Browse files Browse the repository at this point in the history
  • Loading branch information
akoushke committed Jan 16, 2020
1 parent 29f0d38 commit 7539dc2
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/MeetingsSDKAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,19 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
* @param {string} ID ID of the meeting to leave from
* @memberof MeetingsSDKAdapter
*/
leaveMeeting(ID) {
this.fetchMeeting(ID)
.leave()
.catch((error) => {
// eslint-disable-next-line no-console
console.error(`Unable to leave from the meeting "${ID}"`, error);
});
async leaveMeeting(ID) {
try {
const sdkMeeting = this.fetchMeeting(ID);

await sdkMeeting.leave();

// Due to SDK limitations, We need to emit a media stopped event for remote media types
sdkMeeting.emit(EVENT_MEDIA_STOPPED, {type: MEDIA_TYPE_REMOTE_AUDIO});
sdkMeeting.emit(EVENT_MEDIA_STOPPED, {type: MEDIA_TYPE_REMOTE_VIDEO});
} catch (error) {
// eslint-disable-next-line no-console
console.error(`Unable to leave from the meeting "${ID}"`, error);
}
}

/**
Expand Down

0 comments on commit 7539dc2

Please sign in to comment.