uneeq-js 2.40.2 → 2.40.4

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.
@@ -5,6 +5,7 @@ import { API } from './api';
5
5
  import { MediaHandler } from './media-handler';
6
6
  import { MessagingService } from './messaging';
7
7
  import { StreamManager } from './stream-manager';
8
+ import { VoiceInputManager } from './voice-input-manager';
8
9
  export interface DeviceManagerOptions {
9
10
  userMessages: Subject<any>;
10
11
  session: NewSessionResponse;
@@ -14,6 +15,7 @@ export interface DeviceManagerOptions {
14
15
  uneeqOptions: UneeqOptions;
15
16
  sessionLiveHandler?: () => void;
16
17
  streamManager: StreamManager;
18
+ voiceInputManager: VoiceInputManager;
17
19
  }
18
20
  export declare class DeviceManager {
19
21
  options: DeviceManagerOptions;
@@ -11,8 +11,6 @@ export declare class MediaHandler {
11
11
  localVideoElement: HTMLVideoElement;
12
12
  publishingStream: boolean;
13
13
  private webRTC?;
14
- private audioContext;
15
- private soundMeter;
16
14
  constructor(options: DeviceManagerOptions, remoteVideoReady: () => void);
17
15
  setEdgeNodeId(edgeNodeId: string): void;
18
16
  unpublishVideo(): void;
@@ -24,7 +22,5 @@ export declare class MediaHandler {
24
22
  gatherWebRTCStats(callback: any): void;
25
23
  private publishVideo;
26
24
  private performWebRTCConnection;
27
- private initMicActivity;
28
25
  private initTransparentBackground;
29
- private micActivityConnected;
30
26
  }
@@ -19,7 +19,6 @@ export declare class Prom {
19
19
  prom_prefix: string;
20
20
  registry: Registry;
21
21
  messageTimings: any;
22
- private metricsIntervalId;
23
22
  metricsPushedCounter: Counter;
24
23
  sessionStartTime: Histogram;
25
24
  availabilityCheckTime: Histogram;
@@ -30,6 +29,7 @@ export declare class Prom {
30
29
  webRtcFrameHeight: Histogram;
31
30
  webRtcFrameWidth: Histogram;
32
31
  conversationRoundTripTime: Histogram;
32
+ private metricsIntervalId;
33
33
  constructor(apiUrl: string);
34
34
  handleMessage(msg: PromMessage): void;
35
35
  calculateConversationRtt(msg: PromMessage): number;
@@ -0,0 +1,30 @@
1
+ import { Subject } from 'rxjs';
2
+ import { UneeqOptions } from '../types/UneeqOptions';
3
+ import { VoiceInputMode } from '../types/VoiceInputMode';
4
+ import { API } from './api';
5
+ export declare class VoiceInputManager {
6
+ private options;
7
+ private api;
8
+ private messages;
9
+ private enableMicrophone;
10
+ private readonly microphoneEngageVolume;
11
+ private readonly voiceActivityNotSpeakingTimeoutMS;
12
+ private soundMeter;
13
+ private audioContext;
14
+ private digitalHumanSpeaking;
15
+ private recording;
16
+ private silenceTimeout?;
17
+ constructor(options: UneeqOptions, api: API, messages: Subject<any>, enableMicrophone: (enabled: boolean) => void);
18
+ setVoiceInputMode(mode: VoiceInputMode | string): void;
19
+ startRecording(): void;
20
+ stopRecording(): void;
21
+ handleSessionEnd(): void;
22
+ initMicActivity(stream: MediaStream): void;
23
+ private audioContextNotSupported;
24
+ private handleAppMessages;
25
+ private requestNotSupportedInVoiceActivityMode;
26
+ private apiStartRecording;
27
+ private apiStopRecording;
28
+ private micActivityConnected;
29
+ private handleVoiceActivity;
30
+ }
@@ -19,6 +19,7 @@ export declare enum UneeqMessageType {
19
19
  ServiceUnavailable = "ServiceUnavailable",
20
20
  OnlineStatusUpdate = "OnlineStatusUpdate",
21
21
  MicActivityNotSupported = "MicActivityNotSupported",
22
+ VoiceActivityInputModeNotSupported = "VoiceActivityInputModeNotSupported",
22
23
  MicActivityError = "MicActivityError",
23
24
  MicActivity = "MicActivity",
24
25
  DeviceError = "DeviceError",
@@ -170,6 +171,13 @@ export declare class MicActivityNotSupportedMessage implements UneeqMessage {
170
171
  uneeqMessageType: UneeqMessageType;
171
172
  constructor();
172
173
  }
174
+ /**
175
+ * Mic activity input mode is not supported by the users browser
176
+ */
177
+ export declare class VoiceActivityInputModeNotSupportedMessage implements UneeqMessage {
178
+ uneeqMessageType: UneeqMessageType;
179
+ constructor();
180
+ }
173
181
  /**
174
182
  * Connection Lost
175
183
  */
@@ -1,3 +1,4 @@
1
+ import { VoiceInputMode } from './VoiceInputMode';
1
2
  export interface UneeqOptions {
2
3
  /** Server URL to connect to. */
3
4
  url: string;
@@ -48,4 +49,8 @@ export interface UneeqOptions {
48
49
  * If false, your configured background image will be displayed. Defaults to false.
49
50
  */
50
51
  enableTransparentBackground?: boolean;
52
+ /**
53
+ * This option specifies what the default voice input mode will be.
54
+ */
55
+ voiceInputMode: VoiceInputMode | string;
51
56
  }
@@ -0,0 +1,4 @@
1
+ export declare enum VoiceInputMode {
2
+ PUSH_TO_TALK = "PUSH_TO_TALK",
3
+ VOICE_ACTIVITY = "VOICE_ACTIVITY"
4
+ }
@@ -1,6 +1,7 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
2
  import 'rxjs/add/operator/filter';
3
3
  import { UneeqOptions } from './types/types';
4
+ import { VoiceInputMode } from './types/VoiceInputMode';
4
5
  export declare class Uneeq {
5
6
  static onDataMessage: (msg: any) => void;
6
7
  static onStatMessage: (stats: any) => void;
@@ -15,6 +16,7 @@ export declare class Uneeq {
15
16
  private sessionStarted;
16
17
  private deviceManager;
17
18
  private messageHandler;
19
+ private voiceInputManager;
18
20
  private unavailableAvatarMsgSent;
19
21
  private readonly options;
20
22
  private readonly messageCallback;
@@ -56,6 +58,11 @@ export declare class Uneeq {
56
58
  * @param deviceId
57
59
  */
58
60
  setSpeaker(deviceId: string): void;
61
+ /**
62
+ * Set the microphone input mode to be used.
63
+ * @param mode PUSH_TO_TALK or VOICE_ACTIVITY
64
+ */
65
+ setVoiceInputMode(mode: VoiceInputMode): void;
59
66
  /**
60
67
  * Enable or disable the users microphone
61
68
  * @param enable Defaults to true