# 进阶应用
# 定制化配置
# 1.1 呼叫页面配置
/**
* 设置定制配置参数
*
* @param customConfig 定制化配置参数
*/
setCustomConfig(customConfig: JCallCustomConfig): void;
JCCCommonCustomConfig内部根据不同界面进行分类区分
export class JCCGuestCustomConfig {
public set talkingConfig(value: JCCTalkingConfig);
public set incomingConfig(value: JCCIncomingConfig | undefined);
public set waitingConfig(value: JCCWaitingConfig | undefined);
}
示例代码:
let customConfig: JCCGuestCustomConfig = new JCCGuestCustomConfig();
let waitingConfig: JCCWaitingConfig = new JCCWaitingConfig();
waitingConfig.waitingAudioPath = "path";
waitingConfig.urgent = true;
customConfig.waitingConfig = waitingConfig;
JCCGuestManager.getInstance().setCustomConfig(customConfig);
# 1.2 来电页面配置
export class JCCGuestCustomConfig {
public set talkingConfig(value: JCCTalkingConfig);
public set incomingConfig(value: JCCIncomingConfig | undefined);
public set waitingConfig(value: JCCWaitingConfig | undefined);
}
示例代码:
let customConfig: JCCGuestCustomConfig = new JCCGuestCustomConfig();
let incomingConfig: JCCIncomingConfig = new JCCIncomingConfig();
incomingConfig.incomingAudioPath = "path";
customConfig.incomingAudioPath = incomingConfig;
JCCGuestManager.getInstance().setCustomConfig(customConfig);
# 1.3 通话页面配置
设置定制化配置参数
//定制化按钮显示
export enum JCCToolBarButtons {
JCCEndButton, // 挂断按钮
JCCCameraButton, // 摄像头按钮
JCCMicButton, // 麦克风按钮
JCCSpeakerButton, // 扬声器按钮
JCCFlipButton, // 翻转按钮
JCCScreenShareButton, // 屏幕共享按钮
JCCChatButton, // 文本消息按钮
JCCLocalRecordButton, // 本地录制按钮
JCCCollaborationButton, // 协作共享按钮
JCCRemoteRecordButton //远程录制
}
export class JCCTalkingConfig {
/**
* 设置工具栏背景色
*
* @param toolBarBackground 工具栏背景色,输入格式"#FF000000"
*/
public set toolBarBackground(value: string);
/**
* 设置顶部栏背景色
*
* @param topBarBackground 顶部栏背景色,输入格式"#FF000000"
*/
public set topBarBackground(value: string);
/**
* 设置标题内容
*
* @param title 标题内容
*/
public set title(value: string);
/**
* 设置是否显示统计按钮
*
* @param showStatistic 是否显示统计按钮
*/
public set showStatistic(value: boolean);
/**
* 设置是否显示最小化按钮
*
* @param showMinimized 是否显示最小化按钮
*/
public set showMinimized(value: boolean) ;
/**
* 获取是否显示订阅分辨率按钮
*/
public set showRequestResolution(value: boolean);
//自定义图层开关
public static setCustomLayerView(nodeController: NodeController): NodeController;
/**
* 设置呼叫保持的音乐文件路径
*
* @param heldAudioPath 呼叫保持的音乐文件路径
*/
public set heldAudioPath(value: string);
/**
* 设置对讲模式小视频窗口显示宽度,单位 dp
* @param pipSmallVideoWindowWidth 对讲模式小视频窗口显示宽度
*/
public set pipSmallVideoWindowWidth(value: number);
/**
* 设置对讲模式小视频窗口显示高度,单位 dp
* @param pipSmallVideoWindowHeight 对讲模式小视频窗口显示高度
*/
public set pipSmallVideoWindowHeight(value: number);
/**
* 设置演讲者模式小视频窗口显示宽度,单位 dp
* @param speakSmallVideoWindowWidth 演讲者模式小视频窗口显示宽度
*/
public set speakSmallVideoWindowWidth(value: number);
/**
* 设置演讲者模式小视频窗口显示高度,单位 dp
* @param speakSmallVideoWindowHeight 演讲者模式小视频窗口显示高度
*/
public set speakSmallVideoWindowHeight(value: number);
/**
* 设置JCToolbarButtons配置数组* {@link JCCToolBarButtons}
*
* @param toolBarButtons JCToolbarButtons配置数组,
*/
public set toolBarButtons(value: Array<JCCToolBarButtons>);
}
示例代码:
let customConfig: JCCGuestCustomConfig = new JCCGuestCustomConfig();
let talkingConfig: JCCTalkingConfig = new JCCTalkingConfig();
talkingConfig.title = "title";
...
customConfig.talkingConfig = talkingConfig;
JCCGuestManager.getInstance().setCustomConfig(customConfig);
# 自定义组件
步骤1:创建NodeController对象
示例代码
class Params {
text: string = ""
constructor(text: string) {
this.text = text;
}
}
@Builder
function buildText(params: Params) {
Column() {
Text(params.text)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({ bottom: 36 })
}.width('100%')
.height(100)
.backgroundColor('#FFF0F0F0')
.onClick(() => {
promptAction.showToast({ message: params.text })
})
}
export class TextNodeController extends NodeController {
private textNode: BuilderNode<[Params]> | null = null;
private message: string = "DEFAULT";
constructor(message: string) {
super();
this.message = message;
}
makeNode(context: UIContext): FrameNode | null {
this.textNode = new BuilderNode(context);
this.textNode.build(wrapBuilder<[Params]>(buildText), new Params(this.message))
return this.textNode.getFrameNode();
}
}
步骤二:加载到定制化配置中
示例代码
let customConfig = new JCCGuestCustomConfig();
let talkConfig = new JCCTalkingConfig();
talkConfig.customView = new TextNodeController("自定义组件");
customConfig.talkingConfig = talkConfig;
JCCGuestManager.getInstance().setCustomConfig(customConfig);
