speechrecorderng 3.3.1 → 3.3.2
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/esm2020/lib/audio/playback/player.mjs +2 -2
- package/esm2020/lib/speechrecorder/session/sessionmanager.mjs +153 -148
- package/esm2020/lib/spr.module.version.mjs +2 -2
- package/fesm2015/speechrecorderng.mjs +154 -149
- package/fesm2015/speechrecorderng.mjs.map +1 -1
- package/fesm2020/speechrecorderng.mjs +154 -149
- package/fesm2020/speechrecorderng.mjs.map +1 -1
- package/lib/speechrecorder/session/sessionmanager.d.ts +1 -0
- package/lib/spr.module.version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2548,6 +2548,7 @@ class AudioPlayer {
|
|
|
2548
2548
|
return this._stopAction;
|
|
2549
2549
|
}
|
|
2550
2550
|
set audioClip(audioClip) {
|
|
2551
|
+
this._audioClip = audioClip;
|
|
2551
2552
|
let length = 0;
|
|
2552
2553
|
let chs = 0;
|
|
2553
2554
|
if (audioClip && audioClip.audioDataHolder) {
|
|
@@ -2570,7 +2571,6 @@ class AudioPlayer {
|
|
|
2570
2571
|
else {
|
|
2571
2572
|
this.audioSource = null;
|
|
2572
2573
|
}
|
|
2573
|
-
this._audioClip = audioClip;
|
|
2574
2574
|
}
|
|
2575
2575
|
get audioSource() {
|
|
2576
2576
|
return this._audioSource;
|
|
@@ -13031,7 +13031,7 @@ class SessionManager extends BasicRecorder {
|
|
|
13031
13031
|
this.transportActions.fwdAction.disabled = true;
|
|
13032
13032
|
this.transportActions.fwdNextAction.disabled = true;
|
|
13033
13033
|
this.transportActions.bwdAction.disabled = true;
|
|
13034
|
-
this.
|
|
13034
|
+
this.updateDisplayRecFile(null);
|
|
13035
13035
|
this.displayRecFileVersion = 0;
|
|
13036
13036
|
this.displayAudioClip = null;
|
|
13037
13037
|
this.liveLevelDisplay.reset(true);
|
|
@@ -13129,6 +13129,9 @@ class SessionManager extends BasicRecorder {
|
|
|
13129
13129
|
}
|
|
13130
13130
|
set displayRecFile(displayRecFile) {
|
|
13131
13131
|
this._displayRecFile = displayRecFile;
|
|
13132
|
+
}
|
|
13133
|
+
updateDisplayRecFile(displayRecFile, fetchAndApplyRecordingFile = true) {
|
|
13134
|
+
this.displayRecFile = displayRecFile;
|
|
13132
13135
|
if (this._displayRecFile) {
|
|
13133
13136
|
if (this.items) {
|
|
13134
13137
|
this.items.currentRecordingFile = this._displayRecFile;
|
|
@@ -13145,47 +13148,88 @@ class SessionManager extends BasicRecorder {
|
|
|
13145
13148
|
if (this.controlAudioPlayer) {
|
|
13146
13149
|
this.controlAudioPlayer.audioClip = null;
|
|
13147
13150
|
}
|
|
13148
|
-
if (
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13151
|
+
if (fetchAndApplyRecordingFile) {
|
|
13152
|
+
if (this._controlAudioPlayer && this._session) {
|
|
13153
|
+
//... and try to fetch from server
|
|
13154
|
+
this.liveLevelDisplayState = State.LOADING;
|
|
13155
|
+
const rf = this._displayRecFile;
|
|
13156
|
+
let audioDownloadType = this._clientAudioStorageType;
|
|
13157
|
+
if (AudioStorageType.MEM_ENTIRE_AUTO_NET_CHUNKED === this._clientAudioStorageType || AudioStorageType.MEM_CHUNKED_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
|
|
13158
|
+
// Default is network mode
|
|
13159
|
+
audioDownloadType = AudioStorageType.NET_CHUNKED;
|
|
13160
|
+
if (rf.channels && rf.frames) {
|
|
13161
|
+
const samples = rf.channels * rf.frames;
|
|
13162
|
+
if (samples <= this._maxAutoNetMemStoreSamples) {
|
|
13163
|
+
// But if audio file is small, load in continuous resp. chunked mode
|
|
13164
|
+
if (AudioStorageType.MEM_ENTIRE_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
|
|
13165
|
+
audioDownloadType = AudioStorageType.MEM_ENTIRE;
|
|
13166
|
+
}
|
|
13167
|
+
else if (AudioStorageType.MEM_CHUNKED_AUTO_NET_CHUNKED === this._clientAudioStorageType) {
|
|
13168
|
+
audioDownloadType = AudioStorageType.MEM_CHUNKED;
|
|
13169
|
+
}
|
|
13165
13170
|
}
|
|
13166
13171
|
}
|
|
13167
13172
|
}
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13173
|
+
console.debug("Audio download type: " + audioDownloadType);
|
|
13174
|
+
if (AudioStorageType.DB_CHUNKED === this._clientAudioStorageType) {
|
|
13175
|
+
// Fetch chunked indexed db audio buffer
|
|
13176
|
+
let nextIab = null;
|
|
13177
|
+
if (!this._persistentAudioStorageTarget) {
|
|
13178
|
+
throw Error('Error: Persistent storage target not set.');
|
|
13179
|
+
}
|
|
13180
|
+
else {
|
|
13181
|
+
//console.debug("Fetch audio and store to indexed db...");
|
|
13182
|
+
this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileIndDbAudioBuffer(this._controlAudioPlayer.context, this._persistentAudioStorageTarget, this._session.project, rf).subscribe({
|
|
13183
|
+
next: (iab) => {
|
|
13184
|
+
//console.debug("Sessionmanager: Received inddb audio buffer: "+iab);
|
|
13185
|
+
nextIab = iab;
|
|
13186
|
+
},
|
|
13187
|
+
complete: () => {
|
|
13188
|
+
this.liveLevelDisplayState = State.READY;
|
|
13189
|
+
let fabDh = null;
|
|
13190
|
+
if (nextIab) {
|
|
13191
|
+
if (rf && this.items) {
|
|
13192
|
+
fabDh = new AudioDataHolder(nextIab);
|
|
13193
|
+
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13194
|
+
}
|
|
13195
|
+
}
|
|
13196
|
+
else {
|
|
13197
|
+
// Should actually be handled by the error resolver
|
|
13198
|
+
this.statusMsg = 'Recording file could not be loaded.';
|
|
13199
|
+
this.statusAlertType = 'error';
|
|
13200
|
+
}
|
|
13201
|
+
if (fabDh) {
|
|
13202
|
+
// this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
|
|
13203
|
+
this.displayAudioClip = new AudioClip(fabDh);
|
|
13204
|
+
}
|
|
13205
|
+
this.controlAudioPlayer.audioClip = this.displayAudioClip;
|
|
13206
|
+
this.showRecording();
|
|
13207
|
+
},
|
|
13208
|
+
error: err => {
|
|
13209
|
+
console.error("Could not load recording file from server: " + err);
|
|
13210
|
+
this.liveLevelDisplayState = State.READY;
|
|
13211
|
+
this.statusMsg = 'Recording file could not be loaded: ' + err;
|
|
13212
|
+
this.statusAlertType = 'error';
|
|
13213
|
+
this.changeDetectorRef.detectChanges();
|
|
13214
|
+
}
|
|
13215
|
+
});
|
|
13216
|
+
}
|
|
13175
13217
|
}
|
|
13176
|
-
else {
|
|
13177
|
-
//
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13218
|
+
else if (AudioStorageType.NET_CHUNKED === audioDownloadType) {
|
|
13219
|
+
// Fetch chunked audio buffer from network
|
|
13220
|
+
let nextNetAb = null;
|
|
13221
|
+
//console.debug("Fetch chunked audio from network");
|
|
13222
|
+
this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileNetAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
|
|
13223
|
+
next: (netAb) => {
|
|
13224
|
+
//console.debug("Sessionmanager: Received net audio buffer: "+netAb);
|
|
13225
|
+
nextNetAb = netAb;
|
|
13182
13226
|
},
|
|
13183
13227
|
complete: () => {
|
|
13184
13228
|
this.liveLevelDisplayState = State.READY;
|
|
13185
13229
|
let fabDh = null;
|
|
13186
|
-
if (
|
|
13230
|
+
if (nextNetAb) {
|
|
13187
13231
|
if (rf && this.items) {
|
|
13188
|
-
fabDh = new AudioDataHolder(
|
|
13232
|
+
fabDh = new AudioDataHolder(nextNetAb);
|
|
13189
13233
|
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13190
13234
|
}
|
|
13191
13235
|
}
|
|
@@ -13196,6 +13240,7 @@ class SessionManager extends BasicRecorder {
|
|
|
13196
13240
|
}
|
|
13197
13241
|
if (fabDh) {
|
|
13198
13242
|
// this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
|
|
13243
|
+
//console.debug("set displayRecFile(): fetch net ab complete, set displayAudioClip.")
|
|
13199
13244
|
this.displayAudioClip = new AudioClip(fabDh);
|
|
13200
13245
|
}
|
|
13201
13246
|
this.controlAudioPlayer.audioClip = this.displayAudioClip;
|
|
@@ -13210,126 +13255,86 @@ class SessionManager extends BasicRecorder {
|
|
|
13210
13255
|
}
|
|
13211
13256
|
});
|
|
13212
13257
|
}
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13258
|
+
else if (AudioStorageType.MEM_CHUNKED === audioDownloadType) {
|
|
13259
|
+
// Fetch chunked array audio buffer
|
|
13260
|
+
let nextAab = null;
|
|
13261
|
+
//console.debug("Fetch audio and store to (chunked) array buffer...");
|
|
13262
|
+
this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileArrayAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
|
|
13263
|
+
next: (aab) => {
|
|
13264
|
+
nextAab = aab;
|
|
13265
|
+
},
|
|
13266
|
+
complete: () => {
|
|
13267
|
+
this.liveLevelDisplayState = State.READY;
|
|
13268
|
+
let fabDh = null;
|
|
13269
|
+
if (nextAab) {
|
|
13270
|
+
if (rf && this.items) {
|
|
13271
|
+
fabDh = new AudioDataHolder(nextAab);
|
|
13272
|
+
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13273
|
+
}
|
|
13230
13274
|
}
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
this.statusAlertType = 'error';
|
|
13236
|
-
}
|
|
13237
|
-
if (fabDh) {
|
|
13238
|
-
// this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
|
|
13239
|
-
//console.debug("set displayRecFile(): fetch net ab complete, set displayAudioClip.")
|
|
13240
|
-
this.displayAudioClip = new AudioClip(fabDh);
|
|
13241
|
-
}
|
|
13242
|
-
this.controlAudioPlayer.audioClip = this.displayAudioClip;
|
|
13243
|
-
this.showRecording();
|
|
13244
|
-
},
|
|
13245
|
-
error: err => {
|
|
13246
|
-
console.error("Could not load recording file from server: " + err);
|
|
13247
|
-
this.liveLevelDisplayState = State.READY;
|
|
13248
|
-
this.statusMsg = 'Recording file could not be loaded: ' + err;
|
|
13249
|
-
this.statusAlertType = 'error';
|
|
13250
|
-
this.changeDetectorRef.detectChanges();
|
|
13251
|
-
}
|
|
13252
|
-
});
|
|
13253
|
-
}
|
|
13254
|
-
else if (AudioStorageType.MEM_CHUNKED === audioDownloadType) {
|
|
13255
|
-
// Fetch chunked array audio buffer
|
|
13256
|
-
let nextAab = null;
|
|
13257
|
-
//console.debug("Fetch audio and store to (chunked) array buffer...");
|
|
13258
|
-
this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileArrayAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
|
|
13259
|
-
next: (aab) => {
|
|
13260
|
-
nextAab = aab;
|
|
13261
|
-
},
|
|
13262
|
-
complete: () => {
|
|
13263
|
-
this.liveLevelDisplayState = State.READY;
|
|
13264
|
-
let fabDh = null;
|
|
13265
|
-
if (nextAab) {
|
|
13266
|
-
if (rf && this.items) {
|
|
13267
|
-
fabDh = new AudioDataHolder(nextAab);
|
|
13268
|
-
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13275
|
+
else {
|
|
13276
|
+
// Should actually be handled by the error resolver
|
|
13277
|
+
this.statusMsg = 'Recording file could not be loaded.';
|
|
13278
|
+
this.statusAlertType = 'error';
|
|
13269
13279
|
}
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13280
|
+
if (fabDh) {
|
|
13281
|
+
// this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
|
|
13282
|
+
this.displayAudioClip = new AudioClip(fabDh);
|
|
13283
|
+
}
|
|
13284
|
+
this.controlAudioPlayer.audioClip = this.displayAudioClip;
|
|
13285
|
+
this.showRecording();
|
|
13286
|
+
},
|
|
13287
|
+
error: err => {
|
|
13288
|
+
console.error("Could not load recording file from server: " + err);
|
|
13289
|
+
this.liveLevelDisplayState = State.READY;
|
|
13290
|
+
this.statusMsg = 'Recording file could not be loaded: ' + err;
|
|
13274
13291
|
this.statusAlertType = 'error';
|
|
13275
13292
|
}
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
next: (ab) => {
|
|
13296
|
-
this.liveLevelDisplayState = State.READY;
|
|
13297
|
-
let fabDh = null;
|
|
13298
|
-
if (ab) {
|
|
13299
|
-
if (rf && this.items) {
|
|
13300
|
-
if (SessionManager.FORCE_ARRRAY_AUDIO_BUFFER) {
|
|
13301
|
-
let aab = ArrayAudioBuffer.fromAudioBuffer(ab);
|
|
13302
|
-
fabDh = new AudioDataHolder(aab);
|
|
13303
|
-
}
|
|
13304
|
-
else {
|
|
13305
|
-
fabDh = new AudioDataHolder(new AudioBufferSource(ab));
|
|
13293
|
+
});
|
|
13294
|
+
}
|
|
13295
|
+
else {
|
|
13296
|
+
// Fetch regular audio buffer
|
|
13297
|
+
//console.debug("Fetch audio and store to audio buffer...");
|
|
13298
|
+
this.audioFetchSubscription = this.recFileService.fetchSprRecordingFileAudioBuffer(this._controlAudioPlayer.context, this._session.project, rf).subscribe({
|
|
13299
|
+
next: (ab) => {
|
|
13300
|
+
this.liveLevelDisplayState = State.READY;
|
|
13301
|
+
let fabDh = null;
|
|
13302
|
+
if (ab) {
|
|
13303
|
+
if (rf && this.items) {
|
|
13304
|
+
if (SessionManager.FORCE_ARRRAY_AUDIO_BUFFER) {
|
|
13305
|
+
let aab = ArrayAudioBuffer.fromAudioBuffer(ab);
|
|
13306
|
+
fabDh = new AudioDataHolder(aab);
|
|
13307
|
+
}
|
|
13308
|
+
else {
|
|
13309
|
+
fabDh = new AudioDataHolder(new AudioBufferSource(ab));
|
|
13310
|
+
}
|
|
13311
|
+
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13306
13312
|
}
|
|
13307
|
-
this.items.setSprRecFileAudioData(rf, fabDh);
|
|
13308
13313
|
}
|
|
13309
|
-
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13314
|
+
else {
|
|
13315
|
+
// Should actually be handled by the error resolver
|
|
13316
|
+
this.statusMsg = 'Recording file could not be loaded.';
|
|
13317
|
+
this.statusAlertType = 'error';
|
|
13318
|
+
}
|
|
13319
|
+
if (fabDh) {
|
|
13320
|
+
// this.displayAudioClip could have been changed meanwhile, but the recorder unsubcribes before changing the item, therefore there should be no risk to set to wrong item
|
|
13321
|
+
this.displayAudioClip = new AudioClip(fabDh);
|
|
13322
|
+
}
|
|
13323
|
+
this.controlAudioPlayer.audioClip = this.displayAudioClip;
|
|
13324
|
+
this.showRecording();
|
|
13325
|
+
}, error: err => {
|
|
13326
|
+
console.error("Could not load recording file from server: " + err);
|
|
13327
|
+
this.liveLevelDisplayState = State.READY;
|
|
13328
|
+
this.statusMsg = 'Recording file could not be loaded: ' + err;
|
|
13313
13329
|
this.statusAlertType = 'error';
|
|
13314
13330
|
}
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
}, error: err => {
|
|
13322
|
-
console.error("Could not load recording file from server: " + err);
|
|
13323
|
-
this.liveLevelDisplayState = State.READY;
|
|
13324
|
-
this.statusMsg = 'Recording file could not be loaded: ' + err;
|
|
13325
|
-
this.statusAlertType = 'error';
|
|
13326
|
-
}
|
|
13327
|
-
});
|
|
13331
|
+
});
|
|
13332
|
+
}
|
|
13333
|
+
}
|
|
13334
|
+
else {
|
|
13335
|
+
this.statusMsg = 'Recording file could not be decoded. Audio context unavailable.';
|
|
13336
|
+
this.statusAlertType = 'error';
|
|
13328
13337
|
}
|
|
13329
|
-
}
|
|
13330
|
-
else {
|
|
13331
|
-
this.statusMsg = 'Recording file could not be decoded. Audio context unavailable.';
|
|
13332
|
-
this.statusAlertType = 'error';
|
|
13333
13338
|
}
|
|
13334
13339
|
}
|
|
13335
13340
|
}
|
|
@@ -13369,7 +13374,7 @@ class SessionManager extends BasicRecorder {
|
|
|
13369
13374
|
this.applyPrompt();
|
|
13370
13375
|
}
|
|
13371
13376
|
if (isNonrecording) {
|
|
13372
|
-
this.
|
|
13377
|
+
this.updateDisplayRecFile(null);
|
|
13373
13378
|
this.displayRecFileVersion = 0;
|
|
13374
13379
|
this.startStopSignalState = 4 /* OFF */;
|
|
13375
13380
|
}
|
|
@@ -13384,11 +13389,11 @@ class SessionManager extends BasicRecorder {
|
|
|
13384
13389
|
if (availRecfiles > 0) {
|
|
13385
13390
|
let rfVers = availRecfiles - 1;
|
|
13386
13391
|
recentRecFile = it.recs[rfVers];
|
|
13387
|
-
this.
|
|
13392
|
+
this.updateDisplayRecFile(recentRecFile, !temporary);
|
|
13388
13393
|
this.displayRecFileVersion = rfVers;
|
|
13389
13394
|
}
|
|
13390
13395
|
else {
|
|
13391
|
-
this.
|
|
13396
|
+
this.updateDisplayRecFile(null);
|
|
13392
13397
|
this.displayRecFileVersion = 0;
|
|
13393
13398
|
}
|
|
13394
13399
|
}
|
|
@@ -17437,7 +17442,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
17437
17442
|
}]
|
|
17438
17443
|
}] });
|
|
17439
17444
|
|
|
17440
|
-
const VERSION = '3.3.
|
|
17445
|
+
const VERSION = '3.3.2';
|
|
17441
17446
|
|
|
17442
17447
|
/*
|
|
17443
17448
|
* Public API Surface of speechrecorderng
|