import { Call } from "../../models/call.model"; import { Service } from '../../services/service'; import { Subscription } from 'rxjs'; import { FileDescriptor } from '../../models/common'; import { CallServiceRB } from './call.service'; import { FileDocumentServiceRB } from '../fileDocument/fileDocument.service'; export declare const CALL_RECORDER_SVC = "CallRecorderService"; export declare enum CallRecorderServiceEvents { /** * @eventProperty * The recording is in progress. */ RECORDING_IS_IN_PROGRESS = "recordingInProgress", /** * @eventProperty * The recording is available in storage. */ RECORDING_IS_AVAILABLE_IN_STORAGE = "recordingIsAvailableInStorage", /** * @eventProperty * The recording is saved on pc. */ RECORDING_SAVED_ON_PC = "recordingSavedOnPc" } export interface CallRecorderInstance { /** * The id of the CallRecorderInstance. */ id: string; /** * This 'mediaRecorder' is the MediaRecorder instance used to record the call. * It is created when the recording starts and used to manage the recording process. */ mediaRecorder?: MediaRecorder; /** * This 'audioContext' is the AudioContext instance used to manage audio processing. * It is created when the recording starts and used to handle audio streams. */ audioContext: AudioContext; /** * This 'subscriptions' is an array of subscriptions used to manage the lifecycle of the call recorder instance. */ subscriptions?: Subscription[]; /** * This 'data' is the Blob instance that contains the recorded data. */ data?: Blob; /** * This 'duration' is the duration of the recording in seconds. */ duration?: number; /** * This 'durationTimer' is a subscription that manages the duration of the recording. */ durationTimer?: Subscription; /** * This 'fileName' is the name of the file that will be created for the recording. */ fileName?: string; /** * This 'backupFileDescriptor' is the FileDescriptor instance that contains the backup file information. */ backupFileDescriptor?: FileDescriptor; /******************* * DESKTOP APP ONLY ********************/ /** * This 'fullPathUrl' is the full path URL of the file where the recording will be saved. * It is used in the desktop application to save the file locally. */ fullPathUrl?: string; /** * This 'inputPeerConnection' is the RTCPeerConnection instance used to manage the input stream of the call. */ inputPeerConnection?: RTCPeerConnection; /** * This 'ouputPeerConnection' is the RTCPeerConnection instance used to manage the output stream of the call. */ ouputPeerConnection?: RTCPeerConnection; } /** * The CallRecorderService class contains the methods and their implementations required for recording. */ export declare class CallRecorderService extends Service { callService: CallServiceRB; fileDocumentService: FileDocumentServiceRB; private conversationService; private xmppService; private fileStorageService; private fileServerService; private errorHelperService; private logger; private mainService; private contactService; private webrtcP2PServce; private centralizedService; private rxSubject; private recorders; private blankVideoTrack; private blankVideoTrackInterval; private blankVideoStream; private videoElement; private canvasElement; static getInstance(): CallRecorderService; static build(): CallRecorderService; protected constructor(); start(): Promise; stop(): Promise; sendEvent(name: CallRecorderServiceEvents): void; subscribe(handler: any): Subscription; /** * This API allows the user to start e recording of the current call. * @param callToRecord - The call to record */ startRecording(callToRecord: Call): Promise; /** * This method builds the local peer connection for the call recording. * @param recorderInstance - The CallRecorderInstance containing the recording data. * @param session - The JingleSession for the call. * @param addVideo - Whether to add video to the recording. * @param secondSession - The second JingleSession for the call, if applicable. */ private buildLocalPeerConnection; /** * This API allows the user to stop the recording of the current call. * @param callToRecord - The call to record */ stopRecording(callToRecord: Call): Promise; /** * This API allows the user to pause the recording of the current call. * @param callToRecord - The call to record */ pauseRecording(callToRecord: Call): void; /** * This API allows the user to resume the recording of the current call. * @param callToRecord - The call to record */ resumeRecording(callToRecord: Call): void; /** * This API allows the user to cancel the recording. * It means that you can stop a recording without saving the recording file. * @param callToRecord - The call to record */ cancelRecording(callToRecord: Call): void; /** * This API allows the user to get the recording duration. * @param callToRecord - The call that will be recorded. */ getRecordingDuration(callToRecord: Call): number; /** * This method adds listeners for the call events. * @param call - The call for which to add listeners. * @param secondCall - The second call for which to add listeners, if applicable. */ private addListenersForCall; /** * This method creates a black video track for the call recording. * @param blob - The Blob to convert to a file. * @param recorderInstance - The CallRecorderInstance containing the recording data. */ private onCreateFileFromBlobForSafari; /** * This method retrieves or creates a video track for the call recording. * @param session - The JingleSession for the call. * @param secondSession - The second JingleSession for the call, if applicable. */ private getOrCreateVideoTrack; /** * This method creates a black video track for the call recording. */ private createBlackTrack; /** * This method uploads the file to the server. * @param recordingInstance - The CallRecorderInstance containing the recording data. * @param backup - Whether to upload as a backup file or not. */ uploadFileToServer(recordingInstance: CallRecorderInstance, backup?: boolean): Promise; /** * This method either handles the error event from the MediaRecorder or fill the data attrbute from recorderInstance with Blob. * @param event - The data available event from the MediaRecorder. * @param recorderInstance - The CallRecorderInstance containing the recording data. */ onDataAvailable(event: any, recorderInstance: CallRecorderInstance): Promise; /** * This method handles the error event from the MediaRecorder or manage the file by uploading it on the server or writing it to disk. * @param recordingInstance - The CallRecorderInstance containing the recording data. */ private onStop; /** * This method handles the error event from the MediaRecorder. * @param recorderInstance - The CallRecorderInstance containing the recording data. * @param isTempFile - Whether the file is a temporary file or not. */ private writeFileToDisk; /** * This method creates the final file for the recording. * @param recordingInstance - The CallRecorderInstance containing the recording data. */ private createFinalFileForRecording; /** * This method removes the recording instance from the list of recorders. * @param recorderInstance - The CallRecorderInstance to remove. */ private removeRecordingInstance; /** * This method injects metadata into the Blob. * @param blob - The Blob to inject metadata into. */ private injectMetadata; /** * This method closes the AudioContext. * @param audioContext - The AudioContext to close. */ private closeAudioContext; /** * This method handles the error event from the MediaRecorder. * @param event - The error event from the MediaRecorder. */ private onError; } //# sourceMappingURL=callRecorder.service.d.ts.map