speechrecorderng 2.23.9 → 2.24.0

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';
@@ -7259,6 +7260,7 @@ class BasicRecorder {
7259
7260
  this.readonly = false;
7260
7261
  this.processingRecording = false;
7261
7262
  this.ac = null;
7263
+ this._wakeLock = false;
7262
7264
  this._selectedDeviceId = undefined;
7263
7265
  this._channelCount = 2;
7264
7266
  this._session = null;
@@ -7271,6 +7273,7 @@ class BasicRecorder {
7271
7273
  this.audioFetchSubscription = null;
7272
7274
  this.destroyed = false;
7273
7275
  this.navigationDisabled = true;
7276
+ this.noSleep = null;
7274
7277
  this.userAgent = UserAgentBuilder.userAgent();
7275
7278
  console.debug("Detected platform: " + this.userAgent.detectedPlatform);
7276
7279
  console.debug("Detected browser: " + this.userAgent.detectedBrowser);
@@ -7280,6 +7283,27 @@ class BasicRecorder {
7280
7283
  this.streamLevelMeasure = new StreamLevelMeasure();
7281
7284
  this.selCaptureDeviceId = null;
7282
7285
  }
7286
+ get wakeLock() {
7287
+ return this._wakeLock;
7288
+ }
7289
+ set wakeLock(value) {
7290
+ this._wakeLock = value;
7291
+ }
7292
+ enableWakeLockCond() {
7293
+ if (this.wakeLock === true) {
7294
+ if (!this.noSleep) {
7295
+ this.noSleep = new NoSleep();
7296
+ }
7297
+ if (!this.noSleep.isEnabled) {
7298
+ this.noSleep.enable();
7299
+ }
7300
+ }
7301
+ }
7302
+ disableWakeLockCond() {
7303
+ if (this.noSleep && this.noSleep.isEnabled) {
7304
+ this.noSleep.disable();
7305
+ }
7306
+ }
7283
7307
  set audioDevices(audioDevices) {
7284
7308
  this._audioDevices = audioDevices;
7285
7309
  }
@@ -7872,6 +7896,7 @@ class SessionManager extends BasicRecorder {
7872
7896
  };
7873
7897
  }
7874
7898
  ngOnDestroy() {
7899
+ this.disableWakeLockCond();
7875
7900
  this.destroyed = true;
7876
7901
  // TODO stop capture /playback
7877
7902
  }
@@ -8079,6 +8104,7 @@ class SessionManager extends BasicRecorder {
8079
8104
  }
8080
8105
  }
8081
8106
  startItem() {
8107
+ this.enableWakeLockCond();
8082
8108
  this.transportActions.startAction.disabled = true;
8083
8109
  this.transportActions.pauseAction.disabled = true;
8084
8110
  if (this.readonly) {
@@ -8891,6 +8917,8 @@ class SpeechrecorderngComponent extends RecorderComponent {
8891
8917
  }
8892
8918
  }
8893
8919
  ngAfterViewInit() {
8920
+ // let wakeLockSupp=('wakeLock' in navigator);
8921
+ // alert('Wake lock API supported: '+wakeLockSupp);
8894
8922
  if (this.sm.status !== 8 /* ERROR */) {
8895
8923
  let initSuccess = this.init();
8896
8924
  if (initSuccess) {
@@ -9135,6 +9163,9 @@ class SpeechrecorderngComponent extends RecorderComponent {
9135
9163
  let chCnt = ProjectUtil.DEFAULT_AUDIO_CHANNEL_COUNT;
9136
9164
  if (project) {
9137
9165
  console.info("Project name: " + project.name);
9166
+ if (project.recordingDeviceWakeLock === true) {
9167
+ this.sm.wakeLock = true;
9168
+ }
9138
9169
  this.sm.audioDevices = project.audioDevices;
9139
9170
  chCnt = ProjectUtil.audioChannelCount(project);
9140
9171
  console.info("Project requested recording channel count: " + chCnt);
@@ -10940,11 +10971,14 @@ class AudioRecorder extends BasicRecorder {
10940
10971
  this.peakLevelInDb = peakLvlInDb;
10941
10972
  this.changeDetectorRef.detectChanges();
10942
10973
  };
10974
+ //let wakeLockSupp=('wakeLock' in navigator);
10975
+ //alert('Wake lock API supported: '+wakeLockSupp);
10943
10976
  }
10944
10977
  ready() {
10945
10978
  return this.dataSaved && !this.isActive();
10946
10979
  }
10947
10980
  ngOnDestroy() {
10981
+ this.disableWakeLockCond();
10948
10982
  this.destroyed = true;
10949
10983
  // TODO stop capture /playback
10950
10984
  }
@@ -11030,6 +11064,23 @@ class AudioRecorder extends BasicRecorder {
11030
11064
  this.uploader.listener = (ue) => {
11031
11065
  this.uploadUpdate(ue);
11032
11066
  };
11067
+ let wakeLockSupp = ('wakeLock' in navigator);
11068
+ // if(wakeLockSupp) {
11069
+ // let wakeLock = null;
11070
+ // try {
11071
+ // //@ts-ignore
11072
+ // wakeLock = navigator.wakeLock.request('screen');
11073
+ //
11074
+ // //statusElem.textContent = 'Wake Lock is active!';
11075
+ // } catch (err) {
11076
+ // // The Wake Lock request has failed - usually system related, such as battery.
11077
+ // console.error('Wakelock failed'+err)
11078
+ // }
11079
+ // }else{
11080
+ // let noSleep=new NoSleep();
11081
+ // noSleep.enable();
11082
+ //
11083
+ // }
11033
11084
  }
11034
11085
  onKeyPress(ke) {
11035
11086
  if (ke.key == ' ') {
@@ -11126,6 +11177,9 @@ class AudioRecorder extends BasicRecorder {
11126
11177
  let chCnt = ProjectUtil.DEFAULT_AUDIO_CHANNEL_COUNT;
11127
11178
  if (project) {
11128
11179
  console.info("Project name: " + project.name);
11180
+ if (project.recordingDeviceWakeLock === true) {
11181
+ this.wakeLock = true;
11182
+ }
11129
11183
  this.audioDevices = project.audioDevices;
11130
11184
  chCnt = ProjectUtil.audioChannelCount(project);
11131
11185
  console.info("Project requested recording channel count: " + chCnt);
@@ -11229,6 +11283,7 @@ class AudioRecorder extends BasicRecorder {
11229
11283
  }
11230
11284
  }
11231
11285
  startItem() {
11286
+ this.enableWakeLockCond();
11232
11287
  this.transportActions.startAction.disabled = true;
11233
11288
  this.transportActions.pauseAction.disabled = true;
11234
11289
  if (this.readonly) {
@@ -11893,7 +11948,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
11893
11948
  }]
11894
11949
  }] });
11895
11950
 
11896
- const VERSION = '2.23.9';
11951
+ const VERSION = '2.24.0';
11897
11952
 
11898
11953
  /*
11899
11954
  * Public API Surface of speechrecorderng