agora-classroom-sdk
Version:
For publishing npm package agora-classroom-sdk (Web & Electron). Get more information from https://docs.agora.io
300 lines (299 loc) • 7.36 kB
TypeScript
import { AGBeautyEffect, AgoraRteMediaSourceState } from 'agora-rte-sdk';
import { EduUIStoreBase } from '../base';
import { BeautyType } from 'agora-edu-core';
import { CameraPlaceholderType } from '../stream/struct';
export declare type PretestToast = {
id: string;
type: 'video' | 'audio_recording' | 'audio_playback' | 'error';
info: string;
};
declare type AddToastArgs = Omit<PretestToast, 'id'>;
declare type EffectType = 'beauty' | 'virtualBackground';
declare type DeviceType = 'audio' | 'video';
export declare class PretestUIStore extends EduUIStoreBase {
private _disposers;
currentEffectType: EffectType;
beautyEffectOptions: AGBeautyEffect;
currentPretestTab: DeviceType | 'stage';
aiDenoiserEnabled: boolean;
backgroundImage: never[];
currentVirtualBackground: string;
private _virtualBackgroundProcessor?;
private _beautyEffectProcessor?;
private _aiDenoiserProcessor?;
private _virtualBackgroundProcessorForPreview?;
private _beautyEffectProcessorForPreview?;
private _aiDenoiserProcessorForPreview?;
onInstall(): void;
get virtualBackgroundSupported(): boolean;
get beautySupported(): boolean;
get aiDenoiserSupported(): boolean;
/**
* 交互事件通知
* @param type
*/
private _handleInteractionEvents;
private _timer;
/**
* Toast 消息列表
*/
toastQueue: PretestToast[];
/**
* 美颜类型
*/
activeBeautyType: BeautyType | 'none';
/**
* 是否正在测试扬声器
*/
playbackTesting: boolean;
/**
* 视频消息 Toast 列表
* @returns
*/
get videoToastQueue(): PretestToast[];
/**
* 扬声器消息 Toast 列表
* @returns
*/
get audioPlaybackToastQueue(): PretestToast[];
/**
* 麦克风消息 Toast 列表
* @returns
*/
get audioRecordingToastQueue(): PretestToast[];
/**
* 错误消息 Toast 列表
* @returns
*/
get errorToastQueue(): PretestToast[];
/**
* 摄像头设备列表
* @returns
*/
get cameraDevicesList(): {
label: string;
value: string;
}[];
/**
* 麦克风设备列表
* @returns
*/
get recordingDevicesList(): {
label: string;
value: string;
}[];
/**
* 扬声器设备列表
* @returns
*/
get playbackDevicesList(): {
label: string;
value: string;
}[];
/**
* 当前摄像头设备ID
* @returns
*/
get currentCameraDeviceId(): string;
/**
* 当前麦克风设备ID
* @returns
*/
get currentRecordingDeviceId(): string;
/**
* 当前扬声器设备ID
* @returns
*/
get currentPlaybackDeviceId(): string;
/**
* 麦克风音量
* @returns 音量 0 ~ 1
*/
get localVolume(): number;
/**
* 本地音量(设备检测)
* @returns
*/
get localPreviewVolume(): number;
/**
* 扬声器测试音量
* @returns 音量 0 ~ 1
*/
get localPlaybackTestVolume(): number;
/**
* 本地摄像头设备状态
* @returns
*/
get localCameraTrackState(): AgoraRteMediaSourceState;
/**
* 本地麦克风设备状态
* @returns
*/
get localMicTrackState(): AgoraRteMediaSourceState;
/**
* 本地摄像头设备状态(设备检测)
* @returns
*/
get localPreviewCameraTrackState(): AgoraRteMediaSourceState;
/**
* 本地摄像头是否开启
* @returns
*/
get localCameraOff(): boolean;
/**
* 本地麦克风设备是否开启
* @returns
*/
get localMicOff(): boolean;
/**
* 本地摄像头是否开启(设备检测)
*/
get localPreviewCameraOff(): boolean;
/**
* 本地音频设备状态显示的 Icon 类型
* microphone-off 麦克风开启
* microphone-on 麦克风关闭
* @returns Icon 类型
*/
get localMicIconType(): "microphone-on" | "microphone-off";
/**
* 本地视频状态显示的占位符类型
* @returns
*/
get localCameraPlaceholder(): CameraPlaceholderType;
/**
* 本地视频状态显示的占位符类型(设备检测)
* @returns
*/
get localPreviewCameraPlaceholder(): CameraPlaceholderType;
/**
* @ignore
*/
get disable(): boolean;
/**
* 是否开启镜像
* @returns
*/
get isMirror(): boolean;
/**
* 美白参数 (0 ~ 100)
* @returns
*/
get whiteningValue(): number;
/**
* 红润参数 (0 ~ 100)
* @returns
*/
get ruddyValue(): number;
/**
* 磨皮参数 (0 ~ 100)
* @returns
*/
get buffingValue(): number;
/**
* 美颜调整参数类型
* @returns
*/
get activeBeautyValue(): number;
/**
* 显示 Toast 信息
* @param toast
*/
addToast(toast: AddToastArgs): void;
/**
* 移除 Toast 信息
* @param id
* @returns
*/
removeToast(id: string): string;
/**
* 设置镜像开启或关闭
* @param v 开启或关闭
*/
setMirror(v: boolean): void;
/**
* 开始扬声器测试
* @param url
*/
startPlaybackDeviceTest(url: string): void;
/**
* 停止扬声器测试
*/
stopPlaybackDeviceTest(): void;
/**
* 开始麦克风测试
*/
startRecordingDeviceTest(): void;
/**
* 停止麦克风测试
*/
stopRecordingDeviceTest(): void;
/**
* 打开本地摄像头
* @param value 开启或关闭
*/
enableLocalVideo(value: boolean): void;
/**
* 打开本地麦克风
* @param value 开启或关闭
*/
enableLocalAudio(value: boolean): void;
/**
* 设置当前使用摄像头设备
* @param id
*/
setCameraDevice(id: string): void;
/**
* 设置当前使用麦克风设备
* @param id
*/
setRecordingDevice(id: string): void;
/**
* 设置美颜类型
* @param value
*/
setActiveBeautyType(value: BeautyType | 'none'): void;
/**
* 设置美颜参数
* @param value (0 ~ 100)
*/
setActiveBeautyValue(value: number): void;
/**
* 设置当前使用扬声器设备
* @param id
*/
setPlaybackDevice(id: string): void;
/**
* 渲染本地视频
* @param dom
* @param mirror
*/
setupLocalVideo(dom: HTMLElement, mirror: boolean): void;
/**
* 设置单当前效果tab
*/
setCurrentEffectOption(type: EffectType): void;
setCurrentTab(type: DeviceType | 'stage'): void;
handleBackgroundChange(key: string, value?: {
type: 'img';
url: string;
} | {
type: 'video';
url: string;
}): void;
setAIDenoiser(enable: boolean): void;
setVirtualBackground({ type, source, }: {
type: 'img';
source: HTMLImageElement;
} | {
type: 'video';
source: HTMLVideoElement;
}): void;
startCameraPreview(): void;
stopCameraPreview(): void;
startAudioRecordingPreview(): void;
stopAudioRecordingPreview(): void;
setupLocalVideoPreview(dom: HTMLElement, mirror: boolean): void;
onDestroy(): void;
}
export {};