Skip to content

Commit

Permalink
fix(MeetingsSdkAdapter): correct the state of video/audio control whe…
Browse files Browse the repository at this point in the history
…n permissions are not granted
  • Loading branch information
karinasigartau0798 authored and cipak committed Nov 15, 2021
1 parent ccea2f5 commit 026836a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/MeetingsSDKAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
attachMedia(ID, {type, stream}) {
logger.debug('MEETING', ID, 'attachMedia()', ['called with', {ID, type, stream}]);
const meeting = {...this.meetings[ID]};
const audioTracks = (stream instanceof MediaStream && stream.getAudioTracks()) || [];
const videoTracks = (stream instanceof MediaStream && stream.getVideoTracks()) || [];

switch (type) {
case MEDIA_TYPE_LOCAL:
Expand All @@ -344,11 +346,15 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
// `disableLocalAudio/Video` change inside handle media stream methods
localAudio: {
...meeting.localAudio,
stream: meeting.disabledLocalAudio ? null : new MediaStream(stream.getAudioTracks()),
stream: meeting.disabledLocalAudio || audioTracks.length === 0
? null
: new MediaStream(audioTracks),
},
localVideo: {
...meeting.localVideo,
stream: meeting.disabledLocalVideo ? null : new MediaStream(stream.getVideoTracks()),
stream: meeting.disabledLocalVideo || videoTracks.length === 0
? null
: new MediaStream(videoTracks),
},
};
break;
Expand Down

0 comments on commit 026836a

Please sign in to comment.