diff --git a/package.json b/package.json index 1c9e6b4..92972ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@agoraio-extensions/agora-rtc-sdk-ng-fake", - "version": "1.0.4", + "version": "1.0.5", "private": true, "description": "Fake Agora Web RTC for testing", "repository": { diff --git a/src/client.ts b/src/client.ts index 9a7611d..8ee86f9 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,5 +1,6 @@ import { randNumber, randUuid } from "@ngneat/falso"; import type { + ClientRole, IAgoraRTCClient, IAgoraRTCRemoteUser, IRemoteAudioTrack, @@ -13,8 +14,13 @@ import { FakeAgoraEventEmitter } from "./eventemitter"; import { FakeRemoteAudioTrack, FakeRemoteVideoTrack } from "./tracks"; import { hideProperties } from "./utils"; +export const FAKE_CHANNEL_NAME = "AGORA-RTC-SDK-NG-FAKE-CHANNEL"; + export class FakeRTCClient extends FakeAgoraEventEmitter { remoteUsers: IAgoraRTCRemoteUser[] = []; + uid?: UID; + channelName?: string; + role?: ClientRole; public static create( executor?: Partial | ((client: FakeRTCClient) => Partial), @@ -129,10 +135,39 @@ export class FakeRTCClient extends FakeAgoraEventEmitter { } public join(): Promise { - return Promise.resolve(randUuid()); + this.uid = randUuid(); + this.channelName = FAKE_CHANNEL_NAME; + return Promise.resolve(this.uid); + } + + public async publish(): Promise { + return Promise.resolve(); + } + + public async unpublish(): Promise { + return Promise.resolve(); } public leave(): Promise { + this.uid = undefined; + this.channelName = undefined; return Promise.resolve(); } + + public setClientRole(): Promise { + this.role = "host"; + return Promise.resolve(); + } + + public renewToken(): Promise { + return Promise.resolve(); + } + + public getLocalAudioStats(): void { + // + } + + public getRemoteAudioStats(): void { + // + } } diff --git a/src/tracks/local-video-track.ts b/src/tracks/local-video-track.ts index d53c461..3e5f932 100644 --- a/src/tracks/local-video-track.ts +++ b/src/tracks/local-video-track.ts @@ -72,6 +72,10 @@ export class FakeLocalVideoTrack extends FakeLocalTrack { } } + public setEncoderConfiguration(): Promise { + return Promise.resolve(); + } + protected _config?: VideoPlayerConfig; protected _videoEl?: HTMLVideoElement; }