web-speech-cognitive-services 8.0.0-main.ccf35da → 8.0.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.
- package/dist/web-speech-cognitive-services.d.mts +160 -112
- package/dist/web-speech-cognitive-services.d.ts +160 -112
- package/dist/web-speech-cognitive-services.development.js +134 -122
- package/dist/web-speech-cognitive-services.development.js.map +1 -1
- package/dist/web-speech-cognitive-services.js +141 -126
- package/dist/web-speech-cognitive-services.js.map +1 -1
- package/dist/web-speech-cognitive-services.mjs +141 -126
- package/dist/web-speech-cognitive-services.mjs.map +1 -1
- package/dist/web-speech-cognitive-services.production.min.js +11 -11
- package/dist/web-speech-cognitive-services.production.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
|
|
3
|
-
|
|
4
|
-
declare class SpeechSynthesisUtterance {
|
|
5
|
-
constructor(text: any);
|
|
6
|
-
_lang: any;
|
|
7
|
-
_pitch: number;
|
|
8
|
-
_rate: number;
|
|
9
|
-
_voice: any;
|
|
10
|
-
_volume: number;
|
|
11
|
-
text: any;
|
|
12
|
-
set onboundary(value: any);
|
|
13
|
-
get onboundary(): any;
|
|
14
|
-
set onend(value: any);
|
|
15
|
-
get onend(): any;
|
|
16
|
-
set onerror(value: any);
|
|
17
|
-
get onerror(): any;
|
|
18
|
-
set onmark(value: any);
|
|
19
|
-
get onmark(): any;
|
|
20
|
-
set onpause(value: any);
|
|
21
|
-
get onpause(): any;
|
|
22
|
-
set onresume(value: any);
|
|
23
|
-
get onresume(): any;
|
|
24
|
-
set onstart(value: any);
|
|
25
|
-
get onstart(): any;
|
|
26
|
-
set lang(value: any);
|
|
27
|
-
get lang(): any;
|
|
28
|
-
set pitch(value: number);
|
|
29
|
-
get pitch(): number;
|
|
30
|
-
set rate(value: number);
|
|
31
|
-
get rate(): number;
|
|
32
|
-
set voice(value: any);
|
|
33
|
-
get voice(): any;
|
|
34
|
-
set volume(value: number);
|
|
35
|
-
get volume(): number;
|
|
36
|
-
preload({ deploymentId, fetchCredentials, outputFormat }: {
|
|
37
|
-
deploymentId: any;
|
|
38
|
-
fetchCredentials: any;
|
|
39
|
-
outputFormat: any;
|
|
40
|
-
}): void;
|
|
41
|
-
arrayBufferPromise: Promise<ArrayBuffer> | undefined;
|
|
42
|
-
play(audioContext: any): Promise<void>;
|
|
43
|
-
_playingSource: any;
|
|
44
|
-
stop(): void;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare class SpeechSynthesisEvent {
|
|
48
|
-
constructor(type: any);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
declare class _default$3 {
|
|
52
|
-
constructor(audioContext: any);
|
|
53
|
-
audioContext: any;
|
|
54
|
-
pause(): void;
|
|
55
|
-
resume(): void;
|
|
56
|
-
start(queue: any): Promise<void>;
|
|
57
|
-
playingUtterance: any;
|
|
58
|
-
stop(): void;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
declare class _default$2 {
|
|
62
|
-
constructor({ audioContext, ponyfill }: {
|
|
63
|
-
audioContext: any;
|
|
64
|
-
ponyfill: any;
|
|
65
|
-
});
|
|
66
|
-
consumer: _default$3 | null;
|
|
67
|
-
paused: boolean;
|
|
68
|
-
queue: any[];
|
|
69
|
-
getAudioContext: memoize_one.MemoizedFn<() => any>;
|
|
70
|
-
pause(): void;
|
|
71
|
-
push(utterance: any): void;
|
|
72
|
-
resume(): void;
|
|
73
|
-
get speaking(): boolean;
|
|
74
|
-
startConsumer(): Promise<void>;
|
|
75
|
-
stop(): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare function createSpeechRecognitionPonyfill(options: any): {};
|
|
79
|
-
|
|
80
|
-
declare class SpeechGrammarList {
|
|
81
|
-
#private;
|
|
82
|
-
constructor();
|
|
83
|
-
addFromString(): void;
|
|
84
|
-
get phrases(): readonly string[];
|
|
85
|
-
set phrases(value: readonly string[]);
|
|
86
|
-
}
|
|
1
|
+
import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
|
|
87
2
|
|
|
88
3
|
type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';
|
|
89
4
|
type SpeechRecognitionErrorEventInit = {
|
|
@@ -174,11 +89,114 @@ type SpeechRecognitionEventListenerMap = EventListenerMap<'audioend' | 'audiosta
|
|
|
174
89
|
start: SpeechRecognitionEvent<'start'>;
|
|
175
90
|
}>;
|
|
176
91
|
|
|
92
|
+
interface W3CSpeechGrammar {
|
|
93
|
+
src: string;
|
|
94
|
+
weight: number;
|
|
95
|
+
}
|
|
96
|
+
interface W3CSpeechGrammarList {
|
|
97
|
+
readonly length: number;
|
|
98
|
+
addFromString(string: string, weight?: number): void;
|
|
99
|
+
addFromURI(src: string, weight?: number): void;
|
|
100
|
+
item(index: number): W3CSpeechGrammar;
|
|
101
|
+
[index: number]: W3CSpeechGrammar;
|
|
102
|
+
}
|
|
103
|
+
declare class SpeechGrammarList implements W3CSpeechGrammarList {
|
|
104
|
+
#private;
|
|
105
|
+
constructor();
|
|
106
|
+
addFromString(): void;
|
|
107
|
+
addFromURI(): void;
|
|
108
|
+
item(): W3CSpeechGrammar;
|
|
109
|
+
get length(): number;
|
|
110
|
+
[index: number]: {
|
|
111
|
+
src: string;
|
|
112
|
+
weight: number;
|
|
113
|
+
};
|
|
114
|
+
get phrases(): readonly string[];
|
|
115
|
+
set phrases(value: readonly string[]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type Credentials = Readonly<({
|
|
119
|
+
authorizationToken: string;
|
|
120
|
+
subscriptionKey?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
authorizationToken?: undefined;
|
|
123
|
+
subscriptionKey: string;
|
|
124
|
+
}) & ({
|
|
125
|
+
customVoiceHostname?: undefined;
|
|
126
|
+
region: string;
|
|
127
|
+
speechRecognitionHostname?: undefined;
|
|
128
|
+
speechSynthesisHostname?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
customVoiceHostname: string;
|
|
131
|
+
region?: undefined;
|
|
132
|
+
speechRecognitionHostname: string;
|
|
133
|
+
speechSynthesisHostname: string;
|
|
134
|
+
})>;
|
|
135
|
+
type PatchOptionsInit = {
|
|
136
|
+
audioConfig: AudioConfig;
|
|
137
|
+
credentials?: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
|
|
138
|
+
enableTelemetry: boolean;
|
|
139
|
+
looseEvent?: boolean | undefined;
|
|
140
|
+
looseEvents?: boolean | undefined;
|
|
141
|
+
referenceGrammars?: readonly string[] | undefined;
|
|
142
|
+
region?: string | undefined;
|
|
143
|
+
speechRecognitionEndpointId: string;
|
|
144
|
+
textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
|
|
145
|
+
} & ({
|
|
146
|
+
authorizationToken: string;
|
|
147
|
+
subscriptionKey?: undefined;
|
|
148
|
+
} | {
|
|
149
|
+
authorizationToken?: undefined;
|
|
150
|
+
subscriptionKey: string;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
|
|
154
|
+
SpeechGrammarList: typeof SpeechGrammarList;
|
|
155
|
+
SpeechRecognition: {
|
|
156
|
+
new (): {
|
|
157
|
+
"__#8@#continuous": boolean;
|
|
158
|
+
"__#8@#eventListenerMap": SpeechRecognitionEventListenerMap;
|
|
159
|
+
"__#8@#grammars": SpeechGrammarList;
|
|
160
|
+
"__#8@#interimResults": boolean;
|
|
161
|
+
"__#8@#lang": string;
|
|
162
|
+
"__#8@#maxAlternatives": number;
|
|
163
|
+
emitCognitiveServices<T extends {
|
|
164
|
+
type: string;
|
|
165
|
+
}>(type: string, event: T): void;
|
|
166
|
+
continuous: boolean;
|
|
167
|
+
grammars: SpeechGrammarList;
|
|
168
|
+
interimResults: boolean;
|
|
169
|
+
maxAlternatives: number;
|
|
170
|
+
lang: string;
|
|
171
|
+
get onaudioend(): ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined;
|
|
172
|
+
set onaudioend(value: ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined);
|
|
173
|
+
onaudiostart: ((event: SpeechRecognitionEvent<"audiostart">) => void) | undefined;
|
|
174
|
+
oncognitiveservices: ((event: SpeechRecognitionEvent<"cognitiveservices">) => void) | undefined;
|
|
175
|
+
onend: ((event: SpeechRecognitionEvent<"end">) => void) | undefined;
|
|
176
|
+
onerror: ((event: SpeechRecognitionErrorEvent) => void) | undefined;
|
|
177
|
+
onresult: ((event: SpeechRecognitionEvent<"result">) => void) | undefined;
|
|
178
|
+
onsoundend: ((event: SpeechRecognitionEvent<"soundend">) => void) | undefined;
|
|
179
|
+
onsoundstart: ((event: SpeechRecognitionEvent<"soundstart">) => void) | undefined;
|
|
180
|
+
onspeechend: ((event: SpeechRecognitionEvent<"speechend">) => void) | undefined;
|
|
181
|
+
onspeechstart: ((event: SpeechRecognitionEvent<"speechstart">) => void) | undefined;
|
|
182
|
+
onstart: ((event: SpeechRecognitionEvent<"start">) => void) | undefined;
|
|
183
|
+
abort: (() => void) | undefined;
|
|
184
|
+
stop: (() => void) | undefined;
|
|
185
|
+
start(): void;
|
|
186
|
+
_startOnce(): Promise<void>;
|
|
187
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
188
|
+
dispatchEvent(event: Event): boolean;
|
|
189
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
|
|
193
|
+
};
|
|
194
|
+
|
|
177
195
|
type CreateSpeechRecognitionPonyfillFromRecognizerInit = {
|
|
178
196
|
createRecognizer: (lang: string) => Promise<SpeechRecognizer>;
|
|
179
197
|
enableTelemetry: boolean;
|
|
180
198
|
looseEvents: boolean;
|
|
181
|
-
referenceGrammars
|
|
199
|
+
referenceGrammars?: readonly string[] | undefined;
|
|
182
200
|
textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
|
|
183
201
|
};
|
|
184
202
|
declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognizer, enableTelemetry, looseEvents, referenceGrammars, textNormalization }: CreateSpeechRecognitionPonyfillFromRecognizerInit): {
|
|
@@ -233,7 +251,54 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
|
|
|
233
251
|
SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
|
|
234
252
|
};
|
|
235
253
|
|
|
236
|
-
declare
|
|
254
|
+
declare class SpeechSynthesisEvent {
|
|
255
|
+
constructor(type: any);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
declare class SpeechSynthesisUtterance {
|
|
259
|
+
constructor(text: any);
|
|
260
|
+
_lang: any;
|
|
261
|
+
_pitch: number;
|
|
262
|
+
_rate: number;
|
|
263
|
+
_voice: any;
|
|
264
|
+
_volume: number;
|
|
265
|
+
text: any;
|
|
266
|
+
set onboundary(value: any);
|
|
267
|
+
get onboundary(): any;
|
|
268
|
+
set onend(value: any);
|
|
269
|
+
get onend(): any;
|
|
270
|
+
set onerror(value: any);
|
|
271
|
+
get onerror(): any;
|
|
272
|
+
set onmark(value: any);
|
|
273
|
+
get onmark(): any;
|
|
274
|
+
set onpause(value: any);
|
|
275
|
+
get onpause(): any;
|
|
276
|
+
set onresume(value: any);
|
|
277
|
+
get onresume(): any;
|
|
278
|
+
set onstart(value: any);
|
|
279
|
+
get onstart(): any;
|
|
280
|
+
set lang(value: any);
|
|
281
|
+
get lang(): any;
|
|
282
|
+
set pitch(value: number);
|
|
283
|
+
get pitch(): number;
|
|
284
|
+
set rate(value: number);
|
|
285
|
+
get rate(): number;
|
|
286
|
+
set voice(value: any);
|
|
287
|
+
get voice(): any;
|
|
288
|
+
set volume(value: number);
|
|
289
|
+
get volume(): number;
|
|
290
|
+
preload({ deploymentId, fetchCredentials, outputFormat }: {
|
|
291
|
+
deploymentId: any;
|
|
292
|
+
fetchCredentials: any;
|
|
293
|
+
outputFormat: any;
|
|
294
|
+
}): void;
|
|
295
|
+
arrayBufferPromise: Promise<ArrayBuffer> | undefined;
|
|
296
|
+
play(audioContext: any): Promise<void>;
|
|
297
|
+
_playingSource: any;
|
|
298
|
+
stop(): void;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
declare function _default(options: any): {
|
|
237
302
|
speechSynthesis?: never;
|
|
238
303
|
SpeechSynthesisEvent?: never;
|
|
239
304
|
SpeechSynthesisUtterance?: never;
|
|
@@ -253,29 +318,12 @@ declare function _default$1(options: any): {
|
|
|
253
318
|
SpeechSynthesisUtterance: typeof SpeechSynthesisUtterance;
|
|
254
319
|
};
|
|
255
320
|
|
|
256
|
-
|
|
257
|
-
region:
|
|
258
|
-
subscriptionKey:
|
|
259
|
-
}): Promise<string>;
|
|
260
|
-
|
|
261
|
-
declare function createSpeechServicesPonyfill(options?: {}, ...args: any[]): {
|
|
262
|
-
speechSynthesis?: never;
|
|
263
|
-
SpeechSynthesisEvent?: never;
|
|
264
|
-
SpeechSynthesisUtterance?: never;
|
|
265
|
-
} | {
|
|
266
|
-
speechSynthesis: {
|
|
267
|
-
queue: _default$2;
|
|
268
|
-
cancel(): void;
|
|
269
|
-
getVoices(): any[];
|
|
270
|
-
onvoiceschanged: any;
|
|
271
|
-
pause(): void;
|
|
272
|
-
resume(): void;
|
|
273
|
-
speak(utterance: any): Promise<any>;
|
|
274
|
-
readonly speaking: boolean;
|
|
275
|
-
updateVoices(): Promise<void>;
|
|
276
|
-
};
|
|
277
|
-
SpeechSynthesisEvent: typeof SpeechSynthesisEvent;
|
|
278
|
-
SpeechSynthesisUtterance: typeof SpeechSynthesisUtterance;
|
|
321
|
+
type FetchAuthorizationTokenInit = {
|
|
322
|
+
region: string;
|
|
323
|
+
subscriptionKey: string;
|
|
279
324
|
};
|
|
325
|
+
declare function fetchAuthorizationToken({ region, subscriptionKey }: FetchAuthorizationTokenInit): Promise<string>;
|
|
326
|
+
|
|
327
|
+
declare function createSpeechServicesPonyfill(options?: any): any;
|
|
280
328
|
|
|
281
|
-
export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default
|
|
329
|
+
export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default as createSpeechSynthesisPonyfill, fetchAuthorizationToken };
|
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
|
|
3
|
-
|
|
4
|
-
declare class SpeechSynthesisUtterance {
|
|
5
|
-
constructor(text: any);
|
|
6
|
-
_lang: any;
|
|
7
|
-
_pitch: number;
|
|
8
|
-
_rate: number;
|
|
9
|
-
_voice: any;
|
|
10
|
-
_volume: number;
|
|
11
|
-
text: any;
|
|
12
|
-
set onboundary(value: any);
|
|
13
|
-
get onboundary(): any;
|
|
14
|
-
set onend(value: any);
|
|
15
|
-
get onend(): any;
|
|
16
|
-
set onerror(value: any);
|
|
17
|
-
get onerror(): any;
|
|
18
|
-
set onmark(value: any);
|
|
19
|
-
get onmark(): any;
|
|
20
|
-
set onpause(value: any);
|
|
21
|
-
get onpause(): any;
|
|
22
|
-
set onresume(value: any);
|
|
23
|
-
get onresume(): any;
|
|
24
|
-
set onstart(value: any);
|
|
25
|
-
get onstart(): any;
|
|
26
|
-
set lang(value: any);
|
|
27
|
-
get lang(): any;
|
|
28
|
-
set pitch(value: number);
|
|
29
|
-
get pitch(): number;
|
|
30
|
-
set rate(value: number);
|
|
31
|
-
get rate(): number;
|
|
32
|
-
set voice(value: any);
|
|
33
|
-
get voice(): any;
|
|
34
|
-
set volume(value: number);
|
|
35
|
-
get volume(): number;
|
|
36
|
-
preload({ deploymentId, fetchCredentials, outputFormat }: {
|
|
37
|
-
deploymentId: any;
|
|
38
|
-
fetchCredentials: any;
|
|
39
|
-
outputFormat: any;
|
|
40
|
-
}): void;
|
|
41
|
-
arrayBufferPromise: Promise<ArrayBuffer> | undefined;
|
|
42
|
-
play(audioContext: any): Promise<void>;
|
|
43
|
-
_playingSource: any;
|
|
44
|
-
stop(): void;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare class SpeechSynthesisEvent {
|
|
48
|
-
constructor(type: any);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
declare class _default$3 {
|
|
52
|
-
constructor(audioContext: any);
|
|
53
|
-
audioContext: any;
|
|
54
|
-
pause(): void;
|
|
55
|
-
resume(): void;
|
|
56
|
-
start(queue: any): Promise<void>;
|
|
57
|
-
playingUtterance: any;
|
|
58
|
-
stop(): void;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
declare class _default$2 {
|
|
62
|
-
constructor({ audioContext, ponyfill }: {
|
|
63
|
-
audioContext: any;
|
|
64
|
-
ponyfill: any;
|
|
65
|
-
});
|
|
66
|
-
consumer: _default$3 | null;
|
|
67
|
-
paused: boolean;
|
|
68
|
-
queue: any[];
|
|
69
|
-
getAudioContext: memoize_one.MemoizedFn<() => any>;
|
|
70
|
-
pause(): void;
|
|
71
|
-
push(utterance: any): void;
|
|
72
|
-
resume(): void;
|
|
73
|
-
get speaking(): boolean;
|
|
74
|
-
startConsumer(): Promise<void>;
|
|
75
|
-
stop(): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare function createSpeechRecognitionPonyfill(options: any): {};
|
|
79
|
-
|
|
80
|
-
declare class SpeechGrammarList {
|
|
81
|
-
#private;
|
|
82
|
-
constructor();
|
|
83
|
-
addFromString(): void;
|
|
84
|
-
get phrases(): readonly string[];
|
|
85
|
-
set phrases(value: readonly string[]);
|
|
86
|
-
}
|
|
1
|
+
import { AudioConfig, SpeechRecognizer } from 'microsoft-cognitiveservices-speech-sdk';
|
|
87
2
|
|
|
88
3
|
type SpeechRecognitionErrorType = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed' | 'unknown';
|
|
89
4
|
type SpeechRecognitionErrorEventInit = {
|
|
@@ -174,11 +89,114 @@ type SpeechRecognitionEventListenerMap = EventListenerMap<'audioend' | 'audiosta
|
|
|
174
89
|
start: SpeechRecognitionEvent<'start'>;
|
|
175
90
|
}>;
|
|
176
91
|
|
|
92
|
+
interface W3CSpeechGrammar {
|
|
93
|
+
src: string;
|
|
94
|
+
weight: number;
|
|
95
|
+
}
|
|
96
|
+
interface W3CSpeechGrammarList {
|
|
97
|
+
readonly length: number;
|
|
98
|
+
addFromString(string: string, weight?: number): void;
|
|
99
|
+
addFromURI(src: string, weight?: number): void;
|
|
100
|
+
item(index: number): W3CSpeechGrammar;
|
|
101
|
+
[index: number]: W3CSpeechGrammar;
|
|
102
|
+
}
|
|
103
|
+
declare class SpeechGrammarList implements W3CSpeechGrammarList {
|
|
104
|
+
#private;
|
|
105
|
+
constructor();
|
|
106
|
+
addFromString(): void;
|
|
107
|
+
addFromURI(): void;
|
|
108
|
+
item(): W3CSpeechGrammar;
|
|
109
|
+
get length(): number;
|
|
110
|
+
[index: number]: {
|
|
111
|
+
src: string;
|
|
112
|
+
weight: number;
|
|
113
|
+
};
|
|
114
|
+
get phrases(): readonly string[];
|
|
115
|
+
set phrases(value: readonly string[]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type Credentials = Readonly<({
|
|
119
|
+
authorizationToken: string;
|
|
120
|
+
subscriptionKey?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
authorizationToken?: undefined;
|
|
123
|
+
subscriptionKey: string;
|
|
124
|
+
}) & ({
|
|
125
|
+
customVoiceHostname?: undefined;
|
|
126
|
+
region: string;
|
|
127
|
+
speechRecognitionHostname?: undefined;
|
|
128
|
+
speechSynthesisHostname?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
customVoiceHostname: string;
|
|
131
|
+
region?: undefined;
|
|
132
|
+
speechRecognitionHostname: string;
|
|
133
|
+
speechSynthesisHostname: string;
|
|
134
|
+
})>;
|
|
135
|
+
type PatchOptionsInit = {
|
|
136
|
+
audioConfig: AudioConfig;
|
|
137
|
+
credentials?: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;
|
|
138
|
+
enableTelemetry: boolean;
|
|
139
|
+
looseEvent?: boolean | undefined;
|
|
140
|
+
looseEvents?: boolean | undefined;
|
|
141
|
+
referenceGrammars?: readonly string[] | undefined;
|
|
142
|
+
region?: string | undefined;
|
|
143
|
+
speechRecognitionEndpointId: string;
|
|
144
|
+
textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
|
|
145
|
+
} & ({
|
|
146
|
+
authorizationToken: string;
|
|
147
|
+
subscriptionKey?: undefined;
|
|
148
|
+
} | {
|
|
149
|
+
authorizationToken?: undefined;
|
|
150
|
+
subscriptionKey: string;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
|
|
154
|
+
SpeechGrammarList: typeof SpeechGrammarList;
|
|
155
|
+
SpeechRecognition: {
|
|
156
|
+
new (): {
|
|
157
|
+
"__#8@#continuous": boolean;
|
|
158
|
+
"__#8@#eventListenerMap": SpeechRecognitionEventListenerMap;
|
|
159
|
+
"__#8@#grammars": SpeechGrammarList;
|
|
160
|
+
"__#8@#interimResults": boolean;
|
|
161
|
+
"__#8@#lang": string;
|
|
162
|
+
"__#8@#maxAlternatives": number;
|
|
163
|
+
emitCognitiveServices<T extends {
|
|
164
|
+
type: string;
|
|
165
|
+
}>(type: string, event: T): void;
|
|
166
|
+
continuous: boolean;
|
|
167
|
+
grammars: SpeechGrammarList;
|
|
168
|
+
interimResults: boolean;
|
|
169
|
+
maxAlternatives: number;
|
|
170
|
+
lang: string;
|
|
171
|
+
get onaudioend(): ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined;
|
|
172
|
+
set onaudioend(value: ((event: SpeechRecognitionEvent<"audioend">) => void) | undefined);
|
|
173
|
+
onaudiostart: ((event: SpeechRecognitionEvent<"audiostart">) => void) | undefined;
|
|
174
|
+
oncognitiveservices: ((event: SpeechRecognitionEvent<"cognitiveservices">) => void) | undefined;
|
|
175
|
+
onend: ((event: SpeechRecognitionEvent<"end">) => void) | undefined;
|
|
176
|
+
onerror: ((event: SpeechRecognitionErrorEvent) => void) | undefined;
|
|
177
|
+
onresult: ((event: SpeechRecognitionEvent<"result">) => void) | undefined;
|
|
178
|
+
onsoundend: ((event: SpeechRecognitionEvent<"soundend">) => void) | undefined;
|
|
179
|
+
onsoundstart: ((event: SpeechRecognitionEvent<"soundstart">) => void) | undefined;
|
|
180
|
+
onspeechend: ((event: SpeechRecognitionEvent<"speechend">) => void) | undefined;
|
|
181
|
+
onspeechstart: ((event: SpeechRecognitionEvent<"speechstart">) => void) | undefined;
|
|
182
|
+
onstart: ((event: SpeechRecognitionEvent<"start">) => void) | undefined;
|
|
183
|
+
abort: (() => void) | undefined;
|
|
184
|
+
stop: (() => void) | undefined;
|
|
185
|
+
start(): void;
|
|
186
|
+
_startOnce(): Promise<void>;
|
|
187
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
188
|
+
dispatchEvent(event: Event): boolean;
|
|
189
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
|
|
193
|
+
};
|
|
194
|
+
|
|
177
195
|
type CreateSpeechRecognitionPonyfillFromRecognizerInit = {
|
|
178
196
|
createRecognizer: (lang: string) => Promise<SpeechRecognizer>;
|
|
179
197
|
enableTelemetry: boolean;
|
|
180
198
|
looseEvents: boolean;
|
|
181
|
-
referenceGrammars
|
|
199
|
+
referenceGrammars?: readonly string[] | undefined;
|
|
182
200
|
textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';
|
|
183
201
|
};
|
|
184
202
|
declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognizer, enableTelemetry, looseEvents, referenceGrammars, textNormalization }: CreateSpeechRecognitionPonyfillFromRecognizerInit): {
|
|
@@ -233,7 +251,54 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
|
|
|
233
251
|
SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
|
|
234
252
|
};
|
|
235
253
|
|
|
236
|
-
declare
|
|
254
|
+
declare class SpeechSynthesisEvent {
|
|
255
|
+
constructor(type: any);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
declare class SpeechSynthesisUtterance {
|
|
259
|
+
constructor(text: any);
|
|
260
|
+
_lang: any;
|
|
261
|
+
_pitch: number;
|
|
262
|
+
_rate: number;
|
|
263
|
+
_voice: any;
|
|
264
|
+
_volume: number;
|
|
265
|
+
text: any;
|
|
266
|
+
set onboundary(value: any);
|
|
267
|
+
get onboundary(): any;
|
|
268
|
+
set onend(value: any);
|
|
269
|
+
get onend(): any;
|
|
270
|
+
set onerror(value: any);
|
|
271
|
+
get onerror(): any;
|
|
272
|
+
set onmark(value: any);
|
|
273
|
+
get onmark(): any;
|
|
274
|
+
set onpause(value: any);
|
|
275
|
+
get onpause(): any;
|
|
276
|
+
set onresume(value: any);
|
|
277
|
+
get onresume(): any;
|
|
278
|
+
set onstart(value: any);
|
|
279
|
+
get onstart(): any;
|
|
280
|
+
set lang(value: any);
|
|
281
|
+
get lang(): any;
|
|
282
|
+
set pitch(value: number);
|
|
283
|
+
get pitch(): number;
|
|
284
|
+
set rate(value: number);
|
|
285
|
+
get rate(): number;
|
|
286
|
+
set voice(value: any);
|
|
287
|
+
get voice(): any;
|
|
288
|
+
set volume(value: number);
|
|
289
|
+
get volume(): number;
|
|
290
|
+
preload({ deploymentId, fetchCredentials, outputFormat }: {
|
|
291
|
+
deploymentId: any;
|
|
292
|
+
fetchCredentials: any;
|
|
293
|
+
outputFormat: any;
|
|
294
|
+
}): void;
|
|
295
|
+
arrayBufferPromise: Promise<ArrayBuffer> | undefined;
|
|
296
|
+
play(audioContext: any): Promise<void>;
|
|
297
|
+
_playingSource: any;
|
|
298
|
+
stop(): void;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
declare function _default(options: any): {
|
|
237
302
|
speechSynthesis?: never;
|
|
238
303
|
SpeechSynthesisEvent?: never;
|
|
239
304
|
SpeechSynthesisUtterance?: never;
|
|
@@ -253,29 +318,12 @@ declare function _default$1(options: any): {
|
|
|
253
318
|
SpeechSynthesisUtterance: typeof SpeechSynthesisUtterance;
|
|
254
319
|
};
|
|
255
320
|
|
|
256
|
-
|
|
257
|
-
region:
|
|
258
|
-
subscriptionKey:
|
|
259
|
-
}): Promise<string>;
|
|
260
|
-
|
|
261
|
-
declare function createSpeechServicesPonyfill(options?: {}, ...args: any[]): {
|
|
262
|
-
speechSynthesis?: never;
|
|
263
|
-
SpeechSynthesisEvent?: never;
|
|
264
|
-
SpeechSynthesisUtterance?: never;
|
|
265
|
-
} | {
|
|
266
|
-
speechSynthesis: {
|
|
267
|
-
queue: _default$2;
|
|
268
|
-
cancel(): void;
|
|
269
|
-
getVoices(): any[];
|
|
270
|
-
onvoiceschanged: any;
|
|
271
|
-
pause(): void;
|
|
272
|
-
resume(): void;
|
|
273
|
-
speak(utterance: any): Promise<any>;
|
|
274
|
-
readonly speaking: boolean;
|
|
275
|
-
updateVoices(): Promise<void>;
|
|
276
|
-
};
|
|
277
|
-
SpeechSynthesisEvent: typeof SpeechSynthesisEvent;
|
|
278
|
-
SpeechSynthesisUtterance: typeof SpeechSynthesisUtterance;
|
|
321
|
+
type FetchAuthorizationTokenInit = {
|
|
322
|
+
region: string;
|
|
323
|
+
subscriptionKey: string;
|
|
279
324
|
};
|
|
325
|
+
declare function fetchAuthorizationToken({ region, subscriptionKey }: FetchAuthorizationTokenInit): Promise<string>;
|
|
326
|
+
|
|
327
|
+
declare function createSpeechServicesPonyfill(options?: any): any;
|
|
280
328
|
|
|
281
|
-
export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default
|
|
329
|
+
export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default as createSpeechSynthesisPonyfill, fetchAuthorizationToken };
|