@hahnpro/ms-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 11.4 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/Transcription/MeetingTranscriber.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,WAAW,EACX,qBAAqB,EACrB,UAAU,EACV,6BAA6B,EAC7B,kBAAkB,EAElB,gBAAgB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,cAAc,EAEd,2BAA2B,EAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnD,qBAAa,kBAAmB,YAAW,2BAA2B;IAElE;;;;;OAKG;IACI,eAAe,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAEvF;;;;;OAKG;IACI,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAE/E;;;;;OAKG;IACG,WAAW,EAAE,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IAEvG;;;;;OAKG;IACG,YAAY,EAAE,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IAEzG;;;;;OAKG;IACI,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAEjF;;;;;OAKG;IACI,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAEjF;;;;;OAKG;IACI,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAEjF;;;;;OAKG;IACI,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,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.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { TranscriberRecognizer } from \"../../common.speech/Exports.js\";\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\nimport { Contracts } from \"../Contracts.js\";\nimport {\n AudioConfig,\n CancellationEventArgs,\n Connection,\n MeetingTranscriptionEventArgs,\n PropertyCollection,\n PropertyId,\n SessionEventArgs\n} from \"../Exports.js\";\nimport {\n MeetingHandler,\n MeetingImpl,\n MeetingTranscriptionHandler\n} from \"./Exports.js\";\nimport { Callback, IMeeting } from \"./IMeeting.js\";\n\nexport class MeetingTranscriber implements MeetingTranscriptionHandler {\n\n /**\n * The event canceled signals that an error occurred during the meeting.\n * @member MeetingTranscriber.prototype.MeetingCanceled\n * @function\n * @public\n */\n public MeetingCanceled: (sender: MeetingHandler, event: CancellationEventArgs) => void;\n\n /**\n * The event canceled signals that an error occurred during transcription.\n * @member MeetingTranscriber.prototype.canceled\n * @function\n * @public\n */\n public canceled: (sender: MeetingHandler, event: CancellationEventArgs) => void;\n\n /**\n * The event recognized signals that a final meeting transcription result is received.\n * @member MeetingTranscriber.prototype.transcribed\n * @function\n * @public\n */\n public transcribed: (sender: MeetingTranscriptionHandler, event: MeetingTranscriptionEventArgs) => void;\n\n /**\n * The event recognizing signals that an intermediate meeting transcription result is received.\n * @member MeetingTranscriber.prototype.transcribing\n * @function\n * @public\n */\n public transcribing: (sender: MeetingTranscriptionHandler, event: MeetingTranscriptionEventArgs) => void;\n\n /**\n * Defines event handler for session started events.\n * @member MeetingTranscriber.prototype.sessionStarted\n * @function\n * @public\n */\n public sessionStarted: (sender: MeetingHandler, event: SessionEventArgs) => void;\n\n /**\n * Defines event handler for session stopped events.\n * @member MeetingTranscriber.prototype.sessionStopped\n * @function\n * @public\n */\n public sessionStopped: (sender: MeetingHandler, event: SessionEventArgs) => void;\n\n /**\n * Defines event handler for meeting started events.\n * @member MeetingTranscriber.prototype.MeetingStarted\n * @function\n * @public\n */\n public MeetingStarted: (sender: MeetingHandler, event: SessionEventArgs) => void;\n\n /**\n * Defines event handler for meeting stopped events.\n * @member MeetingTranscriber.prototype.MeetingStopped\n * @function\n * @public\n */\n public meetingStopped: (sender: MeetingHandler, event: SessionEventArgs) => void;\n\n protected privAudioConfig: AudioConfig;\n private privDisposedRecognizer: boolean;\n private privRecognizer: TranscriberRecognizer;\n private privProperties: PropertyCollection;\n\n /**\n * MeetingTranscriber constructor.\n * @constructor\n * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\n */\n public constructor(audioConfig?: AudioConfig) {\n this.privAudioConfig = audioConfig;\n this.privProperties = new PropertyCollection();\n this.privRecognizer = undefined;\n this.privDisposedRecognizer = false;\n }\n\n /**\n * Gets the spoken language of recognition.\n * @member MeetingTranscriber.prototype.speechRecognitionLanguage\n * @function\n * @public\n * @returns {string} The spoken language of recognition.\n */\n public get speechRecognitionLanguage(): string {\n Contracts.throwIfDisposed(this.privDisposedRecognizer);\n\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\n }\n\n /**\n * The collection of properties and their values defined for this MeetingTranscriber.\n * @member MeetingTranscriber.prototype.properties\n * @function\n * @public\n * @returns {PropertyCollection} The collection of properties and their values defined for this MeetingTranscriber.\n */\n public get properties(): PropertyCollection {\n return this.privProperties;\n }\n\n /**\n * @Internal\n * Internal data member to support fromRecognizer* pattern methods on other classes.\n * Do not use externally, object returned will change without warning or notice.\n */\n public get internalData(): object {\n return this.privRecognizer.internalData;\n }\n\n /**\n * @Deprecated\n * @Obsolete\n * Please use the Connection.fromRecognizer pattern to obtain a connection object\n */\n public get connection(): Connection {\n return Connection.fromRecognizer(this.privRecognizer);\n }\n\n /**\n * Gets the authorization token used to communicate with the service.\n * @member MeetingTranscriber.prototype.authorizationToken\n * @function\n * @public\n * @returns {string} Authorization token.\n */\n public get authorizationToken(): string {\n return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\n }\n\n /**\n * Gets/Sets the authorization token used to communicate with the service.\n * @member MeetingTranscriber.prototype.authorizationToken\n * @function\n * @public\n * @param {string} token - Authorization token.\n */\n public set authorizationToken(token: string) {\n Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\n }\n\n /**\n * @param {Meeting} meeting - meeting to be recognized\n */\n public joinMeetingAsync(meeting: IMeeting, cb?: Callback, err?: Callback): void {\n /* eslint-disable no-console */\n // console.log(\">> MeetingTranscriber::joinMeetingAsync\");\n /* eslint-enable no-console */\n const meetingImpl = meeting as MeetingImpl;\n Contracts.throwIfNullOrUndefined(MeetingImpl, \"Meeting\");\n\n // ref the meeting object\n // create recognizer and subscribe to recognizer events\n this.privRecognizer = new TranscriberRecognizer(meeting.config, this.privAudioConfig);\n Contracts.throwIfNullOrUndefined(this.privRecognizer, \"Recognizer\");\n this.privRecognizer.connectMeetingCallbacks(this);\n\n marshalPromiseToCallbacks(meetingImpl.connectTranscriberRecognizer(this.privRecognizer), cb, err);\n }\n\n /**\n * Starts meeting transcription, until stopTranscribingAsync() is called.\n * User must subscribe to events to receive transcription results.\n * @member MeetingTranscriber.prototype.startTranscribingAsync\n * @function\n * @public\n * @param cb - Callback invoked once the transcription has started.\n * @param err - Callback invoked in case of an error.\n */\n public startTranscribingAsync(cb?: Callback, err?: Callback): void {\n this.privRecognizer.startContinuousRecognitionAsync(cb, err);\n }\n\n /**\n * Starts meeting transcription, until stopTranscribingAsync() is called.\n * User must subscribe to events to receive transcription results.\n * @member MeetingTranscriber.prototype.stopTranscribingAsync\n * @function\n * @public\n * @param cb - Callback invoked once the transcription has started.\n * @param err - Callback invoked in case of an error.\n */\n public stopTranscribingAsync(cb?: Callback, err?: Callback): void {\n this.privRecognizer.stopContinuousRecognitionAsync(cb, err);\n }\n\n /**\n * Leave the current meeting. After this is called, you will no longer receive any events.\n */\n public leaveMeetingAsync(cb?: Callback, err?: Callback): void {\n this.privRecognizer.disconnectCallbacks();\n // eslint-disable-next-line\n marshalPromiseToCallbacks((async (): Promise<void> => { return; })(), cb, err);\n }\n\n /**\n * closes all external resources held by an instance of this class.\n * @member MeetingTranscriber.prototype.close\n * @function\n * @public\n */\n public close(cb?: () => void, errorCb?: (error: string) => void): void {\n Contracts.throwIfDisposed(this.privDisposedRecognizer);\n marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\n }\n\n /**\n * Disposes any resources held by the object.\n * @member MeetingTranscriber.prototype.dispose\n * @function\n * @public\n * @param {boolean} disposing - true if disposing the object.\n */\n protected async dispose(disposing: boolean): Promise<void> {\n if (this.privDisposedRecognizer) {\n return;\n }\n if (!!this.privRecognizer) {\n await this.privRecognizer.close();\n this.privRecognizer = undefined;\n }\n if (disposing) {\n this.privDisposedRecognizer = true;\n }\n }\n}\n"]}