videomail-client 16.0.3 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,13 @@
1
1
  import { FormReadyParams } from "../../wrappers/container.js";
2
- import { VideomailErrorParams, VideomailInvalidParams, VideomailPreviewParams, VideomailProgressParams, VideomailRecordingParams, VideomailStoppedParams, VideomailStoppingParams, VideomailSubmittedParams, VideomailUserMediaReadyParams, VideomailValidatingParams } from "./params.js";
2
+ import { VideomailCameraRecoveryFailedParams, VideomailErrorParams, VideomailInvalidParams, VideomailPreviewParams, VideomailProgressParams, VideomailRecordingParams, VideomailStoppedParams, VideomailStoppingParams, VideomailSubmittedParams, VideomailUserMediaReadyParams, VideomailValidatingParams } from "./params.js";
3
3
  export interface VideomailEvents {
4
4
  ASKING_WEBCAM_PERMISSION: () => void;
5
5
  BEGIN_AUDIO_ENCODING: () => void;
6
6
  BEGIN_VIDEO_ENCODING: () => void;
7
7
  BLOCKING: () => void;
8
8
  BUILT: () => void;
9
+ CAMERA_RECOVERING: () => void;
10
+ CAMERA_RECOVERY_FAILED: (params: VideomailCameraRecoveryFailedParams) => void;
9
11
  CONNECTED: () => void;
10
12
  CONNECTING: () => void;
11
13
  COUNTDOWN: () => void;
@@ -4,9 +4,13 @@ import { RecordingStats } from "../RecordingStats.js";
4
4
  import { Videomail } from "../Videomail.js";
5
5
  export interface VideomailUserMediaReadyParams {
6
6
  switchingFacingMode?: ConstrainDOMString | undefined;
7
+ recovering?: boolean | undefined;
7
8
  recordWhenReady?: boolean | undefined;
8
9
  paused?: boolean | undefined;
9
10
  }
11
+ export interface VideomailCameraRecoveryFailedParams {
12
+ err: VideomailError;
13
+ }
10
14
  export interface VideomailErrorParams {
11
15
  exc?: unknown;
12
16
  err?: VideomailError;
@@ -15,6 +15,8 @@ declare class Despot {
15
15
  BEGIN_VIDEO_ENCODING: (() => void)[];
16
16
  BLOCKING: (() => void)[];
17
17
  BUILT: (() => void)[];
18
+ CAMERA_RECOVERING: (() => void)[];
19
+ CAMERA_RECOVERY_FAILED: ((params: import("../index.js").VideomailCameraRecoveryFailedParams) => void)[];
18
20
  CONNECTED: (() => void)[];
19
21
  CONNECTING: (() => void)[];
20
22
  COUNTDOWN: (() => void)[];
@@ -5,6 +5,7 @@ export type AudioProcessCB = (audioSample: AudioSample) => void;
5
5
  declare class AudioRecorder {
6
6
  private scriptProcessor?;
7
7
  private audioInput?;
8
+ private volume?;
8
9
  private vcAudioContext?;
9
10
  private readonly userMedia;
10
11
  private readonly options;
@@ -12,8 +13,10 @@ declare class AudioRecorder {
12
13
  private hasAudioContext;
13
14
  private getAudioContext;
14
15
  private onAudioProcess;
16
+ private disconnect;
15
17
  init(localMediaStream: MediaStream): void;
16
18
  record(cb: AudioProcessCB): void;
19
+ resume(): Promise<void>;
17
20
  stop(): void;
18
21
  getSampleRate(): number;
19
22
  }
@@ -67,6 +67,8 @@ declare class Container extends Despot {
67
67
  pause(params?: {
68
68
  event: MouseEvent;
69
69
  }): void;
70
+ suspend(): void;
71
+ recoverCamera(): Promise<boolean>;
70
72
  validate(event?: any, force?: boolean): boolean;
71
73
  disableForm(buttonsToo: boolean): void;
72
74
  enableForm(buttonsToo: boolean): void;
@@ -19,6 +19,7 @@ declare class Recorder extends Despot {
19
19
  private originalAnimationFrameObject;
20
20
  private samplesCount;
21
21
  private framesCount;
22
+ private recordingAudioSampleRate?;
22
23
  private recordingStats?;
23
24
  private confirmedFrameNumber;
24
25
  private confirmedSampleNumber;
@@ -37,6 +38,10 @@ declare class Recorder extends Despot {
37
38
  private ctx?;
38
39
  private userMediaLoaded?;
39
40
  private userMediaLoading;
41
+ private mediaRequestId;
42
+ private cameraRecovery?;
43
+ private resolveCameraRecovery?;
44
+ private resumeAfterCameraRecovery;
40
45
  private submitting;
41
46
  private unloaded?;
42
47
  private stopTime?;
@@ -134,6 +139,10 @@ declare class Recorder extends Despot {
134
139
  private clearStopTimeout;
135
140
  validate(): boolean;
136
141
  isReady(): boolean | undefined;
142
+ private finishCameraRecovery;
143
+ private cancelCameraRecovery;
144
+ private failCameraRecovery;
145
+ recoverCamera(): Promise<boolean>;
137
146
  pause(params?: PauseParams): void;
138
147
  resume(): void;
139
148
  private onFlushed;
@@ -1,11 +1,12 @@
1
1
  import { Dimension } from "../../types/dimension.js";
2
+ import type { VideomailUserMediaReadyParams } from "../../types/events/params.js";
2
3
  import { VideomailClientOptions } from "../../types/options.js";
3
4
  import Despot from "../../util/Despot.js";
4
5
  import { AudioProcessCB } from "../../util/html/media/AudioRecorder.js";
5
6
  import Recorder from "./recorder.js";
6
7
  interface StopParams {
7
- aboutToInitialize: boolean;
8
- switchingFacingMode: any;
8
+ aboutToInitialize?: boolean;
9
+ preserveRecordingState?: boolean;
9
10
  }
10
11
  declare class UserMedia extends Despot {
11
12
  private readonly recorder;
@@ -18,17 +19,21 @@ declare class UserMedia extends Despot {
18
19
  private onLoadedMetaDataReached;
19
20
  private playingPromiseReached;
20
21
  private videoTrackLabel?;
22
+ private clearInitializationListeners?;
23
+ private initializationId;
21
24
  private readonly outputEvent;
22
25
  private readonly handleMediaError;
23
26
  constructor(recorder: Recorder, options: VideomailClientOptions);
24
27
  private attachMediaStream;
25
28
  private setVisualStream;
29
+ restorePlayback(): Promise<void>;
30
+ hasLiveStream(): boolean;
26
31
  private hasEnded;
27
32
  private hasInvalidDimensions;
28
33
  private logEvent;
29
34
  unloadRemainingEventListeners(): void;
30
35
  private audioRecord;
31
- init(localMediaStream: MediaStream, videoCallback: () => void, audioCallback: AudioProcessCB, endedEarlyCallback: (err: any) => void, switchingFacingMode?: ConstrainDOMString): void;
36
+ init(localMediaStream: MediaStream, videoCallback: () => void, audioCallback: AudioProcessCB, endedEarlyCallback: (err: unknown) => void, params?: Pick<VideomailUserMediaReadyParams, "switchingFacingMode" | "recovering">): void;
32
37
  getVideoTrackLabel(): string | undefined;
33
38
  isReady(): boolean;
34
39
  stop(visualStream?: MediaStream, params?: StopParams): void;
@@ -14,6 +14,7 @@ declare class Visuals extends Despot {
14
14
  private readonly notifier;
15
15
  private visualsElement?;
16
16
  private built;
17
+ private cameraRecoveryFailed;
17
18
  constructor(container: Container, options: VideomailClientOptions);
18
19
  private buildNoScriptTag;
19
20
  private buildChildren;
@@ -37,6 +38,8 @@ declare class Visuals extends Despot {
37
38
  pause(params?: {
38
39
  event: MouseEvent;
39
40
  }): void;
41
+ private clearCameraRecoveryNotice;
42
+ recoverCamera(): Promise<boolean>;
40
43
  resume(): void;
41
44
  pauseOrResume(): void;
42
45
  recordOrStop(): void;