@100mslive/hms-video-store
Version:
@100mslive Core SDK which abstracts the complexities of webRTC while providing a reactive store for data management with a unidirectional data flow
84 lines (83 loc) • 3.88 kB
TypeScript
import { PublishAnalyticPayload, SubscribeAnalyticPayload } from './stats/interfaces';
import { AdditionalAnalyticsProperties } from './AdditionalAnalyticsProperties';
import AnalyticsEvent from './AnalyticsEvent';
import { IAnalyticsPropertiesProvider } from './IAnalyticsPropertiesProvider';
import { HMSException } from '../error/HMSException';
import { DeviceMap, SelectedDevices } from '../interfaces';
import { HMSTrackSettings } from '../media/settings/HMSTrackSettings';
import { HMSRemoteVideoTrack } from '../media/tracks/HMSRemoteVideoTrack';
export default class AnalyticsEventFactory {
private static KEY_REQUESTED_AT;
private static KEY_RESPONDED_AT;
static connect(error?: Error, additionalProperties?: AdditionalAnalyticsProperties, requestedAt?: Date, respondedAt?: Date, endpoint?: string): AnalyticsEvent;
static disconnect(error?: Error, additionalProperties?: AdditionalAnalyticsProperties): AnalyticsEvent;
static preview({ error, ...props }: {
error?: Error;
time?: number;
init_response_time?: number;
ws_connect_time?: number;
on_policy_change_time?: number;
local_audio_track_time?: number;
local_video_track_time?: number;
}): AnalyticsEvent;
static join({ error, ...props }: {
error?: Error;
is_preview_called?: boolean;
start?: Date;
end?: Date;
time?: number;
init_response_time?: number;
ws_connect_time?: number;
on_policy_change_time?: number;
local_audio_track_time?: number;
local_video_track_time?: number;
retries_join?: number;
}): AnalyticsEvent;
static publish({ devices, settings, error }: {
devices?: DeviceMap;
settings?: HMSTrackSettings;
error?: Error;
}): AnalyticsEvent;
static hlsPlayerError(error: HMSException): AnalyticsEvent;
static subscribeFail(error: Error): AnalyticsEvent;
static leave(): AnalyticsEvent;
static autoplayError(): AnalyticsEvent;
static audioPlaybackError(error: HMSException): AnalyticsEvent;
static audioRecovered(message: string): AnalyticsEvent;
static permissionChange(type: 'audio' | 'video', status: PermissionState): AnalyticsEvent;
static deviceChange({ isUserSelection, selection, type, devices, error, }: {
isUserSelection?: boolean;
selection: Partial<SelectedDevices>;
type?: 'change' | 'list' | 'audioInput' | 'audioOutput' | 'video';
devices: DeviceMap;
error?: Error;
}): AnalyticsEvent;
static performance(stats: IAnalyticsPropertiesProvider): AnalyticsEvent;
static rtcStats(stats: IAnalyticsPropertiesProvider): AnalyticsEvent;
static rtcStatsFailed(error: HMSException): AnalyticsEvent;
/**
* TODO: remove once everything is switched to server side degradation, this
* event can be handled on server side as well.
*/
static degradationStats(track: HMSRemoteVideoTrack, isDegraded: boolean): AnalyticsEvent;
static audioDetectionFail(error: Error, device?: MediaDeviceInfo): AnalyticsEvent;
static previewNetworkQuality(properties: {
downLink?: string;
score?: number;
error?: string;
}): AnalyticsEvent;
static publishStats(properties: PublishAnalyticPayload): AnalyticsEvent;
static subscribeStats(properties: SubscribeAnalyticPayload): AnalyticsEvent;
static getKrispUsage(duration: number): AnalyticsEvent;
static krispStart(): AnalyticsEvent;
static krispStop(): AnalyticsEvent;
static interruption({ started, type, reason, deviceInfo, }: {
started: boolean;
type: string;
reason: string;
deviceInfo: Partial<MediaDeviceInfo>;
}): AnalyticsEvent;
private static eventNameFor;
private static getPropertiesWithError;
private static getErrorProperties;
}