Skip to content

Commit

Permalink
feat: getMicrophones and getPlaybackDevices
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Aug 7, 2024
1 parent 4f547e9 commit 90d632e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.addMissingImports": true
"source.fixAll": "explicit",
"source.addMissingImports": "explicit"
},
"prettier.enable": true,
"cSpell.enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoraio-extensions/agora-rtc-sdk-ng-fake",
"version": "1.0.12",
"version": "1.0.13",
"private": true,
"description": "Fake Agora Web RTC for testing",
"repository": {
Expand Down
36 changes: 27 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export * from "./client";
export * from "./version";

export const FAKE_VIDEOINPUT_DEVICE_ID = "1";
export const FAKE_PLAYBACKINPUT_DEVICE_ID = "2";
export const FAKE_RECORDINGINPUT_DEVICE_ID = "3";

const FakeAgoraRTC = createFakeAgoraRTC({
setAppType(): void {
Expand All @@ -33,32 +35,48 @@ const FakeAgoraRTC = createFakeAgoraRTC({
//
},
getCameras(): Promise<MediaDeviceInfo[]> {
//todo
return Promise.resolve([
{
kind: "videoinput",
deviceId: "1",
label: "1",
deviceId: FAKE_VIDEOINPUT_DEVICE_ID,
label: FAKE_VIDEOINPUT_DEVICE_ID,
},
] as MediaDeviceInfo[]);
},
getMicrophones(): Promise<MediaDeviceInfo[]> {
return Promise.resolve([
{
kind: "audioinput",
deviceId: FAKE_RECORDINGINPUT_DEVICE_ID,
label: FAKE_RECORDINGINPUT_DEVICE_ID,
},
] as MediaDeviceInfo[]);
},
getPlaybackDevices(): Promise<MediaDeviceInfo[]> {
return Promise.resolve([
{
kind: "audiooutput",
deviceId: FAKE_PLAYBACKINPUT_DEVICE_ID,
label: FAKE_PLAYBACKINPUT_DEVICE_ID,
},
] as MediaDeviceInfo[]);
},
getDevices(): Promise<MediaDeviceInfo[]> {
//todo
return Promise.resolve([
{
kind: "videoinput",
deviceId: FAKE_VIDEOINPUT_DEVICE_ID,
label: "1",
label: FAKE_VIDEOINPUT_DEVICE_ID,
},
{
kind: "audiooutput",
deviceId: "2",
label: "2",
deviceId: FAKE_PLAYBACKINPUT_DEVICE_ID,
label: FAKE_PLAYBACKINPUT_DEVICE_ID,
},
{
kind: "audioinput",
deviceId: "3",
label: "3",
deviceId: FAKE_RECORDINGINPUT_DEVICE_ID,
label: FAKE_RECORDINGINPUT_DEVICE_ID,
},
] as MediaDeviceInfo[]);
},
Expand Down

0 comments on commit 90d632e

Please sign in to comment.