From 0fc344b72e08533677b745ca21386c59e690f74c Mon Sep 17 00:00:00 2001 From: guoxianzhe <53285945+guoxianzhe@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:57:51 +0800 Subject: [PATCH] feat: add startProcessAudioBuffer stopProcessAudioBuffer (#11) --- package.json | 2 +- src/index.ts | 28 ++++++++++++++++++++++++++-- src/tracks/local-audio-track.ts | 8 ++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 92972ad..951c5fb 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/index.ts b/src/index.ts index ea44f4d..5d933c6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 { // @@ -29,11 +31,33 @@ const FakeAgoraRTC = createFakeAgoraRTC({ }, getCameras(): Promise { //todo - return Promise.resolve([]); + return Promise.resolve([ + { + kind: "videoinput", + deviceId: "1", + label: "1", + }, + ] as MediaDeviceInfo[]); }, getDevices(): Promise { //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(), diff --git a/src/tracks/local-audio-track.ts b/src/tracks/local-audio-track.ts index c2be965..d505209 100644 --- a/src/tracks/local-audio-track.ts +++ b/src/tracks/local-audio-track.ts @@ -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; }