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
  }
@@ -7259,6 +7288,7 @@ class BasicRecorder {
7259
7288
  this.readonly = false;
7260
7289
  this.processingRecording = false;
7261
7290
  this.ac = null;
7291
+ this._wakeLock = false;
7262
7292
  this._selectedDeviceId = undefined;
7263
7293
  this._channelCount = 2;
7264
7294
  this._session = null;
@@ -7271,6 +7301,7 @@ class BasicRecorder {
7271
7301
  this.audioFetchSubscription = null;
7272
7302
  this.destroyed = false;
7273
7303
  this.navigationDisabled = true;
7304
+ this.noSleep = null;
7274
7305
  this.userAgent = UserAgentBuilder.userAgent();
7275
7306
  console.debug("Detected platform: " + this.userAgent.detectedPlatform);
7276
7307
  console.debug("Detected browser: " + this.userAgent.detectedBrowser);
@@ -7280,6 +7311,27 @@ class BasicRecorder {
7280
7311
  this.streamLevelMeasure = new StreamLevelMeasure();
7281
7312
  this.selCaptureDeviceId = null;
7282
7313
  }
7314
+ get wakeLock() {
7315
+ return this._wakeLock;
7316
+ }
7317
+ set wakeLock(value) {
7318
+ this._wakeLock = value;
7319
+ }
7320
+ enableWakeLockCond() {
7321
+ if (this.wakeLock === true) {
7322
+ if (!this.noSleep) {
7323
+ this.noSleep = new NoSleep();
7324
+ }
7325
+ if (!this.noSleep.isEnabled) {
7326
+ this.noSleep.enable();
7327
+ }
7328
+ }
7329
+ }
7330
+ disableWakeLockCond() {
7331
+ if (this.noSleep && this.noSleep.isEnabled) {
7332
+ this.noSleep.disable();
7333
+ }
7334
+ }
7283
7335
  set audioDevices(audioDevices) {
7284
7336
  this._audioDevices = audioDevices;
7285
7337
  }
@@ -7872,6 +7924,7 @@ class SessionManager extends BasicRecorder {
7872
7924
  };
7873
7925
  }
7874
7926
  ngOnDestroy() {
7927
+ this.disableWakeLockCond();
7875
7928
  this.destroyed = true;
7876
7929
  // TODO stop capture /playback
7877
7930
  }
@@ -8079,6 +8132,7 @@ class SessionManager extends BasicRecorder {
8079
8132
  }
8080
8133
  }
8081
8134
  startItem() {
8135
+ this.enableWakeLockCond();
8082
8136
  this.transportActions.startAction.disabled = true;
8083
8137
  this.transportActions.pauseAction.disabled = true;
8084
8138
  if (this.readonly) {
@@ -8808,6 +8862,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
8808
8862
  }] } });
8809
8863
 
8810
8864
  class RecorderComponent {
8865
+ constructor(uploader) {
8866
+ this.uploader = uploader;
8867
+ this.dataSaved = true;
8868
+ }
8811
8869
  }
8812
8870
 
