@cometchat/calls-sdk-javascript
Version:
Cometchat's Javascript SDK for In-app Calling.
383 lines (382 loc) • 14.7 kB
TypeScript
import { ICallsettings } from "../types";
import { OngoingCallListener } from "./Listener";
export declare class CallSettings {
static POSITION_TOP_LEFT: string;
static POSITION_TOP_RIGHT: string;
static POSITION_BOTTOM_LEFT: string;
static POSITION_BOTTOM_RIGHT: string;
static POSITION: {
readonly TOP_LEFT: "top-left";
readonly TOP_RIGHT: "top-right";
readonly BOTTOM_LEFT: "bottom-left";
readonly BOTTOM_RIGHT: "bottom-right";
};
static ASPECT_RATIO_DEFAULT: string;
static ASPECT_RATIO_CONTAIN: string;
static ASPECT_RATIO_COVER: string;
static ASPECT_RATIO: {
readonly DEFAULT: "default";
readonly CONTAIN: "contain";
readonly COVER: "cover";
};
private defaultLayout;
private isAudioOnly;
private mode;
private ShowEndCallButton;
private ShowMuteAudioButton;
private ShowPauseVideoButton;
private ShowScreenShareButton;
private ShowSwitchModeButton;
private StartAudioMuted;
private StartVideoMuted;
private localizedObject;
private analyticsSettings;
private customCSS;
private ShowRecordingButton;
private StartRecordingOnCallStart;
private callListener;
private ShowSwitchToVideoCallButton;
private VirtualBackground;
private ShowVirtualBackgroundSetting;
private MainVideoContainerSetting;
constructor(builder?: CallSettingsBuilder);
getCallListener(): OngoingCallListener;
isRecordingButtonEnabled(): boolean;
shouldStartRecordingOnCallStart(): boolean;
getCustomCSS(): string;
isAudioOnlyCall(): boolean;
isDefaultLayoutEnabled(): boolean;
getMode(): "DEFAULT" | "SPOTLIGHT" | "TILE";
getStartWithAudioMuted(): boolean;
getStartWithVideoMuted(): boolean;
isEndCallButtonEnabled(): boolean;
isMuteAudioButtonEnabled(): boolean;
isPauseVideoButtonEnabled(): boolean;
isScreenShareButtonEnabled(): boolean;
isModeButtonEnabled(): boolean;
getLocalizedStringObject(): Object;
getAnalyticsSettings(): Object;
isAudioToVideoButtonEnabled(): boolean;
getVirtualBackground(): VirtualBackground;
isVirtualBackgroundSettingEnabled(): boolean;
getMainVideoContainerSetting(): MainVideoContainerSetting;
}
export declare class CallSettingsBuilder {
/** @private */ defaultLayout: boolean;
/** @private */ isAudioOnly: boolean;
/** @private */ mode: ICallsettings["mode"];
/** @private */ ShowEndCallButton: boolean;
/** @private */ ShowMuteAudioButton: boolean;
/** @private */ ShowPauseVideoButton: boolean;
/** @private */ ShowScreenShareButton: boolean;
/** @private */ ShowSwitchModeButton: boolean;
/** @private */ StartAudioMuted: boolean;
/** @private */ StartVideoMuted: boolean;
/** @private */ localizedObject: Object;
/** @private */ analyticsSettings: Object;
/** @private */ customCSS: string;
/** @private */ ShowRecordingButton: boolean;
/** @private */ StartRecordingOnCallStart: boolean;
/** @private */ ShowSwitchToVideoCallButton: boolean;
/** @private */ virtualBackground: VirtualBackground;
/** @private */ ShowVirtualBackgroundSetting: boolean;
/** @private */ MainVideoContainerSetting: MainVideoContainerSetting;
/** @private */ callListener: OngoingCallListener;
/**
*
* @param {boolean} defaultLayout
* This methods shows/hides the default button layout.
* If set to true the default button layout will be shown.
* If set to false the default button layout will be hidden.
* Default value is true
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
enableDefaultLayout(defaultLayout: boolean): this;
/**
*
* @param {boolean} isAudioOnly
* This methods sets the type(audio/video) of the call.
* If set to true, the call will be strictly an audio call.
* If set to false, the call will be an audio-video call.
* Default value is false
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
setIsAudioOnlyCall(isAudioOnly: boolean): this;
/**
*
* @param {string} mode
* This method sets the mode of the call.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
setMode(mode: ICallsettings["mode"]): this;
/**
*
* @param {boolean} showEndCallButton
* This method shows/hides the end call button.
* If set to true it will display the end call button.
* If set to false it will hide the end call button.
* Default value is true.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
showEndCallButton(showEndCallButton: boolean): this;
/**
*
* @param {boolean} showMuteAudioButton
* This method shows/hides the mute audio button.
* If set to true it will display the mute audio button.
* If set to false it will hide the mute audio button.
* Default value is true.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
showMuteAudioButton(showMuteAudioButton: boolean): this;
/**
*
* @param {boolean} showPauseVideoButton
* This method shows/hides the pause video button.
* If set to true it will display the pause video button.
* If set to false it will hide the pause video button.
* Default value is true.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
showPauseVideoButton(showPauseVideoButton: boolean): this;
/**
*
* @param {boolean} showScreenShareButton
* This method shows/hides the screen share button.
* If set to true it will display the screen share button.
* If set to false it will hide the screen share button.
* Default value is true.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
showScreenShareButton(showScreenShareButton: boolean): this;
/**
*
* @param {boolean} showModeButton
* This method shows/hides the switch mode button.
* If set to true it will display the switch mode button.
* If set to false it will hide the switch mode button.
* Default value is true.
* @returns
*/
showModeButton(showModeButton: boolean): this;
/**
*
* @param {Object} localizedStringObject
* This method will set the localized text in the call screen.
* @returns
*/
setLocalizedStringObject(localizedStringObject: Object): this;
/**
* @private
* @param {Object} analyticsSettings
* This method will set the settings required for analytics.
* @returns
*/
setAnalyticsSettings(analyticsSettings: Object): this;
/**
*
* @param {boolean} audioMuted
* This method allows the call to be started with audio muted.
* If set to true, the call will start with audio muted.
* Default value is false.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
startWithAudioMuted(audioMuted: boolean): this;
/**
*
* @param {boolean} videoMuted
* This method allows the call to be started with video muted.
* If set to true, the call will start with video muted.
* Default value is false.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
startWithVideoMuted(videoMuted: boolean): this;
/**
*
* @param {boolean} showRecordingButton
* This method shows/hides the recording button.
* If set to true it will display the recording button.
* If set to false it will hide the recording button.
* Default value is false.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
showRecordingButton(showRecordingButton: boolean): this;
/**
*
* @param {boolean} startRecordingOnCallStart
* This method starts the recording as soon as the call start.
* If set to true it will start the recording as soon as the call start.
* Default value is false.
* @returns {CallSettingsBuilder} Returns the CallSettingsBuilder instance
*/
startRecordingOnCallStart(startRecordingOnCallStart: boolean): this;
/**
*
* @param {boolean} showAudioToVideoSwitchButton
* This method shows/hides the switch to video call button.
* If set to true it will display the switch to video call button.
* If set to false it will hide the switch to video call button.
* Default value is true.
* @returns
*/
showSwitchToVideoCallButton(showAudioToVideoSwitchButton: boolean): this;
/**
*
* @param {VirtualBackground} virtualBackground
* This method will set the virtual background setting.
* This methods takes an Object of VirtualBackground Class.
* @returns
*/
setVirtualBackground(virtualBackground: VirtualBackground): this;
/**
*
* @param {boolean} showVirtualBackgroundSetting
* This method shows/hides the virtual background setting button.
* If set to true it will display the virtual background setting button.
* If set to false it will hide the virtual background setting button.
* Default value is true.
* @returns
*/
showVirtualBackgroundSetting(showVirtualBackgroundSetting: boolean): this;
/**
*
* @param {MainVideoContainerSetting} mainVideoContainerSetting
* This method can be used to customize the main video container.
* @returns
*/
setMainVideoContainerSetting(mainVideoContainerSetting: MainVideoContainerSetting): this;
/**
*
* @param {OngoingCallListener} callListener
* This method can be used to subscribe to available callings events
* @returns
*/
setCallListener(callListener: OngoingCallListener): this;
/**
* This method will return an object of the CallSettings class.
* @returns {CallSettings} Returns the CallSettings instance
*/
build(): CallSettings;
}
export declare class VirtualBackground {
private AllowBackgroundBlur;
private AllowUserImages;
private ShowDefaultImages;
private SetImages;
private EnforceBackgroundBlur;
private EnforceBackgroundImage;
constructor(builder?: VirtualBackgroundBuilder);
shouldAllowBackgroundBlur(): boolean;
shouldAllowUserImages(): boolean;
shouldShowDefaultImages(): boolean;
getImages(): Array<String>;
isBackgroundBlurEnforced(): number;
getEnforcedBackgroundImage(): string;
}
export declare class VirtualBackgroundBuilder {
/** @private */ AllowBackgroundBlur: boolean;
/** @private */ AllowUserImages: boolean;
/** @private */ ShowDefaultImages: boolean;
/** @private */ SetImages: string[];
/** @private */ EnforceBackgroundBlur: number;
/** @private */ EnforceBackgroundImage: string;
/**
*
* @param {boolean} AllowBackgroundBlur
* This method will show the background blur option in Virtual Background.
* If set to true it will show the background blur option.
* Default value is true.
* @returns
*/
allowBackgroundBlur(AllowBackgroundBlur: boolean): this;
/**
*
* @param {boolean} AllowUserImage
* This method will allow the user to add custom images as background.
* If set to true it will allow the user to add custom images as background.
* Default value is true.
* @returns
*/
allowUserImages(AllowUserImages: boolean): this;
/**
*
* @param {boolean} ShowDefaultImages
* This method will show the default images to be used as background.
* If set to true it will show the default images to be used as background.
* Default value is true.
* @returns
*/
showDefaultImages(ShowDefaultImages: boolean): this;
/**
*
* @param {boolean} SetImages
* This method will allow user to add custom Images to be used as background. It takes in an array of URLs.
* @returns
*/
setImages(SetImages: string[]): this;
/**
*
* @param {number} EnforceBackgroundBlur
* This method will enforce background blur.
* This method takes number as input which decides the blur level of the background.
* Default value is 0.
* @returns
*/
enforceBackgroundBlur(EnforceBackgroundBlur: number): this;
/**
*
* @param {string} EnforceBackgroundImage
* This method will enforce background image.
* If an URL of the image is sent then that image will be set as background.
* By default no image is set.
* @returns
*/
enforceBackgroundImage(EnforceBackgroundImage: string): this;
/**
* This method will return an object of the VirtualBackground class.
* @returns {VirtualBackground}
*/
build(): VirtualBackground;
}
export declare class MainVideoContainerSetting {
private videoFit;
private zoomButton;
private nameLabel;
private network;
/**
*
* @param {string} mainVideoAspectRatio
* This method is used to set the aspect ratio of main video.
* The default value is `contain`
* @returns
*/
setMainVideoAspectRatio(mainVideoAspectRatio: typeof CallSettings.ASPECT_RATIO[keyof typeof CallSettings.ASPECT_RATIO]): void;
/**
*
* @param {string} position
* @param {boolean} visibility
* This method is used to set the position & visibility parameter of the full screen button.
* By default the full screen button is visible in the `bottom-right` position.
* @returns
*/
setFullScreenButtonParams(position: typeof CallSettings.POSITION[keyof typeof CallSettings.POSITION], visibility: boolean): void;
/**
*
* @param {string} position
* @param {boolean} visibility
* @param {string} backgroundColor
* This method is used to set the position, visibility & background color of the name label.
* By default the name label is visible in the `bottom-left` position with a background-color `rgba(27, 27, 27, 0.4)`
* @returns
*/
setNameLabelParams(position: typeof CallSettings.POSITION[keyof typeof CallSettings.POSITION], visibility: boolean, backgroundColor: string): void;
/**
*
* @param {string} position
* @param {boolean} visibility
* This method is used to set the position, visibility of the network label.
* By default the network label is visible in the `bottom-right` position.
* @returns
*/
setNetworkLabelParams(position: typeof CallSettings.POSITION[keyof typeof CallSettings.POSITION], visibility: boolean): void;
}