agora-rdc-core
Version:
277 lines (276 loc) • 6.54 kB
TypeScript
import { LogLevel } from './logger';
/**
* RDC engine creating options
*/
export interface RDCOptions {
/**
* The App ID issued to you by Agora.
* See [How to get the App ID](https://docs.agora.io/en/Agora%20Platform/token#get-an-app-id).
* Only users in apps with the same App ID can join the same channel and
* communicate with each other.
*/
appId: string;
/**
* The role means whether you control others‘s pc or your pc is controlled by others
*/
role: RDCRoleType;
/**
* Log level, default value is `LogLevel.DEBUG`, Please taking upper than `LogLevel.WARN` level on your production.
*/
logLevel?: LogLevel;
/**
* Tell RDC engine where should store the log file. default value is current directory.
*/
logPath?: string;
}
export interface RDCThresholdOptions {
/**
* Collecting mouse events in `threshold` ms, and sending them all at once, unit: ms,
* default values is 100 ms.
*/
mouseEventsThreshold?: number;
/**
* Collecting keyboard events in `threshold` ms, and sending them all at once, unit: ms,
* default values is 100 ms.
*/
keyboardEventsThreshold?: number;
}
/**
* RDC Role type
*/
export declare enum RDCRoleType {
/**
* Host end
*/
HOST = 1,
/**
* Controlled end
*/
CONTROLLED = 2
}
/**
* The relative location of the region to the screen.
*/
export interface RDCRectangle {
/**
* The horizontal offset from the top-left corner.
*/
x: number;
/**
* The vertical offset from the top-left corner.
*/
y: number;
/**
* The width of the region.
*/
width: number;
/**
* The height of the region.
*/
height: number;
}
/**
* Display's information
*/
export interface RDCDisplay {
/**
* Display's id
*/
id: {
id: number;
} | RDCRectangle | string;
/**
* Display's width
*/
width: number;
/**
* Display's height
*/
height: number;
/**
* Display's preview image, its'a blob url.
*/
thumbnail: string;
}
/**
* Screens stream capturing configuration of display
*/
export interface RDCDisplayConfiguration {
/**
* Width (pixels) of the video.
*/
width: number;
/**
* Height (pixels) of the video.
*/
height: number;
/**
* The bitrate (Kbps) of the shared screen.
*
* The default value is 2000
*/
bitrate: number;
/**
* The framerate (fps) of the shared shared screen.
*
* The default value is 10.
*
*/
frameRate: number;
}
/**
* Remotely pasting status
*/
export declare enum RDCRemotelyPastingStatus {
/**
* Paste content starting.
*/
STARTING = 0,
/**
* Content has been transmitted
*/
TRANSMITTED = 1,
/**
* Content is successfully pasted.
*/
SUCCEEDED = 2,
/**
* Failed to paste content.
*/
FAILED = 3
}
/**
* Remotely pasting codes
*/
export declare enum RDCRemotelyPastingCodes {
/**
* 0: The method call succeeds, or the operation succeeds.
*/
SUCCEEDED = 0,
/**
* 1: Unknown common failure. Please check whether the file exists and whether you can access the file.
*/
FAILURE = 1,
/**
* 3: A timeout occurs. The current timeout is set as 120 seconds. The SDK assumes that a timeout occurs if it has not detected any file transmission between the SDK and the file server for 120 seconds.
*/
TIMEOUT = 3,
/**
* 4: The size of the file or image to upload exceeds 30 MB.
*/
SIZE_OVERFLOW = 4,
/**
* 5: You have exceeded the upper limit for file upload. You can initiate a maximum of nine file upload or download tasks at the same time (upload and download tasks count together).
*/
CONCURRENCY_LIMIT_EXCEEDED = 5,
/**
* 99: when you paste an folder, will throw this.
*/
UNSUPPORTED_FILE_TYPE = 99,
/**
* 101: RDC Engine is not initialized.
*/
NOT_INITIALIZED = 101,
/**
* 102: The user does not call the `join` method.
*/
NOT_LOGGED_IN = 102
}
/**
* Controlled end's platform.
*/
export declare type RDCPlatform = 'android' | 'unknown';
/**
* Actions supported on Android device
*/
export declare enum RDCAndroidAction {
/**
* Back navigation
*/
ACTION_BACK = 64001,
/**
* Home navigation
*/
ACTION_HOME = 64002,
/**
* Recent Apps.
*/
ACTION_RECENT = 64003,
/**
* Notification center
*/
ACTION_NOTIFICATIONS = 64004,
/**
* Quick settings
*/
ACTION_QUICK_SETTINGS = 64005,
/**
* Power off dialog
*/
ACTION_POWER_DIALOG = 64006,
/**
* Toggle Split screen
*/
ACTION_TOGGLE_SPLIT_SCREEN = 64007,
/**
* Lock screen
*/
ACTION_LOCK_SCREEN = 64008,
/**
* Take a screenshot
*/
ACTION_SCREENSHOT = 64009
}
export interface RDCState {
isFocused: boolean;
isDragging: boolean;
cursor: number;
mouseupX: number;
mouseupY: number;
mousedownX: number;
mousedownY: number;
isCompoundAlt: boolean;
isCompoundShift: boolean;
isCompoundCtrl: boolean;
isCompoundMeta: boolean;
preventClick: boolean;
preventTimer: number;
cursorUpdater: (userId: string, code: number) => void;
domEventListeners: {
[key: string]: (...args: any[]) => void;
};
capturedBy: RDCCapturedBy;
renderingElResizeObserver: ResizeObserver;
attachElMutationObserver: MutationObserver;
}
export interface MouseState {
isDragging?: boolean;
mousedownX?: number;
mousedownY?: number;
}
export interface KeyboardState {
isCompoundAlt?: boolean;
isCompoundShift?: boolean;
isCompoundCtrl?: boolean;
}
export interface RDCFocusState {
isFocused: boolean;
cursor: number;
}
export declare type AttachElMutationChange = (userId: string) => MutationCallback;
export declare type RDCCapturedBy = 'agora-webrtc-sdk-ng' | 'agora-electron-sdk';
export declare type RDCMessageEvent = 'captured-by' | 'retrieve-observation' | 'retrieved-observation';
export interface RDCAbstractMessage {
from?: string;
event: RDCMessageEvent;
}
export interface RDCCapturedEndInfo extends RDCAbstractMessage {
capturedBy: RDCCapturedBy;
}
export interface ElectronFile extends File {
path: string;
}
export interface Point {
x: number;
y: number;
}