8813
8871
  /**
@@ -8858,7 +8916,7 @@ var Mode;
8858
8916
  })(Mode || (Mode = {}));
8859
8917
  class SpeechrecorderngComponent extends RecorderComponent {
8860
8918
  constructor(route, router, changeDetectorRef, sessionsService, projectService, scriptService, recFilesService, uploader) {
8861
- super();
8919
+ super(uploader);
8862
8920
  this.route = route;
8863
8921
  this.router = router;
8864
8922
  this.changeDetectorRef = changeDetectorRef;
@@ -8868,7 +8926,6 @@ class SpeechrecorderngComponent extends RecorderComponent {
8868
8926
  this.recFilesService = recFilesService;
8869
8927
  this.uploader = uploader;
8870
8928
  this._project = null;
8871
- this.dataSaved = true;
8872
8929
  }
8873
8930
  ngOnInit() {
8874
8931
  try {
@@ -8891,6 +8948,8 @@ class SpeechrecorderngComponent extends RecorderComponent {
8891
8948
  }
8892
8949
  }
8893
8950
  ngAfterViewInit() {
8951
+ // let wakeLockSupp=('wakeLock' in navigator);
8952
+ // alert('Wake lock API supported: '+wakeLockSupp);
8894
8953
  if (this.sm.status !== 8 /* ERROR */) {
8895
8954
  let initSuccess = this.init();
8896
8955
  if (initSuccess) {
@@ -8909,39 +8968,39 @@ class SpeechrecorderngComponent extends RecorderComponent {
8909
8968
  }
8910
8969
  }
8911
8970
  fetchSession(sessionId) {
8912
- //Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'statusMsg: Player initialized.'. Current value: 'statusMsg: Fetching session info...'.
8913
- // params.subscribe seems not to be asynchronous
8914
- // this.sm.statusAlertType='info';
8915
- // this.sm.statusMsg = 'Fetching session info...';
8916
- // this.sm.statusWaiting=true;
8917
8971
  let sessObs = this.sessionsService.sessionObserver(sessionId);
8918
8972
  if (sessObs) {
8919
- sessObs.subscribe(sess => {
8920
- this.setSession(sess);
8921
- this.sm.statusAlertType = 'info';
8922
- this.sm.statusMsg = 'Received session info.';
8923
- this.sm.statusWaiting = false;
8924
- if (sess.project) {
8925
- //console.debug("Session associated project: "+sess.project)
8926
- this.projectService.projectObservable(sess.project).subscribe(project => {
8927
- this.project = project;
8973
+ sessObs.subscribe({
8974
+ next: sess => {
8975
+ this.setSession(sess);
8976
+ this.sm.statusAlertType = 'info';
8977
+ this.sm.statusMsg = 'Received session info.';
8978
+ this.sm.statusWaiting = false;
8979
+ if (sess.project) {
8980
+ //console.debug("Session associated project: "+sess.project)
8981
+ this.projectService.projectObservable(sess.project).subscribe({
8982
+ next: (project) => {
8983
+ this.project = project;
8984
+ this.fetchScript(sess);
8985
+ }, error: (reason) => {
8986
+ this.sm.statusMsg = reason;
8987
+ this.sm.statusAlertType = 'error';
8988
+ this.sm.statusWaiting = false;
8989
+ console.error("Error fetching project config: " + reason);
8990
+ }
8991
+ });
8992
+ }
8993
+ else {
8994
+ console.info("Session has no associated project. Using default configuration.");
8928
8995
  this.fetchScript(sess);
8929
- }, reason => {
8930
- this.sm.statusMsg = reason;
8931
- this.sm.statusAlertType = 'error';
8932
- this.sm.statusWaiting = false;
8933
- console.error("Error fetching project config: " + reason);
8934
- });
8996
+ }
8997
+ },
8998
+ error: (reason) => {
8999
+ this.sm.statusMsg = reason;
9000
+ this.sm.statusAlertType = 'error';
9001
+ this.sm.statusWaiting = false;
9002
+ console.error("Error fetching session " + reason);
8935
9003
  }
8936
- else {
8937
- console.info("Session has no associated project. Using default configuration.");
8938
- this.fetchScript(sess);
8939
- }
8940
- }, (reason) => {
8941
- this.sm.statusMsg = reason;
8942
- this.sm.statusAlertType = 'error';
8943
- this.sm.statusWaiting = false;
8944
- console.error("Error fetching session " + reason);
8945
9004
  });
8946
9005
  }
8947
9006
  }
@@ -8950,19 +9009,21 @@ class SpeechrecorderngComponent extends RecorderComponent {
8950
9009
  this.sm.statusAlertType = 'info';
8951
9010
  this.sm.statusMsg = 'Fetching recording script...';
8952
9011
  this.sm.statusWaiting = true;
8953
- this.scriptService.scriptObservable(sess.script).subscribe(script => {
8954
- this.sm.statusAlertType = 'info';
8955
- this.sm.statusMsg = 'Received recording script.';
8956
- this.sm.statusWaiting = false;
8957
- this.setScript(script);
8958
- this.sm.session = sess;
8959
- this.fetchRecordings(sess, this.script);
8960
- }, reason => {
8961
- let errMsg = "Error fetching recording script: " + reason;
8962
- console.error(errMsg);
8963
- this.sm.statusMsg = errMsg;
8964
- this.sm.statusAlertType = 'error';
8965
- this.sm.statusWaiting = false;
9012
+ this.scriptService.scriptObservable(sess.script).subscribe({
9013
+ next: (script) => {
9014
+ this.sm.statusAlertType = 'info';
9015
+ this.sm.statusMsg = 'Received recording script.';
9016
+ this.sm.statusWaiting = false;
9017
+ this.setScript(script);
9018
+ this.sm.session = sess;
9019
+ this.fetchRecordings(sess, this.script);
9020
+ }, error: (reason) => {
9021
+ let errMsg = "Error fetching recording script: " + reason;
9022
+ console.error(errMsg);
9023
+ this.sm.statusMsg = errMsg;
9024
+ this.sm.statusAlertType = 'error';
9025
+ this.sm.statusWaiting = false;
9026
+ }
8966
9027
  });
8967
9028
  }
8968
9029
  else {
@@ -8979,29 +9040,31 @@ class SpeechrecorderngComponent extends RecorderComponent {
8979
9040
  let prNm = null;
8980
9041
  if (this.project) {
8981
9042
  let rfsObs = this.recFilesService.recordingFileDescrList(this.project.name, sess.sessionId);
8982
- rfsObs.subscribe((rfs) => {
8983
- this.sm.statusAlertType = 'info';
8984
- this.sm.statusMsg = 'Received infos of recordings.';
8985
- this.sm.statusWaiting = false;
8986
- if (rfs) {
8987
- if (rfs instanceof Array) {
8988
- rfs.forEach((rf) => {
8989
- //console.debug("Already recorded: " + rf+ " "+rf.recording.itemcode);
8990
- this.sm.addRecordingFileByDescriptor(rf);
8991
- });
9043
+ rfsObs.subscribe({
9044
+ next: (rfs) => {
9045
+ this.sm.statusAlertType = 'info';
9046
+ this.sm.statusMsg = 'Received infos of recordings.';
9047
+ this.sm.statusWaiting = false;
9048
+ if (rfs) {
9049
+ if (rfs instanceof Array) {
9050
+ rfs.forEach((rf) => {
9051
+ //console.debug("Already recorded: " + rf+ " "+rf.recording.itemcode);
9052
+ this.sm.addRecordingFileByDescriptor(rf);
9053
+ });
9054
+ }
9055
+ else {
9056
+ console.error('Expected type array for list of already recorded files ');
9057
+ }
8992
9058
  }
8993
9059
  else {
8994
- console.error('Expected type array for list of already recorded files ');
9060
+ //console.debug("Recording file list: " + rfs);
8995
9061
  }
9062
+ }, error: (err) => {
9063
+ // we start the session anyway
9064
+ this.startSession();
9065
+ }, complete: () => {
9066
+ this.startSession();
8996
9067
  }
8997
- else {
8998
- //console.debug("Recording file list: " + rfs);
8999
- }
9000
- }, () => {
9001
- // we start the session anyway
9002
- this.startSession();
9003
- }, () => {
9004
- this.startSession();
9005
9068
  });
9006
9069
  }
9007
9070
  else {
@@ -9024,36 +9087,10 @@ class SpeechrecorderngComponent extends RecorderComponent {
9024
9087
  return this.dataSaved && !this.sm.isActive();
9025
9088
  }
9026
9089
  init() {
9027
- var n = navigator;
9028
- //var getUserMediaFnct= n.getUserMedia || n.webkitGetUserMedia ||
9029
- // n.mozGetUserMedia || n.msGetUserMedia;
9030
- var w = window;
9031
- // TODO test onyl !!
9032
- // let debugFail=true;
9033
- // AudioContext = w.AudioContext || w.webkitAudioContext;
9034
- // if (typeof AudioContext !== 'function' || debugFail) {
9035
- // this.sm.statusAlertType='error';
9036
- // this.sm.statusMsg = 'ERROR: Browser does not support Web Audio API!';
9037
- // return false;
9038
- // } else {
9039
- // var context = new AudioContext();
9040
- //
9041
- // if (typeof navigator.mediaDevices.getUserMedia !== 'function') {
9042
- // this.sm.statusAlertType='error';
9043
- // this.sm.statusMsg= 'ERROR: Browser does not support Media streams!';
9044
- // return false;
9045
- // } else {
9046
- //
9047
- //this.sm = new SessionManager(new SimpleTrafficLight(), this.uploader);
9048
- //this.sm.init();
9049
- //this.ap = new AudioPlayer(context,this);
9050
- //this.sm.listener=this;
9051
- // }
9052
- // }
9090
+ //TODO Duplicate code in AudioRecorderComponent
9053
9091
  this.uploader.listener = (ue) => {
9054
9092
  this.uploadUpdate(ue);
9055
9093
  };
9056
- //TODO Duplicate code in AudioRecorderComponent
9057
9094
  window.addEventListener('beforeunload', (e) => {
9058
9095
  console.debug("Before page unload event");
9059
9096
  if (this.ready()) {
@@ -9135,6 +9172,9 @@ class SpeechrecorderngComponent extends RecorderComponent {
9135
9172
  let chCnt = ProjectUtil.DEFAULT_AUDIO_CHANNEL_COUNT;
9136
9173
  if (project) {
9137
9174
  console.info("Project name: " + project.name);
9175
+ if (project.recordingDeviceWakeLock === true) {
9176
+ this.sm.wakeLock = true;
9177
+ }
9138
9178
  this.sm.audioDevices = project.audioDevices;
9139
9179
  chCnt = ProjectUtil.audioChannelCount(project);
9140
9180
  console.info("Project requested recording channel count: " + chCnt);
@@ -9175,50 +9215,7 @@ class SpeechrecorderngComponent extends RecorderComponent {
9175
9215
  pLoader.send();
9176
9216
  }
9177
9217
  }
9178
- // loadScript(callback: ()=>any){
9179
- // var scrLoader = new XMLHttpRequest();
9180
- // let hn:string =window.location.hostname;
9181
- // let pn:string =window.location.pathname;
9182
- // let pr:string =window.location.protocol;
9183
- // let po:string =window.location.port;
9184
- //
9185
- // let sessionId:string=this.session.sessionId;
9186
- //
9187
- // let scrUrl:string | null = null;
9188
- //
9189
- // if (hn === 'localhost' || this.mode===Mode.DEMO) {
9190
- // // local debug mode
9191
- // // FF caches
9192
- // scrUrl = 'test/' + this.session.script.toString() + '.json?' + new Date().getTime();
9193
- //
9194
- // } else {
9195
- // let scrPath:string = '/wikispeech/session/scripts/servlet';
9196
- // let scrQu:string = 'sessionId=' + sessionId;
9197
- // scrUrl = pr + '//' + hn + ':' + po + scrPath;
9198
- // if (scrQu) {
9199
- // scrUrl = scrUrl + '?' + scrQu;
9200
- // }
9201
- // }
9202
- //
9203
- // scrLoader.open("GET",scrUrl , true);
9204
- // scrLoader.setRequestHeader('Accept','application/json');
9205
- // scrLoader.responseType = "json";
9206
- // scrLoader.onload = (e) => {
9207
- //
9208
- // this.script = scrLoader.response;
9209
- //
9210
- //
9211
- // this.sm.script = this.script;
9212
- //
9213
- // callback();
9214
- // }
9215
- // scrLoader.onerror = (e) => {
9216
- // console.log("Error downloading recording script data ...");
9217
- // }
9218
- // scrLoader.send();
9219
- // }
9220
9218
  start() {
9221
- //this.configure();
9222
9219
  }
9223
9220
  audioPlayerUpdate(e) {
9224
9221
  if (EventType.STARTED === e.type) {
@@ -10940,11 +10937,14 @@ class AudioRecorder extends BasicRecorder {
10940
10937
  this.peakLevelInDb = peakLvlInDb;
10941
10938
  this.changeDetectorRef.detectChanges();
10942
10939
  };
10940
+ //let wakeLockSupp=('wakeLock' in navigator);
10941
+ //alert('Wake lock API supported: '+wakeLockSupp);
10943
10942
  }
10944
10943
  ready() {
10945
10944
  return this.dataSaved && !this.isActive();
10946
10945
  }
10947
10946
  ngOnDestroy() {
10947
+ this.disableWakeLockCond();
10948
10948
  this.destroyed = true;
10949
10949
  // TODO stop capture /playback
10950
10950
  }
@@ -11030,6 +11030,23 @@ class AudioRecorder extends BasicRecorder {
11030
11030
  this.uploader.listener = (ue) => {
11031
11031
  this.uploadUpdate(ue);
11032
11032
  };
11033
+ let wakeLockSupp = ('wakeLock' in navigator);
11034
+ // if(wakeLockSupp) {
11035
+ // let wakeLock = null;
11036
+ // try {
11037
+ // //@ts-ignore
11038
+ // wakeLock = navigator.wakeLock.request('screen');
11039
+ //
11040
+ // //statusElem.textContent = 'Wake Lock is active!';
11041
+ // } catch (err) {
11042
+ // // The Wake Lock request has failed - usually system related, such as battery.
11043
+ // console.error('Wakelock failed'+err)
11044
+ // }
11045
+ // }else{
11046
+ // let noSleep=new NoSleep();
11047
+ // noSleep.enable();
11048
+ //
11049
+ // }
11033
11050
  }
11034
11051
  onKeyPress(ke) {
11035
11052
  if (ke.key == ' ') {
@@ -11082,36 +11099,36 @@ class AudioRecorder extends BasicRecorder {
11082
11099
  let prNm = null;
11083
11100
  if (this.project) {
11084
11101
  let rfsObs = this.recFileService.recordingFileList(this.project.name, sess.sessionId);
11085
- rfsObs.subscribe((rfs) => {
11086
- this.statusAlertType = 'info';
11087
- this.statusMsg = 'Received infos of recordings.';
11088
- this.statusWaiting = false;
11089
- if (rfs) {
11090
- if (rfs instanceof Array) {
11091
- rfs.forEach((rf) => {
11092
- if (rf.startedDate) {
11093
- rf._startedAsDateObj = new Date(rf.startedDate);
11094
- }
11095
- if (rf.date) {
11096
- rf._dateAsDateObj = new Date(rf.date);
11097
- }
11098
- this.recorderCombiPane.push(rf);
11099
- });
11102
+ rfsObs.subscribe({ next: (rfs) => {
11103
+ this.statusAlertType = 'info';
11104
+ this.statusMsg = 'Received infos of recordings.';
11105
+ this.statusWaiting = false;
11106
+ if (rfs) {
11107
+ if (rfs instanceof Array) {
11108
+ rfs.forEach((rf) => {
11109
+ if (rf.startedDate) {
11110
+ rf._startedAsDateObj = new Date(rf.startedDate);
11111
+ }
11112
+ if (rf.date) {
11113
+ rf._dateAsDateObj = new Date(rf.date);
11114
+ }
11115
+ this.recorderCombiPane.push(rf);
11116
+ });
11117
+ }
11118
+ else {
11119
+ console.error('Expected type array for list of already recorded files ');
11120
+ }
11100
11121
  }
11101
11122
  else {
11102
- console.error('Expected type array for list of already recorded files ');
11123
+ //console.debug("Recording file list: " + rfs);
11103
11124
  }
11104
- }
11105
- else {
11106
- //console.debug("Recording file list: " + rfs);
11107
- }
11108
- }, () => {
11109
- // Failed fetching existing, but we start the session anyway
11110
- this.start();
11111
- }, () => {
11112
- // Normal start
11113
- this.start();
11114
- });
11125
+ }, error: (err) => {
11126
+ // Failed fetching existing, but we start the session anyway
11127
+ this.start();
11128
+ }, complete: () => {
11129
+ // Normal start
11130
+ this.start();
11131
+ } });
11115
11132
  }
11116
11133
  else {
11117
11134
  // No project def -> error
@@ -11126,6 +11143,9 @@ class AudioRecorder extends BasicRecorder {
11126
11143
  let chCnt = ProjectUtil.DEFAULT_AUDIO_CHANNEL_COUNT;
11127
11144
  if (project) {
11128
11145
  console.info("Project name: " + project.name);
11146
+ if (project.recordingDeviceWakeLock === true) {
11147
+ this.wakeLock = true;
11148
+ }
11129
11149
  this.audioDevices = project.audioDevices;
11130
11150
  chCnt = ProjectUtil.audioChannelCount(project);
11131
11151
  console.info("Project requested recording channel count: " + chCnt);
@@ -11229,6 +11249,7 @@ class AudioRecorder extends BasicRecorder {
11229
11249
  }
11230
11250
  }
11231
11251
  startItem() {
11252
+ this.enableWakeLockCond();
11232
11253
  this.transportActions.startAction.disabled = true;
11233
11254
  this.transportActions.pauseAction.disabled = true;
11234
11255
  if (this.readonly) {
@@ -11419,24 +11440,6 @@ class AudioRecorder extends BasicRecorder {
11419
11440
  this.ac.stop();
11420
11441
  }
11421
11442
  }
11422
- // addRecordingFileByDescriptor(rfd:RecordingFileDescriptorImpl){
11423
- // let prIdx=0;
11424
- // if(this.items) {
11425
- // let it = this.items[prIdx];
11426
- // if (it) {
11427
- // if (!it.recs) {
11428
- // it.recs = new Array<SprRecordingFile>();
11429
- // }
11430
- //
11431
- // } else {
11432
- // //console.debug("WARN: No recording item with code: \"" +rfd.recording.itemcode+ "\" found.");
11433
- // }
11434
- // }
11435
- // }
11436
- //
11437
- // addRecordingFileByPromptIndex(promptIndex:number, rf:SprRecordingFile){
11438
- //
11439
- // }
11440
11443
  stopped() {
11441
11444
  this.updateStartActionDisableState();
11442
11445
  this.transportActions.stopAction.disabled = true;
@@ -11475,11 +11478,8 @@ class AudioRecorder extends BasicRecorder {
11475
11478
  this.processingRecording = true;
11476
11479
  let ww = new WavWriter();
11477
11480
  ww.writeAsync(ad, (wavFile) => {
11478
- //this.postRecording(wavFile, recUrl);
11479
- //rf._dateAsDateObj=new Date();
11480
11481
  rf.frames = ad.length;
11481
11482
  this.displayRecFile = rf;
11482
- //this.recordingListComp.recordingList.push(rf);
11483
11483
  this.recorderCombiPane.push(rf);
11484
11484
  this.postRecordingMultipart(wavFile, rf.uuid, rf.session, rf._startedAsDateObj, recUrl);
11485
11485
  this.processingRecording = false;
@@ -11723,8 +11723,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11723
11723
  args: ['window:keydown', ['$event']]
11724
11724
  }] } });
11725
11725
  class AudioRecorderComponent extends RecorderComponent {
11726
- constructor(injector, route, router, changeDetectorRef, sessionService, projectService, recFilesService) {
11727
- super();
11726
+ constructor(injector, route, router, changeDetectorRef, sessionService, projectService, recFilesService, uploader) {
11727
+ super(uploader);
11728
11728
  this.injector = injector;
11729
11729
  this.route = route;
11730
11730
  this.router = router;
@@ -11732,7 +11732,7 @@ class AudioRecorderComponent extends RecorderComponent {
11732
11732
  this.sessionService = sessionService;
11733
11733
  this.projectService = projectService;
11734
11734
  this.recFilesService = recFilesService;
11735
- this.dataSaved = true;
11735
+ this.uploader = uploader;
11736
11736
  }
11737
11737
  ngOnInit() {
11738
11738
  //super.ngOnInit();
@@ -11767,6 +11767,9 @@ class AudioRecorderComponent extends RecorderComponent {
11767
11767
  });
11768
11768
  }
11769
11769
  ngAfterViewInit() {
11770
+ this.uploader.listener = (ue) => {
11771
+ this.uploadUpdate(ue);
11772
+ };
11770
11773
  this.route.queryParams.subscribe((params) => {
11771
11774
  if (params['sessionId']) {
11772
11775
  this.fetchSession(params['sessionId']);
@@ -11783,47 +11786,65 @@ class AudioRecorderComponent extends RecorderComponent {
11783
11786
  //super.ngOnDestroy();
11784
11787
  }
11785
11788
  fetchSession(sessionId) {
11786
- //Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'statusMsg: Player initialized.'. Current value: 'statusMsg: Fetching session info...'.
11787
- // params.subscribe seems not to be asynchronous
11788
- // this.sm.statusAlertType='info';
11789
- // this.sm.statusMsg = 'Fetching session info...';
11790
- // this.sm.statusWaiting=true;
11791
11789
  let sessObs = this.sessionService.sessionObserver(sessionId);
11792
11790
  if (sessObs) {
11793
- sessObs.subscribe(sess => {
11794
- this.ar.statusAlertType = 'info';
11795
- this.ar.statusMsg = 'Received session info.';
11796
- this.ar.statusWaiting = false;
11797
- this.session = sess;
11798
- this.ar.session = sess;
11799
- if (sess.project) {
11800
- //console.debug("Session associated project: "+sess.project)
11801
- this.projectService.projectObservable(sess.project).subscribe(project => {
11802
- this.ar.project = project;
11803
- this.ar.fetchRecordings(sess);
11804
- }, reason => {
11805
- this.ar.statusMsg = reason;
11806
- this.ar.statusAlertType = 'error';
11807
- this.ar.statusWaiting = false;
11808
- console.error("Error fetching project config: " + reason);
11809
- });
11810
- }
11811
- else {
11812
- console.info("Session has no associated project. Using default configuration.");
11791
+ sessObs.subscribe({
11792
+ next: (sess) => {
11793
+ this.ar.statusAlertType = 'info';
11794
+ this.ar.statusMsg = 'Received session info.';
11795
+ this.ar.statusWaiting = false;
11796
+ this.session = sess;
11797
+ this.ar.session = sess;
11798
+ if (sess.project) {
11799
+ //console.debug("Session associated project: "+sess.project)
11800
+ this.projectService.projectObservable(sess.project).subscribe({
11801
+ next: (project) => {
11802
+ this.ar.project = project;
11803
+ this.ar.fetchRecordings(sess);
11804
+ }, error: (reason) => {
11805
+ this.ar.statusMsg = reason;
11806
+ this.ar.statusAlertType = 'error';
11807
+ this.ar.statusWaiting = false;
11808
+ console.error("Error fetching project config: " + reason);
11809
+ }
11810
+ });
11811
+ }
11812
+ else {
11813
+ console.info("Session has no associated project. Using default configuration.");
11814
+ }
11815
+ },
11816
+ error: (reason) => {
11817
+ this.ar.statusMsg = reason;
11818
+ this.ar.statusAlertType = 'error';
11819
+ this.ar.statusWaiting = false;
11820
+ console.error("Error fetching session " + reason);
11813
11821
  }
11814
- }, (reason) => {
11815
- this.ar.statusMsg = reason;
11816
- this.ar.statusAlertType = 'error';
11817
- this.ar.statusWaiting = false;
11818
- console.error("Error fetching session " + reason);
11819
11822
  });
11820
11823
  }
11821
11824
  }
11825
+ uploadUpdate(ue) {
11826
+ let upStatus = ue.status;
11827
+ this.dataSaved = (UploaderStatus.DONE === upStatus);
11828
+ let percentUpl = ue.percentDone();
11829
+ if (UploaderStatus.ERR === upStatus) {
11830
+ this.ar.uploadStatus = 'warn';
11831
+ }
11832
+ else {
11833
+ if (percentUpl < 50) {
11834
+ this.ar.uploadStatus = 'accent';
11835
+ }
11836
+ else {
11837
+ this.ar.uploadStatus = 'success';
11838
+ }
11839
+ this.ar.uploadProgress = percentUpl;
11840
+ }
11841
+ this.changeDetectorRef.detectChanges();
11842
+ }
11822
11843
  ready() {
11823
11844
  return this.dataSaved && !this.ar.isActive();
11824
11845
  }
11825
11846
  }
11826
- 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 });
11847
+ 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 });
11827
11848
  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: `
11828
11849
  <app-audiorecorder [projectName]="_project?.name" [dataSaved]="dataSaved"></app-audiorecorder>
11829
11850
  `, 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"] }] });
@@ -11844,7 +11865,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11844
11865
 
11845
11866
  }`]
11846
11867
  }]
11847
- }], 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: [{
11868
+ }], 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: [{
11848
11869
  type: ViewChild,
11849
11870
  args: [AudioRecorder, { static: true }]
11850
11871
  }] } });
@@ -11893,7 +11914,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11893
11914
  }]
11894
11915
  }] });
11895
11916
 
11896
- const VERSION = '2.23.9';
11917
+ const VERSION = '2.24.2';
11897
11918
 
11898
11919
  /*
11899
11920
  * Public API Surface of speechrecorderng