Skip to content

Commit

Permalink
feat: add startProcessAudioBuffer stopProcessAudioBuffer (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Oct 23, 2023
1 parent c3ba456 commit 0fc344b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
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.5",
"version": "1.0.6",
"private": true,
"description": "Fake Agora Web RTC for testing",
"repository": {
Expand Down
28 changes: 26 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export * from "./eventemitter";
export * from "./client";
export * from "./version";

export const FAKE_VIDEOINPUT_DEVICE_ID = "1";

const FakeAgoraRTC = createFakeAgoraRTC({
setAppType(): void {
//
Expand All @@ -29,11 +31,33 @@ const FakeAgoraRTC = createFakeAgoraRTC({
},
getCameras(): Promise<MediaDeviceInfo[]> {
//todo
return Promise.resolve([]);
return Promise.resolve([
{
kind: "videoinput",
deviceId: "1",
label: "1",
},
] as MediaDeviceInfo[]);
},
getDevices(): Promise<MediaDeviceInfo[]> {
//todo
return Promise.resolve([]);
return Promise.resolve([
{
kind: "videoinput",
deviceId: FAKE_VIDEOINPUT_DEVICE_ID,
label: "1",
},
{
kind: "audiooutput",
deviceId: "2",
label: "2",
},
{
kind: "audioinput",
deviceId: "3",
label: "3",
},
] as MediaDeviceInfo[]);
},
createMicrophoneAudioTrack: async () => FakeMicrophoneAudioTrack.create(),
createCameraVideoTrack: async () => FakeCameraVideoTrack.create(),
Expand Down
8 changes: 8 additions & 0 deletions src/tracks/local-audio-track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ export class FakeLocalAudioTrack extends FakeLocalTrack {
console.log("[FakeLocalAudioTrack]: setPlaybackDevice", deviceId);
}

public startProcessAudioBuffer(): void {
//
}

public stopProcessAudioBuffer(): void {
//
}

private _audioEl?: HTMLAudioElement;
private _volume: number;
}

0 comments on commit 0fc344b

Please sign in to comment.