speechrecorderng 2.23.9 → 2.24.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.
@@ -22,6 +22,7 @@ import { MatButtonModule } from '@angular/material/button';
22
22
  import * as i1$3 from '@angular/material/progress-spinner';
23
23
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
24
24
  import * as i8 from '@angular/flex-layout/flex';
25
+ import NoSleep from 'nosleep.js';
25
26
  import * as i7 from '@angular/material/progress-bar';
26
27
  import { MatProgressBarModule } from '@angular/material/progress-bar';
27
28
  import { FlexLayoutModule } from '@angular/flex-layout';
@@ -1046,17 +1047,45 @@ class AudioCapture {
1046
1047
  this._opened = false;
1047
1048
  }
1048
1049
  audioBuffer() {
1049
- var frameLen = 0;
1050
- var ch0Data = this.data[0];
1051
- for (var ch0Chk of ch0Data) {
1050
+ let frameLen = 0;
1051
+ let ch0Data = this.data[0];
1052
+ for (let ch0Chk of ch0Data) {
1052
1053
  frameLen += ch0Chk.length;
1053
1054
  }
1054
- var ab = this.context.createBuffer(this.channelCount, frameLen, this.context.sampleRate);
1055
- for (var ch = 0; ch < this.channelCount; ch++) {
1056
- var chD = ab.getChannelData(ch);
1057
- var pos = 0;
1058
- for (var chChk of this.data[ch]) {
1059
- var bufLen = chChk.length;
1055
+ let ab;
1056
+ try {
1057
+ ab = this.context.createBuffer(this.channelCount, frameLen, this.context.sampleRate);
1058
+ }
1059
+ catch (err) {
1060
+ if (err instanceof DOMException) {
1061
+ if (err.name === 'NotSupportedError') {
1062
+ if (frameLen == 0) {
1063
+ // Empty buffers are not supported by Chromium
1064
+ // Create dummy buffer with one sample
1065
+ ab = this.context.createBuffer(this.channelCount, 1, this.context.sampleRate);
1066
+ }
1067
+ else {
1068
+ throw err;
1069
+ }
1070
+ }
1071
+ else {
1072
+ throw err;
1073
+ }
1074
+ }
1075
+ else if (err instanceof RangeError) {
1076
+ // Out of memory
1077
+ // TODO What to do ??
1078
+ throw err;
1079
+ }
1080
+ else {
1081
+ throw err;
1082
+ }
1083
+ }
1084
+ for (let ch = 0; ch < this.channelCount; ch++) {
1085
+ let chD = ab.getChannelData(ch);
1086
+ let pos = 0;
1087
+ for (let chChk of this.data[ch]) {
1088
+ let bufLen = chChk.length;
1060
1089
  chD.set(chChk, pos);
1061
1090
  pos += bufLen;
1062
1091
  }
@@ -7272,6 +7301,7 @@ class BasicRecorder {
7272
7301
  this.readonly = false;
7273
7302
  this.processingRecording = false;
7274
7303
  this.ac = null;
7304
+ this._wakeLock = false;
7275
7305
  this._selectedDeviceId = undefined;
7276
7306
  this._channelCount = 2;
7277
7307
  this._session = null;
@@ -7284,6 +7314,7 @@ class BasicRecorder {
7284
7314
  this.audioFetchSubscription = null;
7285
7315
  this.destroyed = false;
7286
7316
  this.navigationDisabled = true;
7317
+ this.noSleep = null;
7287
7318
  this.userAgent = UserAgentBuilder.userAgent();
7288
7319
  console.debug("Detected platform: " + this.userAgent.detectedPlatform);
7289
7320
  console.debug("Detected browser: " + this.userAgent.detectedBrowser);
@@ -7293,6 +7324,27 @@ class BasicRecorder {
7293
7324
  this.streamLevelMeasure = new StreamLevelMeasure();
7294
7325
  this.selCaptureDeviceId = null;
7295
7326
  }
7327
+ get wakeLock() {
7328
+ return this._wakeLock;
7329
+ }
7330
+ set wakeLock(value) {
7331
+ this._wakeLock = value;
7332
+ }
7333
+ enableWakeLockCond() {
7334
+ if (this.wakeLock === true) {
7335
+ if (!this.noSleep) {
7336
+ this.noSleep = new NoSleep();
7337
+ }
7338
+ if (!this.noSleep.isEnabled) {
7339
+ this.noSleep.enable();
7340
+ }
7341
+ }
7342
+ }
7343
+ disableWakeLockCond() {
7344
+ if (this.noSleep && this.noSleep.isEnabled) {
7345
+ this.noSleep.disable();
7346
+ }
7347
+ }
7296
7348
  set audioDevices(audioDevices) {
7297
7349
  this._audioDevices = audioDevices;
7298
7350
  }
@@ -7889,6 +7941,7 @@ class SessionManager extends BasicRecorder {
7889
7941
  };
7890
7942
  }
7891
7943
  ngOnDestroy() {
7944
+ this.disableWakeLockCond();
7892
7945
  this.destroyed = true;
7893
7946
  // TODO stop capture /playback
7894
7947
  }
@@ -8096,6 +8149,7 @@ class SessionManager extends BasicRecorder {
8096
8149
  }
8097
8150
  }
8098
8151
  startItem() {
8152
+ this.enableWakeLockCond();
8099
8153
  this.transportActions.startAction.disabled = true;
8100
8154
  this.transportActions.pauseAction.disabled = true;
8101
8155
  if (this.readonly) {
@@ -8827,6 +8881,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
8827
8881
  }] } });
8828
8882
 
8829
8883
  class RecorderComponent {
8884
+ constructor(uploader) {
8885
+ this.uploader = uploader;
8886
+ this.dataSaved = true;
8887
+ }
8830
8888
  }
8831
8889
 
8832
8890
  /**
@@ -8879,7 +8937,7 @@ var Mode;
8879
8937
  })(Mode || (Mode = {}));
8880
8938
  class SpeechrecorderngComponent extends RecorderComponent {
8881
8939
  constructor(route, router, changeDetectorRef, sessionsService, projectService, scriptService, recFilesService, uploader) {
8882
- super();
8940
+ super(uploader);
8883
8941
  this.route = route;
8884
8942
  this.router = router;
8885
8943
  this.changeDetectorRef = changeDetectorRef;
@@ -8889,7 +8947,6 @@ class SpeechrecorderngComponent extends RecorderComponent {
8889
8947
  this.recFilesService = recFilesService;
8890
8948
  this.uploader = uploader;
8891
8949
  this._project = null;
8892
- this.dataSaved = true;
8893
8950
  }
8894
8951
  ngOnInit() {
8895
8952
  try {
@@ -8912,6 +8969,8 @@ class SpeechrecorderngComponent extends RecorderComponent {
8912
8969
  }
8913
8970
  }
8914
8971
  ngAfterViewInit() {
8972
+ // let wakeLockSupp=('wakeLock' in navigator);
8973
+ // alert('Wake lock API supported: '+wakeLockSupp);
8915
8974
  if (this.sm.status !== 8 /* ERROR */) {
8916
8975
  let initSuccess = this.init();
8917
8976
  if (initSuccess) {
@@ -8930,39 +8989,39 @@ class SpeechrecorderngComponent extends RecorderComponent {
8930
8989
  }
8931
8990
  }
8932
8991
  fetchSession(sessionId) {
8933
- //Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'statusMsg: Player initialized.'. Current value: 'statusMsg: Fetching session info...'.
8934
- // params.subscribe seems not to be asynchronous
8935
- // this.sm.statusAlertType='info';
8936
- // this.sm.statusMsg = 'Fetching session info...';
8937
- // this.sm.statusWaiting=true;
8938
8992
  let sessObs = this.sessionsService.sessionObserver(sessionId);
8939
8993
  if (sessObs) {
8940
- sessObs.subscribe(sess => {
8941
- this.setSession(sess);
8942
- this.sm.statusAlertType = 'info';
8943
- this.sm.statusMsg = 'Received session info.';
8944
- this.sm.statusWaiting = false;
8945
- if (sess.project) {
8946
- //console.debug("Session associated project: "+sess.project)
8947
- this.projectService.projectObservable(sess.project).subscribe(project => {
8948
- this.project = project;
8994
+ sessObs.subscribe({
8995
+ next: sess => {
8996
+ this.setSession(sess);
8997
+ this.sm.statusAlertType = 'info';
8998
+ this.sm.statusMsg = 'Received session info.';
8999
+ this.sm.statusWaiting = false;
9000
+ if (sess.project) {
9001
+ //console.debug("Session associated project: "+sess.project)
9002
+ this.projectService.projectObservable(sess.project).subscribe({
9003
+ next: (project) => {
9004
+ this.project = project;
9005
+ this.fetchScript(sess);
9006
+ }, error: (reason) => {
9007
+ this.sm.statusMsg = reason;
9008
+ this.sm.statusAlertType = 'error';
9009
+ this.sm.statusWaiting = false;
9010
+ console.error("Error fetching project config: " + reason);
9011
+ }
9012
+ });
9013
+ }
9014
+ else {
9015
+ console.info("Session has no associated project. Using default configuration.");
8949
9016
  this.fetchScript(sess);
8950
- }, reason => {
8951
- this.sm.statusMsg = reason;
8952
- this.sm.statusAlertType = 'error';
8953
- this.sm.statusWaiting = false;
8954
- console.error("Error fetching project config: " + reason);
8955
- });
9017
+ }
9018
+ },
9019
+ error: (reason) => {
9020
+ this.sm.statusMsg = reason;
9021
+ this.sm.statusAlertType = 'error';
9022
+ this.sm.statusWaiting = false;
9023
+ console.error("Error fetching session " + reason);
8956
9024
  }
8957
- else {
8958
- console.info("Session has no associated project. Using default configuration.");
8959
- this.fetchScript(sess);
8960
- }
8961
- }, (reason) => {
8962
- this.sm.statusMsg = reason;
8963
- this.sm.statusAlertType = 'error';
8964
- this.sm.statusWaiting = false;
8965
- console.error("Error fetching session " + reason);
8966
9025
  });
8967
9026
  }
8968
9027
  }
@@ -8971,19 +9030,21 @@ class SpeechrecorderngComponent extends RecorderComponent {
8971
9030
  this.sm.statusAlertType = 'info';
8972
9031
  this.sm.statusMsg = 'Fetching recording script...';
8973
9032
  this.sm.statusWaiting = true;
8974
- this.scriptService.scriptObservable(sess.script).subscribe(script => {
8975
- this.sm.statusAlertType = 'info';
8976
- this.sm.statusMsg = 'Received recording script.';
8977
- this.sm.statusWaiting = false;
8978
- this.setScript(script);
8979
- this.sm.session = sess;
8980
- this.fetchRecordings(sess, this.script);
8981
- }, reason => {
8982
- let errMsg = "Error fetching recording script: " + reason;
8983
- console.error(errMsg);
8984
- this.sm.statusMsg = errMsg;
8985
- this.sm.statusAlertType = 'error';
8986
- this.sm.statusWaiting = false;
9033
+ this.scriptService.scriptObservable(sess.script).subscribe({
9034
+ next: (script) => {
9035
+ this.sm.statusAlertType = 'info';
9036
+ this.sm.statusMsg = 'Received recording script.';
9037
+ this.sm.statusWaiting = false;
9038
+ this.setScript(script);
9039
+ this.sm.session = sess;
9040
+ this.fetchRecordings(sess, this.script);
9041
+ }, error: (reason) => {
9042
+ let errMsg = "Error fetching recording script: " + reason;
9043
+ console.error(errMsg);
9044
+ this.sm.statusMsg = errMsg;
9045
+ this.sm.statusAlertType = 'error';
9046
+ this.sm.statusWaiting = false;
9047
+ }
8987
9048
  });
8988
9049
  }
8989
9050
  else {
@@ -9000,29 +9061,31 @@ class SpeechrecorderngComponent extends RecorderComponent {
9000
9061
  let prNm = null;
9001
9062
  if (this.project) {
9002
9063
  let rfsObs = this.recFilesService.recordingFileDescrList(this.project.name, sess.sessionId);
9003
- rfsObs.subscribe((rfs) => {
9004
- this.sm.statusAlertType = 'info';
9005
- this.sm.statusMsg = 'Received infos of recordings.';
9006
- this.sm.statusWaiting = false;
9007
- if (rfs) {
9008
- if (rfs instanceof Array) {
9009
- rfs.forEach((rf) => {
9010
- //console.debug("Already recorded: " + rf+ " "+rf.recording.itemcode);
9011
- this.sm.addRecordingFileByDescriptor(rf);
9012
- });
9064
+ rfsObs.subscribe({
9065
+ next: (rfs) => {
9066
+ this.sm.statusAlertType = 'info';
9067
+ this.sm.statusMsg = 'Received infos of recordings.';
9068
+ this.sm.statusWaiting = false;
9069
+ if (rfs) {
9070
+ if (rfs instanceof Array) {
9071
+ rfs.forEach((rf) => {
9072
+ //console.debug("Already recorded: " + rf+ " "+rf.recording.itemcode);
9073
+ this.sm.addRecordingFileByDescriptor(rf);
9074
+ });
9075
+ }
9076
+ else {
9077
+ console.error('Expected type array for list of already recorded files ');
9078
+ }
9013
9079
  }
9014
9080
  else {
9015
- console.error('Expected type array for list of already recorded files ');
9081
+ //console.debug("Recording file list: " + rfs);
9016
9082
  }
9083
+ }, error: (err) => {
9084
+ // we start the session anyway
9085
+ this.startSession();
9086
+ }, complete: () => {
9087
+ this.startSession();
9017
9088
  }
9018
- else {
9019
- //console.debug("Recording file list: " + rfs);
9020
- }
9021
- }, () => {
9022
- // we start the session anyway
9023
- this.startSession();
9024
- }, () => {
9025
- this.startSession();
9026
9089
  });
9027
9090
  }
9028
9091
  else {
@@ -9045,36 +9108,10 @@ class SpeechrecorderngComponent extends RecorderComponent {
9045
9108
  return this.dataSaved && !this.sm.isActive();
9046
9109
  }
9047
9110
  init() {
9048
- var n = navigator;
9049
- //var getUserMediaFnct= n.getUserMedia || n.webkitGetUserMedia ||
9050
- // n.mozGetUserMedia || n.msGetUserMedia;
9051
- var w = window;
9052
- // TODO test onyl !!
9053
- // let debugFail=true;
9054
- // AudioContext = w.AudioContext || w.webkitAudioContext;
9055
- // if (typeof AudioContext !== 'function' || debugFail) {
9056
- // this.sm.statusAlertType='error';
9057
- // this.sm.statusMsg = 'ERROR: Browser does not support Web Audio API!';
9058
- // return false;
9059
- // } else {
9060
- // var context = new AudioContext();
9061
- //
9062
- // if (typeof navigator.mediaDevices.getUserMedia !== 'function') {
9063
- // this.sm.statusAlertType='error';
9064
- // this.sm.statusMsg= 'ERROR: Browser does not support Media streams!';
9065
- // return false;
9066
- // } else {
9067
- //
9068
- //this.sm = new SessionManager(new SimpleTrafficLight(), this.uploader);
9069
- //this.sm.init();
9070
- //this.ap = new AudioPlayer(context,this);
9071
- //this.sm.listener=this;
9072
- // }
9073
- // }
9111
+ //TODO Duplicate code in AudioRecorderComponent
9074
9112
  this.uploader.listener = (ue) => {
9075
9113
  this.uploadUpdate(ue);
9076
9114
  };
9077
- //TODO Duplicate code in AudioRecorderComponent
9078
9115
  window.addEventListener('beforeunload', (e) => {
9079
9116
  console.debug("Before page unload event");
9080
9117
  if (this.ready()) {
@@ -9156,6 +9193,9 @@ class SpeechrecorderngComponent extends RecorderComponent {
9156
9193
  let chCnt = ProjectUtil.DEFAULT_AUDIO_CHANNEL_COUNT;
9157
9194
  if (project) {
9158
9195
  console.info("Project name: " + project.name);
9196
+ if (project.recordingDeviceWakeLock === true) {
9197
+ this.sm.wakeLock = true;
9198
+ }
9159
9199
  this.sm.audioDevices = project.audioDevices;
9160
9200
  chCnt = ProjectUtil.audioChannelCount(project);
9161
9201
  console.info("Project requested recording channel count: " + chCnt);
@@ -9196,50 +9236,7 @@ class SpeechrecorderngComponent extends RecorderComponent {
9196
9236
  pLoader.send();
9197
9237
  }
9198
9238
  }
9199
- // loadScript(callback: ()=>any){
9200
- // var scrLoader = new XMLHttpRequest();
9201
- // let hn:string =window.location.hostname;
9202
- // let pn:string =window.location.pathname;
9203
- // let pr:string =window.location.protocol;
9204
- // let po:string =window.location.port;
9205
- //
9206
- // let sessionId:string=this.session.sessionId;
9207
- //
9208
- // let scrUrl:string | null = null;
9209
- //
9210
- // if (hn === 'localhost' || this.mode===Mode.DEMO) {
9211
- // // local debug mode
9212
- // // FF caches
9213
- // scrUrl = 'test/' + this.session.script.toString() + '.json?' + new Date().getTime();
9214
- //
9215
- // } else {
9216
- // let scrPath:string = '/wikispeech/session/scripts/servlet';
9217
- // let scrQu:string = 'sessionId=' + sessionId;
9218
- // scrUrl = pr + '//' + hn + ':' + po + scrPath;
9219
- // if (scrQu) {
9220
- // scrUrl = scrUrl + '?' + scrQu;
9221
- // }
9222
- // }
9223
- //
9224
- // scrLoader.open("GET",scrUrl , true);
9225
- // scrLoader.setRequestHeader('Accept','application/json');
9226
- // scrLoader.responseType = "json";
9227
- // scrLoader.onload = (e) => {
9228
- //
9229
- // this.script = scrLoader.response;
9230
- //
9231
- //
9232
- // this.sm.script = this.script;
9233
- //
9234
- // callback();
9235
- // }
9236
- // scrLoader.onerror = (e) => {
9237
- // console.log("Error downloading recording script data ...");
9238
- // }
9239
- // scrLoader.send();
9240
- // }
9241
9239
  start() {
9242
- //this.configure();
9243
9240
  }
9244
9241
  audioPlayerUpdate(e) {
9245
9242
  if (EventType.STARTED === e.type) {
@@ -10968,11 +10965,14 @@ class AudioRecorder extends BasicRecorder {
10968
10965
  this.peakLevelInDb = peakLvlInDb;
10969
10966
  this.changeDetectorRef.detectChanges();
10970
10967
  };
10968
+ //let wakeLockSupp=('wakeLock' in navigator);
10969
+ //alert('Wake lock API supported: '+wakeLockSupp);
10971
10970
  }
10972
10971
  ready() {
10973
10972
  return this.dataSaved && !this.isActive();
10974
10973
  }
10975
10974
  ngOnDestroy() {
10975
+ this.disableWakeLockCond();
10976
10976
  this.destroyed = true;
10977
10977
  // TODO stop capture /playback
10978
10978
  }
@@ -11058,6 +11058,23 @@ class AudioRecorder extends BasicRecorder {
11058
11058
  this.uploader.listener = (ue) => {
11059
11059
  this.uploadUpdate(ue);
11060
11060
  };
11061
+ let wakeLockSupp = ('wakeLock' in navigator);
11062
+ // if(wakeLockSupp) {
11063
+ // let wakeLock = null;
11064
+ // try {
11065
+ // //@ts-ignore
11066
+ // wakeLock = navigator.wakeLock.request('screen');
11067
+ //
11068
+ // //statusElem.textContent = 'Wake Lock is active!';
11069
+ // } catch (err) {
11070
+ // // The Wake Lock request has failed - usually system related, such as battery.
11071
+ // console.error('Wakelock failed'+err)
11072
+ // }
11073
+ // }else{
11074
+ // let noSleep=new NoSleep();
11075
+ // noSleep.enable();
11076
+ //
11077
+ // }
11061
11078
  }
11062
11079
  onKeyPress(ke) {
11063
11080
  if (ke.key == ' ') {
@@ -11110,36 +11127,36 @@ class AudioRecorder extends BasicRecorder {
11110
11127
  let prNm = null;
11111
11128
  if (this.project) {
11112
11129
  let rfsObs = this.recFileService.recordingFileList(this.project.name, sess.sessionId);
11113
- rfsObs.subscribe((rfs) => {
11114
- this.statusAlertType = 'info';
11115
- this.statusMsg = 'Received infos of recordings.';
11116
- this.statusWaiting = false;
11117
- if (rfs) {
11118
- if (rfs instanceof Array) {
11119
- rfs.forEach((rf) => {
11120
- if (rf.startedDate) {
11121
- rf._startedAsDateObj = new Date(rf.startedDate);
11122
- }
11123
- if (rf.date) {
11124
- rf._dateAsDateObj = new Date(rf.date);
11125
- }
11126
- this.recorderCombiPane.push(rf);
11127
- });
11130
+ rfsObs.subscribe({ next: (rfs) => {
11131
+ this.statusAlertType = 'info';
11132
+ this.statusMsg = 'Received infos of recordings.';
11133
+ this.statusWaiting = false;
11134
+ if (rfs) {
11135
+ if (rfs instanceof Array) {
11136
+ rfs.forEach((rf) => {
11137
+ if (rf.startedDate) {
11138
+ rf._startedAsDateObj = new Date(rf.startedDate);
11139
+ }
11140
+ if (rf.date) {
11141
+ rf._dateAsDateObj = new Date(rf.date);
11142
+ }
11143
+ this.recorderCombiPane.push(rf);
11144
+ });
11145
+ }
11146
+ else {
11147
+ console.error('Expected type array for list of already recorded files ');
11148
+ }
11128
11149
  }
11129
11150
  else {
11130
- console.error('Expected type array for list of already recorded files ');
11151
+ //console.debug("Recording file list: " + rfs);
11131
11152
  }
11132
- }
11133
- else {
11134
- //console.debug("Recording file list: " + rfs);
11135
- }
11136
- }, () => {
11137
- // Failed fetching existing, but we start the session anyway
11138
- this.start();
11139
- }, () => {
11140
- // Normal start
11141
- this.start();
11142
- });
11153
+ }, error: (err) => {
11154
+ // Failed fetching existing, but we start the session anyway
11155
+ this.start();
11156
+ }, complete: () => {
11157
+ // Normal start
11158
+ this.start();
11159
+ } });
11143
11160
  }
11144
11161
  else {
11145
11162
  // No project def -> error
@@ -11154,6 +11171,9 @@ class AudioRecorder extends BasicRecorder {
11154
11171
  let chCnt = ProjectUtil.DEFAULT_AUDIO_CHANNEL_COUNT;
11155
11172
  if (project) {
11156
11173
  console.info("Project name: " + project.name);
11174
+ if (project.recordingDeviceWakeLock === true) {
11175
+ this.wakeLock = true;
11176
+ }
11157
11177
  this.audioDevices = project.audioDevices;
11158
11178
  chCnt = ProjectUtil.audioChannelCount(project);
11159
11179
  console.info("Project requested recording channel count: " + chCnt);
@@ -11257,6 +11277,7 @@ class AudioRecorder extends BasicRecorder {
11257
11277
  }
11258
11278
  }
11259
11279
  startItem() {
11280
+ this.enableWakeLockCond();
11260
11281
  this.transportActions.startAction.disabled = true;
11261
11282
  this.transportActions.pauseAction.disabled = true;
11262
11283
  if (this.readonly) {
@@ -11447,24 +11468,6 @@ class AudioRecorder extends BasicRecorder {
11447
11468
  this.ac.stop();
11448
11469
  }
11449
11470
  }
11450
- // addRecordingFileByDescriptor(rfd:RecordingFileDescriptorImpl){
11451
- // let prIdx=0;
11452
- // if(this.items) {
11453
- // let it = this.items[prIdx];
11454
- // if (it) {
11455
- // if (!it.recs) {
11456
- // it.recs = new Array<SprRecordingFile>();
11457
- // }
11458
- //
11459
- // } else {
11460
- // //console.debug("WARN: No recording item with code: \"" +rfd.recording.itemcode+ "\" found.");
11461
- // }
11462
- // }
11463
- // }
11464
- //
11465
- // addRecordingFileByPromptIndex(promptIndex:number, rf:SprRecordingFile){
11466
- //
11467
- // }
11468
11471
  stopped() {
11469
11472
  this.updateStartActionDisableState();
11470
11473
  this.transportActions.stopAction.disabled = true;
@@ -11503,11 +11506,8 @@ class AudioRecorder extends BasicRecorder {
11503
11506
  this.processingRecording = true;
11504
11507
  let ww = new WavWriter();
11505
11508
  ww.writeAsync(ad, (wavFile) => {
11506
- //this.postRecording(wavFile, recUrl);
11507
- //rf._dateAsDateObj=new Date();
11508
11509
  rf.frames = ad.length;
11509
11510
  this.displayRecFile = rf;
11510
- //this.recordingListComp.recordingList.push(rf);
11511
11511
  this.recorderCombiPane.push(rf);
11512
11512
  this.postRecordingMultipart(wavFile, rf.uuid, rf.session, rf._startedAsDateObj, recUrl);
11513
11513
  this.processingRecording = false;
@@ -11753,8 +11753,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11753
11753
  args: ['window:keydown', ['$event']]
11754
11754
  }] } });
11755
11755
  class AudioRecorderComponent extends RecorderComponent {
11756
- constructor(injector, route, router, changeDetectorRef, sessionService, projectService, recFilesService) {
11757
- super();
11756
+ constructor(injector, route, router, changeDetectorRef, sessionService, projectService, recFilesService, uploader) {
11757
+ super(uploader);
11758
11758
  this.injector = injector;
11759
11759
  this.route = route;
11760
11760
  this.router = router;
@@ -11762,7 +11762,7 @@ class AudioRecorderComponent extends RecorderComponent {
11762
11762
  this.sessionService = sessionService;
11763
11763
  this.projectService = projectService;
11764
11764
  this.recFilesService = recFilesService;
11765
- this.dataSaved = true;
11765
+ this.uploader = uploader;
11766
11766
  }
11767
11767
  ngOnInit() {
11768
11768
  //super.ngOnInit();
@@ -11797,6 +11797,9 @@ class AudioRecorderComponent extends RecorderComponent {
11797
11797
  });
11798
11798
  }
11799
11799
  ngAfterViewInit() {
11800
+ this.uploader.listener = (ue) => {
11801
+ this.uploadUpdate(ue);
11802
+ };
11800
11803
  this.route.queryParams.subscribe((params) => {
11801
11804
  if (params['sessionId']) {
11802
11805
  this.fetchSession(params['sessionId']);
@@ -11813,47 +11816,65 @@ class AudioRecorderComponent extends RecorderComponent {
11813
11816
  //super.ngOnDestroy();
11814
11817
  }
11815
11818
  fetchSession(sessionId) {
11816
- //Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'statusMsg: Player initialized.'. Current value: 'statusMsg: Fetching session info...'.
11817
- // params.subscribe seems not to be asynchronous
11818
- // this.sm.statusAlertType='info';
11819
- // this.sm.statusMsg = 'Fetching session info...';
11820
- // this.sm.statusWaiting=true;
11821
11819
  let sessObs = this.sessionService.sessionObserver(sessionId);
11822
11820
  if (sessObs) {
11823
- sessObs.subscribe(sess => {
11824
- this.ar.statusAlertType = 'info';
11825
- this.ar.statusMsg = 'Received session info.';
11826
- this.ar.statusWaiting = false;
11827
- this.session = sess;
11828
- this.ar.session = sess;
11829
- if (sess.project) {
11830
- //console.debug("Session associated project: "+sess.project)
11831
- this.projectService.projectObservable(sess.project).subscribe(project => {
11832
- this.ar.project = project;
11833
- this.ar.fetchRecordings(sess);
11834
- }, reason => {
11835
- this.ar.statusMsg = reason;
11836
- this.ar.statusAlertType = 'error';
11837
- this.ar.statusWaiting = false;
11838
- console.error("Error fetching project config: " + reason);
11839
- });
11840
- }
11841
- else {
11842
- console.info("Session has no associated project. Using default configuration.");
11821
+ sessObs.subscribe({
11822
+ next: (sess) => {
11823
+ this.ar.statusAlertType = 'info';
11824
+ this.ar.statusMsg = 'Received session info.';
11825
+ this.ar.statusWaiting = false;
11826
+ this.session = sess;
11827
+ this.ar.session = sess;
11828
+ if (sess.project) {
11829
+ //console.debug("Session associated project: "+sess.project)
11830
+ this.projectService.projectObservable(sess.project).subscribe({
11831
+ next: (project) => {
11832
+ this.ar.project = project;
11833
+ this.ar.fetchRecordings(sess);
11834
+ }, error: (reason) => {
11835
+ this.ar.statusMsg = reason;
11836
+ this.ar.statusAlertType = 'error';
11837
+ this.ar.statusWaiting = false;
11838
+ console.error("Error fetching project config: " + reason);
11839
+ }
11840
+ });
11841
+ }
11842
+ else {
11843
+ console.info("Session has no associated project. Using default configuration.");
11844
+ }
11845
+ },
11846
+ error: (reason) => {
11847
+ this.ar.statusMsg = reason;
11848
+ this.ar.statusAlertType = 'error';
11849
+ this.ar.statusWaiting = false;
11850
+ console.error("Error fetching session " + reason);
11843
11851
  }
11844
- }, (reason) => {
11845
- this.ar.statusMsg = reason;
11846
- this.ar.statusAlertType = 'error';
11847
- this.ar.statusWaiting = false;
11848
- console.error("Error fetching session " + reason);
11849
11852
  });
11850
11853
  }
11851
11854
  }
11855
+ uploadUpdate(ue) {
11856
+ let upStatus = ue.status;
11857
+ this.dataSaved = (UploaderStatus.DONE === upStatus);
11858
+ let percentUpl = ue.percentDone();
11859
+ if (UploaderStatus.ERR === upStatus) {
11860
+ this.ar.uploadStatus = 'warn';
11861
+ }
11862
+ else {
11863
+ if (percentUpl < 50) {
11864
+ this.ar.uploadStatus = 'accent';
11865
+ }
11866
+ else {
11867
+ this.ar.uploadStatus = 'success';
11868
+ }
11869
+ this.ar.uploadProgress = percentUpl;
11870
+ }
11871
+ this.changeDetectorRef.detectChanges();
11872
+ }
11852
11873
  ready() {
11853
11874
  return this.dataSaved && !this.ar.isActive();
11854
11875
  }
11855
11876
  }
11856
- AudioRecorderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AudioRecorderComponent, deps: [{ token: i0.Injector }, { token: i1$1.ActivatedRoute }, { token: i1$1.Router }, { token: i0.ChangeDetectorRef }, { token: SessionService }, { token: ProjectService }, { token: RecordingService }], target: i0.ɵɵFactoryTarget.Component });
11877
+ AudioRecorderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AudioRecorderComponent, deps: [{ token: i0.Injector }, { token: i1$1.ActivatedRoute }, { token: i1$1.Router }, { token: i0.ChangeDetectorRef }, { token: SessionService }, { token: ProjectService }, { token: RecordingService }, { token: SpeechRecorderUploader }], target: i0.ɵɵFactoryTarget.Component });
11857
11878
  AudioRecorderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: AudioRecorderComponent, selector: "app-audiorecorder-comp", providers: [SessionService], viewQueries: [{ propertyName: "ar", first: true, predicate: AudioRecorder, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
11858
11879
  <app-audiorecorder [projectName]="_project?.name" [dataSaved]="dataSaved"></app-audiorecorder>
11859
11880
  `, isInline: true, styles: [":host{flex:2;display:flex;height:100%;flex-direction:column;min-height:0}\n"], components: [{ type: AudioRecorder, selector: "app-audiorecorder", inputs: ["_project", "projectName", "dataSaved"] }] });
@@ -11874,7 +11895,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11874
11895
 
11875
11896
  }`]
11876
11897
  }]
11877
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.ActivatedRoute }, { type: i1$1.Router }, { type: i0.ChangeDetectorRef }, { type: SessionService }, { type: ProjectService }, { type: RecordingService }]; }, propDecorators: { ar: [{
11898
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.ActivatedRoute }, { type: i1$1.Router }, { type: i0.ChangeDetectorRef }, { type: SessionService }, { type: ProjectService }, { type: RecordingService }, { type: SpeechRecorderUploader }]; }, propDecorators: { ar: [{
11878
11899
  type: ViewChild,
11879
11900
  args: [AudioRecorder, { static: true }]
11880
11901
  }] } });
@@ -11923,7 +11944,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11923
11944
  }]
11924
11945
  }] });
11925
11946
 
11926
- const VERSION = '2.23.9';
11947
+ const VERSION = '2.24.2';
11927
11948
 
11928
11949
  /*
11929
11950
  * Public API Surface of speechrecorderng