Skip to content

Commit

Permalink
fix(flat-rtc): add test avatar (#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx authored Jun 28, 2022
1 parent 1b9f817 commit 201bcf7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ export class FlatRTCAgoraElectron extends FlatRTC<
return remoteAvatar;
}

public getTestAvatar(): FlatRTCAvatar {
return this.localAvatar;
}

public getVolumeLevel(uid?: FlatRTCAgoraElectronUIDType): number {
return this._volumeLevels.get(uid || 0) || 0;
}
Expand Down
4 changes: 4 additions & 0 deletions services/rtc/flat-rtc-agora-web/src/flat-rtc-agora-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ export class FlatRTCAgoraWeb extends FlatRTC<FlatRTCAgoraWebUIDType> {
return remoteAvatar;
}

public getTestAvatar(): FlatRTCAvatar {
return this.localAvatar;
}

public getVolumeLevel(uid?: FlatRTCAgoraWebUIDType): number {
if (!uid || this.uid === uid) {
return this._localAvatar?.getVolumeLevel() ?? 0;
Expand Down
3 changes: 3 additions & 0 deletions services/rtc/flat-rtc/src/rtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export abstract class FlatRTC<

/** @returns local avatar if uid is not provided, throws error if uid == shareScreenUID */
public abstract getAvatar(uid?: TUid): FlatRTCAvatar | undefined;

public abstract getTestAvatar(): FlatRTCAvatar;

public abstract getVolumeLevel(uid?: TUid): number;

public abstract setCameraID(deviceId: string): Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion web/flat-web/src/pages/DevicesTestPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const DevicesTestPage = observer(function DeviceTestPage() {

useEffect(() => {
// @FIXME only run once
const avatar = rtc.getAvatar();
const avatar = rtc.getTestAvatar();
if (avatar) {
avatar.enableCamera(true);
avatar.enableMic(true);
Expand Down

0 comments on commit 201bcf7

Please sign in to comment.