@lls/lls-audio 0.0.75 → 0.0.77
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/package.json +4 -4
- package/recorder/index.js +4 -2
- package/wordDetector/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lls/lls-audio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@kadira/storybook": "2.21.0",
|
|
7
7
|
"@kadira/storybook-deployer": "1.0.0",
|
|
8
8
|
"@lls/lls-icons": "*",
|
|
9
9
|
"@lls/lls-ui": "*",
|
|
10
|
-
"aphrodite": "
|
|
10
|
+
"aphrodite": "1.2.3",
|
|
11
11
|
"babel-cli": "6.9.0",
|
|
12
12
|
"babel-preset-es2015": "6.3.13",
|
|
13
13
|
"babel-preset-react": "6.3.13",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"react-input-range": "0.9.3",
|
|
30
30
|
"react-speech-recognizer": "0.1.1",
|
|
31
31
|
"similarity": "1.1.1",
|
|
32
|
-
"waveform-data": "2.0.
|
|
32
|
+
"waveform-data": "2.0.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@lls/lls-icons": "*",
|
|
36
36
|
"@lls/lls-ui": "*",
|
|
37
|
-
"aphrodite": "
|
|
37
|
+
"aphrodite": "^1.2.3",
|
|
38
38
|
"react": "*",
|
|
39
39
|
"react-dom": "*"
|
|
40
40
|
},
|
package/recorder/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
|
|
40
40
|
|
|
41
41
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
42
42
|
|
|
43
|
-
var audioContext = new _audioContext2.default();
|
|
43
|
+
var audioContext = _audioContext2.default ? new _audioContext2.default() : null;
|
|
44
44
|
|
|
45
45
|
// make the volume a value between 0 and 100
|
|
46
46
|
var formatVolume = function formatVolume(volume) {
|
|
@@ -161,6 +161,9 @@ var Recorder = function (_Component) {
|
|
|
161
161
|
_props$onRecordComple = props.onRecordComplete,
|
|
162
162
|
onRecordComplete = _props$onRecordComple === undefined ? function () {} : _props$onRecordComple;
|
|
163
163
|
|
|
164
|
+
if (!audioContext) {
|
|
165
|
+
return onNotAvailable();
|
|
166
|
+
}
|
|
164
167
|
|
|
165
168
|
(0, _mediaDevices.shimMediaDevices)();
|
|
166
169
|
|
|
@@ -216,7 +219,6 @@ var Recorder = function (_Component) {
|
|
|
216
219
|
stream: stream,
|
|
217
220
|
onStoppedSpeaking: function onStoppedSpeaking() {
|
|
218
221
|
try {
|
|
219
|
-
console.log("exportWAV");
|
|
220
222
|
_this3.worker.postMessage({ command: 'exportWAV', beginning: _this3.recordStart, end: Date.now() });
|
|
221
223
|
} catch (e) {
|
|
222
224
|
onError(e);
|
package/wordDetector/index.js
CHANGED
|
@@ -117,7 +117,7 @@ var WordDetector = function (_Component) {
|
|
|
117
117
|
}
|
|
118
118
|
}, {
|
|
119
119
|
key: 'onApiResult',
|
|
120
|
-
value: function onApiResult(_ref) {
|
|
120
|
+
value: function onApiResult(_ref, wav) {
|
|
121
121
|
var speechToText = _ref.speechToText,
|
|
122
122
|
url = _ref.url;
|
|
123
123
|
|
|
@@ -149,7 +149,7 @@ var WordDetector = function (_Component) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
sendFileToSpeechToTextApi(API_URL, wav).then(function (res) {
|
|
152
|
-
_this2.onApiResult(JSON.parse(res));
|
|
152
|
+
_this2.onApiResult(JSON.parse(res), wav);
|
|
153
153
|
}).catch(function (e) {
|
|
154
154
|
_this2.onError(e);
|
|
155
155
|
});
|