@openreplay/tracker-assist
Version:
Tracker plugin for screen assistance through the WebRTC
75 lines (74 loc) • 2.62 kB
TypeScript
import type { Properties } from "csstype";
import { App } from "@openreplay/tracker";
import type { Options as ConfirmOptions } from "./ConfirmWindow/defaults.js";
type StartEndCallback = (agentInfo?: Record<string, any>) => (() => any) | void;
export interface Options {
onAgentConnect: StartEndCallback;
onCallStart: StartEndCallback;
onRemoteControlStart: StartEndCallback;
onRecordingRequest?: (agentInfo: Record<string, any>) => any;
onCallDeny?: () => any;
onRemoteControlDeny?: (agentInfo: Record<string, any>) => any;
onRecordingDeny?: (agentInfo: Record<string, any>) => any;
onDragCamera?: (dx: number, dy: number) => void;
session_calling_peer_key: string;
session_control_peer_key: string;
callConfirm: ConfirmOptions;
controlConfirm: ConfirmOptions;
recordingConfirm: ConfirmOptions;
socketHost?: string;
confirmText?: string;
confirmStyle?: Properties;
serverURL: string;
callUITemplate?: string;
compressionEnabled: boolean;
/**
* Minimum amount of messages in a batch to trigger compression run
* @default 5000
*/
compressionMinBatchSize: number;
}
export default class Assist {
private readonly app;
private readonly noSecureMode;
readonly version = "11.0.8";
private socket;
private calls;
private canvasPeers;
private canvasNodeCheckers;
private assistDemandedRestart;
private callingState;
private remoteControl;
private peerReconnectTimeout;
private agents;
private config;
private readonly options;
private readonly canvasMap;
private iceCandidatesBuffer;
constructor(app: App, options?: Partial<Options>, noSecureMode?: boolean);
private emit;
private get agentsConnected();
private readonly setCallingState;
private getHost;
private getBasePrefixUrl;
private onStart;
private setupPeerListeners;
private playNotificationSound;
private clean;
private cleanCanvasConnections;
private stopCanvasStream;
private applyBufferedIceCandidates;
}
export {};
/** simple peers impl
* const slPeer = new SLPeer({ initiator: true, stream: stream, })
* // slPeer.on('signal', (data: any) => {
* // this.emit('c_signal', { data, id, })
* // })
* // this.socket?.on('c_signal', (tab: string, data: any) => {
* // console.log(data)
* // slPeer.signal(data)
* // })
* // slPeer.on('error', console.error)
* // this.emit('canvas_stream', { canvasId, })
* */