Skip to content

Commit

Permalink
feat(MeetingsJsonAdapter): remote addLocalMedia()
Browse files Browse the repository at this point in the history
  • Loading branch information
lalli-flores committed Jan 29, 2020
1 parent 65375ff commit d33d7ce
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
22 changes: 0 additions & 22 deletions src/adapters/MeetingsJSONAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,6 @@ export default class MeetingsJSONAdapter extends MeetingsAdapter {
);
}

/**
* Retrieves the local device media (video/audio) and adds them to the meeting
* with the some default media settings.
* Adding local media is performed as a side-effect and this method does not
* return a value. Instead, adding local media to a meeting should trigger
* getMeeting to emit a new updated Meeting object.
*
* @param {string} ID ID of the meeting for which to add media.
* @memberof MeetingsJSONAdapter
*/
async addLocalMedia(ID) {
if (this.datasource[ID].localVideo) {
// Attach Video stream
await this.getStream({video: true, audio: false});
}

if (this.datasource[ID].localAudio) {
// Attach Audio stream
await this.getStream({video: false, audio: true});
}
}

/**
* Returns a MediaStream object obtained from user local media.
* @param {MediaStreamConstraints} constraints an object specifying the types of the media to request
Expand Down
23 changes: 0 additions & 23 deletions src/adapters/MeetingsJSONAdapter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,29 +141,6 @@ describe('Meetings JSON Adapter', () => {
});
});

describe('addLocalMedia()', () => {
test('attaches local video stream if targeted meeting object requires one', async () => {
meetingsJSONAdapter.getStream = jest.fn();
await meetingsJSONAdapter.addLocalMedia('localVideo');

expect(meetingsJSONAdapter.getStream).toHaveBeenCalledWith({audio: false, video: true});
});

test('attaches local audio stream if targeted meeting object requires one', async () => {
meetingsJSONAdapter.getStream = jest.fn();
await meetingsJSONAdapter.addLocalMedia('localAudio');

expect(meetingsJSONAdapter.getStream).toHaveBeenCalledWith({audio: true, video: false});
});

test('does nothing if neither local audio nor local video are required', async () => {
meetingsJSONAdapter.getStream = jest.fn();
await meetingsJSONAdapter.addLocalMedia('oneOnOneMeeting');

expect(meetingsJSONAdapter.getStream).not.toHaveBeenCalledWith();
});
});

describe('muteAudioControl() returns', () => {
beforeEach(() => {
meetingID = 'localAudio';
Expand Down

0 comments on commit d33d7ce

Please sign in to comment.