@lls/lls-audio 0.0.70 → 0.0.71
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 +1 -1
- package/recorder/index.js +16 -0
package/package.json
CHANGED
package/recorder/index.js
CHANGED
|
@@ -115,6 +115,7 @@ var Recorder = function (_Component) {
|
|
|
115
115
|
// Data
|
|
116
116
|
_this.recordStart = null;
|
|
117
117
|
_this.audioBuffer = [];
|
|
118
|
+
_this.audioStream = null;
|
|
118
119
|
|
|
119
120
|
// Methods
|
|
120
121
|
_this.init = _this.init.bind(_this);
|
|
@@ -127,6 +128,20 @@ var Recorder = function (_Component) {
|
|
|
127
128
|
value: function componentDidMount() {
|
|
128
129
|
this.init(this.props);
|
|
129
130
|
}
|
|
131
|
+
}, {
|
|
132
|
+
key: 'componentWillUnmount',
|
|
133
|
+
value: function componentWillUnmount() {
|
|
134
|
+
if (this.audioStream.getTracks) {
|
|
135
|
+
var tracks = this.audioStream.getTracks();
|
|
136
|
+
tracks.forEach(function (track) {
|
|
137
|
+
return track.stop();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.audioStream.stop && this.audioStream.stop();
|
|
142
|
+
|
|
143
|
+
this.speechEvents.stop();
|
|
144
|
+
}
|
|
130
145
|
}, {
|
|
131
146
|
key: 'init',
|
|
132
147
|
value: function init(props) {
|
|
@@ -166,6 +181,7 @@ var Recorder = function (_Component) {
|
|
|
166
181
|
onRecordComplete = _ref4.onRecordComplete;
|
|
167
182
|
|
|
168
183
|
// Init worker that will do heavy calculation
|
|
184
|
+
this.audioStream = stream;
|
|
169
185
|
this.worker = initWorker({ onMessage: function onMessage(e) {
|
|
170
186
|
switch (e.data.command) {
|
|
171
187
|
case 'send_buffers':
|