jorisvaneyghen commited on
Commit
397e431
·
1 Parent(s): 01f45fd

fix: handle cancel file upload; Fix: audioplayer glitches

Browse files
Files changed (3) hide show
  1. index.html +6 -0
  2. js/AudioStretchPlayer.js +2 -1
  3. sw.js +1 -1
index.html CHANGED
@@ -550,6 +550,12 @@
550
  try {
551
  await this.openFileWithFileSystemAPI();
552
  } catch (error) {
 
 
 
 
 
 
553
  console.warn('File System Access API failed, falling back to traditional file input:', error);
554
  // Fallback to traditional file input
555
  this.openFileWithTraditionalInput();
 
550
  try {
551
  await this.openFileWithFileSystemAPI();
552
  } catch (error) {
553
+ // Check if the error is due to user cancellation (AbortError)
554
+ if (error.name === 'AbortError') {
555
+ console.log('File selection was canceled by user');
556
+ // Don't fall back - just return silently
557
+ return;
558
+ }
559
  console.warn('File System Access API failed, falling back to traditional file input:', error);
560
  // Fallback to traditional file input
561
  this.openFileWithTraditionalInput();
js/AudioStretchPlayer.js CHANGED
@@ -200,6 +200,7 @@ export default class AudioStretchPlayer {
200
 
201
  // Clean up existing stretch node
202
  if (this.stretch) {
 
203
  this.stretch.stop();
204
  this.stretch.disconnect();
205
  }
@@ -209,7 +210,7 @@ export default class AudioStretchPlayer {
209
  await this.stretch.addBuffers(channelBuffers);
210
 
211
  this.controlValues.loopEnd = this.audioDuration;
212
- this.configChanged();
213
  this.controlsChanged();
214
 
215
  // Update duration display
 
200
 
201
  // Clean up existing stretch node
202
  if (this.stretch) {
203
+ this.audioContext.suspend();
204
  this.stretch.stop();
205
  this.stretch.disconnect();
206
  }
 
210
  await this.stretch.addBuffers(channelBuffers);
211
 
212
  this.controlValues.loopEnd = this.audioDuration;
213
+ // this.configChanged();
214
  this.controlsChanged();
215
 
216
  // Update duration display
sw.js CHANGED
@@ -1,5 +1,5 @@
1
  // Use a version that you can update with each release
2
- const APP_VERSION = '0.1.14';
3
  const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
4
 
5
  // List of files to cache
 
1
  // Use a version that you can update with each release
2
+ const APP_VERSION = '0.1.15';
3
  const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
4
 
5
  // List of files to cache