5cd03b8d69602708810337919b87d49d86c46dc014fed833dc5fd3d4dbe9ba85.json 17 KB

1
  1. {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar _asyncToGenerator = require(\"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.MeetingTranscriber = void 0;\nconst Exports_js_1 = require(\"../../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"../../common/Exports.js\");\nconst Contracts_js_1 = require(\"../Contracts.js\");\nconst Exports_js_3 = require(\"../Exports.js\");\nconst Exports_js_4 = require(\"./Exports.js\");\nclass MeetingTranscriber {\n /**\n * MeetingTranscriber constructor.\n * @constructor\n * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\n */\n constructor(audioConfig) {\n this.privAudioConfig = audioConfig;\n this.privProperties = new Exports_js_3.PropertyCollection();\n this.privRecognizer = undefined;\n this.privDisposedRecognizer = false;\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 get speechRecognitionLanguage() {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedRecognizer);\n return this.properties.getProperty(Exports_js_3.PropertyId.SpeechServiceConnection_RecoLanguage);\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 get properties() {\n return this.privProperties;\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 get internalData() {\n return this.privRecognizer.internalData;\n }\n /**\n * @Deprecated\n * @Obsolete\n * Please use the Connection.fromRecognizer pattern to obtain a connection object\n */\n get connection() {\n return Exports_js_3.Connection.fromRecognizer(this.privRecognizer);\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 get authorizationToken() {\n return this.properties.getProperty(Exports_js_3.PropertyId.SpeechServiceAuthorization_Token);\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 set authorizationToken(token) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(Exports_js_3.PropertyId.SpeechServiceAuthorization_Token, token);\n }\n /**\n * @param {Meeting} meeting - meeting to be recognized\n */\n joinMeetingAsync(meeting, cb, err) {\n /* eslint-disable no-console */\n // console.log(\">> MeetingTranscriber::joinMeetingAsync\");\n /* eslint-enable no-console */\n const meetingImpl = meeting;\n Contracts_js_1.Contracts.throwIfNullOrUndefined(Exports_js_4.MeetingImpl, \"Meeting\");\n // ref the meeting object\n // create recognizer and subscribe to recognizer events\n this.privRecognizer = new Exports_js_1.TranscriberRecognizer(meeting.config, this.privAudioConfig);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(this.privRecognizer, \"Recognizer\");\n this.privRecognizer.connectMeetingCallbacks(this);\n Exports_js_2.marshalPromiseToCallbacks(meetingImpl.connectTranscriberRecognizer(this.privRecognizer), cb, err);\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 startTranscribingAsync(cb, err) {\n this.privRecognizer.startContinuousRecognitionAsync(cb, err);\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 stopTranscribingAsync(cb, err) {\n this.privRecognizer.stopContinuousRecognitionAsync(cb, err);\n }\n /**\n * Leave the current meeting. After this is called, you will no longer receive any events.\n */\n leaveMeetingAsync(cb, err) {\n this.privRecognizer.disconnectCallbacks();\n // eslint-disable-next-line\n Exports_js_2.marshalPromiseToCallbacks(_asyncToGenerator(function* () {\n return;\n })(), cb, err);\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 close(cb, errorCb) {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedRecognizer);\n Exports_js_2.marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\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 dispose(disposing) {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (_this.privDisposedRecognizer) {\n return;\n }\n if (!!_this.privRecognizer) {\n yield _this.privRecognizer.close();\n _this.privRecognizer = undefined;\n }\n if (disposing) {\n _this.privDisposedRecognizer = true;\n }\n })();\n }\n}\nexports.MeetingTranscriber = MeetingTranscriber;","map":{"version":3,"names":["_asyncToGenerator","require","default","Object","defineProperty","exports","value","MeetingTranscriber","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Exports_js_4","constructor","audioConfig","privAudioConfig","privProperties","PropertyCollection","privRecognizer","undefined","privDisposedRecognizer","speechRecognitionLanguage","Contracts","throwIfDisposed","properties","getProperty","PropertyId","SpeechServiceConnection_RecoLanguage","internalData","connection","Connection","fromRecognizer","authorizationToken","SpeechServiceAuthorization_Token","token","throwIfNullOrWhitespace","setProperty","joinMeetingAsync","meeting","cb","err","meetingImpl","throwIfNullOrUndefined","MeetingImpl","TranscriberRecognizer","config","connectMeetingCallbacks","marshalPromiseToCallbacks","connectTranscriberRecognizer","startTranscribingAsync","startContinuousRecognitionAsync","stopTranscribingAsync","stopContinuousRecognitionAsync","leaveMeetingAsync","disconnectCallbacks","close","errorCb","dispose","disposing","_this"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/MeetingTranscriber.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MeetingTranscriber = void 0;\nconst Exports_js_1 = require(\"../../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"../../common/Exports.js\");\nconst Contracts_js_1 = require(\"../Contracts.js\");\nconst Exports_js_3 = require(\"../Exports.js\");\nconst Exports_js_4 = require(\"./Exports.js\");\nclass MeetingTranscriber {\n /**\n * MeetingTranscriber constructor.\n * @constructor\n * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\n */\n constructor(audioConfig) {\n this.privAudioConfig = audioConfig;\n this.privProperties = new Exports_js_3.PropertyCollection();\n this.privRecognizer = undefined;\n this.privDisposedRecognizer = false;\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 get speechRecognitionLanguage() {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedRecognizer);\n return this.properties.getProperty(Exports_js_3.PropertyId.SpeechServiceConnection_RecoLanguage);\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 get properties() {\n return this.privProperties;\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 get internalData() {\n return this.privRecognizer.internalData;\n }\n /**\n * @Deprecated\n * @Obsolete\n * Please use the Connection.fromRecognizer pattern to obtain a connection object\n */\n get connection() {\n return Exports_js_3.Connection.fromRecognizer(this.privRecognizer);\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 get authorizationToken() {\n return this.properties.getProperty(Exports_js_3.PropertyId.SpeechServiceAuthorization_Token);\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 set authorizationToken(token) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(Exports_js_3.PropertyId.SpeechServiceAuthorization_Token, token);\n }\n /**\n * @param {Meeting} meeting - meeting to be recognized\n */\n joinMeetingAsync(meeting, cb, err) {\n /* eslint-disable no-console */\n // console.log(\">> MeetingTranscriber::joinMeetingAsync\");\n /* eslint-enable no-console */\n const meetingImpl = meeting;\n Contracts_js_1.Contracts.throwIfNullOrUndefined(Exports_js_4.MeetingImpl, \"Meeting\");\n // ref the meeting object\n // create recognizer and subscribe to recognizer events\n this.privRecognizer = new Exports_js_1.TranscriberRecognizer(meeting.config, this.privAudioConfig);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(this.privRecognizer, \"Recognizer\");\n this.privRecognizer.connectMeetingCallbacks(this);\n Exports_js_2.marshalPromiseToCallbacks(meetingImpl.connectTranscriberRecognizer(this.privRecognizer), cb, err);\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 startTranscribingAsync(cb, err) {\n this.privRecognizer.startContinuousRecognitionAsync(cb, err);\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 stopTranscribingAsync(cb, err) {\n this.privRecognizer.stopContinuousRecognitionAsync(cb, err);\n }\n /**\n * Leave the current meeting. After this is called, you will no longer receive any events.\n */\n leaveMeetingAsync(cb, err) {\n this.privRecognizer.disconnectCallbacks();\n // eslint-disable-next-line\n Exports_js_2.marshalPromiseToCallbacks((async () => { return; })(), cb, err);\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 close(cb, errorCb) {\n Contracts_js_1.Contracts.throwIfDisposed(this.privDisposedRecognizer);\n Exports_js_2.marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\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 async dispose(disposing) {\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}\nexports.MeetingTranscriber = MeetingTranscriber;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AAAA,IAAAA,iBAAA,GAAAC,OAAA,qGAAAC,OAAA;AACAC,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,kBAAkB,GAAG,KAAK,CAAC;AACnC,MAAMC,YAAY,GAAGP,OAAO,CAAC,gCAAgC,CAAC;AAC9D,MAAMQ,YAAY,GAAGR,OAAO,CAAC,yBAAyB,CAAC;AACvD,MAAMS,cAAc,GAAGT,OAAO,CAAC,iBAAiB,CAAC;AACjD,MAAMU,YAAY,GAAGV,OAAO,CAAC,eAAe,CAAC;AAC7C,MAAMW,YAAY,GAAGX,OAAO,CAAC,cAAc,CAAC;AAC5C,MAAMM,kBAAkB,CAAC;EACrB;AACJ;AACA;AACA;AACA;EACIM,WAAWA,CAACC,WAAW,EAAE;IACr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Ac,CAACY,SAAS,CAACC,eAAe,CAAC,IAAI,CAACH,sBAAsB,CAAC;IACrEX,YAAY,CAACsC,yBAAyB,CAAC,IAAI,CAACU,OAAO,CAAC,IAAI,CAAC,EAAElB,EAAE,EAAEiB,OAAO,CAAC;EAC3E;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACUC,OAAOA,CAACC,SAAS,EAAE;IAAA,IAAAC,KAAA;IAAA,OAAA3D,iBAAA;MACrB,IAAI2D,KAAI,CAACvC,sBAAsB,EAAE;QAC7B;MACJ;MACA,IAAI,CAAC,CAACuC,KAAI,CAACzC,cAAc,EAAE;QACvB,MAAMyC,KAAI,CAACzC,cAAc,CAACqC,KAAK,CAAC,CAAC;QACjCI,KAAI,CAACzC,cAAc,GAAGC,SAAS;MACnC;MACA,IAAIuC,SAAS,EAAE;QACXC,KAAI,CAACvC,sBAAsB,GAAG,IAAI;MACtC;IAAC;EACL;AACJ;AACAf,OAAO,CAACE,kBAAkB,GAAGA,kBAAkB","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}