Spaces:
Running
Running
Commit ·
3c021b8
1
Parent(s): 57628a7
fix: file input fallback when app is embedded with iframe
Browse files- index.html +12 -20
- sw.js +1 -1
index.html
CHANGED
|
@@ -948,27 +948,19 @@
|
|
| 948 |
}
|
| 949 |
|
| 950 |
async openFileWithFileSystemAPI() {
|
| 951 |
-
|
| 952 |
-
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
});
|
| 961 |
-
|
| 962 |
-
const file = await fileHandle.getFile();
|
| 963 |
-
const fileId = await this.saveFileHandle(fileHandle, file.name, file.size);
|
| 964 |
-
await this.handleAudioFile(file, fileId);
|
| 965 |
|
| 966 |
-
|
| 967 |
-
|
| 968 |
-
|
| 969 |
-
alert('Error opening file. Please try again.');
|
| 970 |
-
}
|
| 971 |
-
}
|
| 972 |
}
|
| 973 |
|
| 974 |
async loadFileFromHandle(fileId) {
|
|
|
|
| 948 |
}
|
| 949 |
|
| 950 |
async openFileWithFileSystemAPI() {
|
| 951 |
+
const [fileHandle] = await window.showOpenFilePicker({
|
| 952 |
+
types: [{
|
| 953 |
+
description: 'Audio Files',
|
| 954 |
+
accept: {
|
| 955 |
+
'audio/*': ['.mp3', '.wav', '.aac', '.ogg', '.flac', '.m4a']
|
| 956 |
+
}
|
| 957 |
+
}],
|
| 958 |
+
multiple: false
|
| 959 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 960 |
|
| 961 |
+
const file = await fileHandle.getFile();
|
| 962 |
+
const fileId = await this.saveFileHandle(fileHandle, file.name, file.size);
|
| 963 |
+
await this.handleAudioFile(file, fileId);
|
|
|
|
|
|
|
|
|
|
| 964 |
}
|
| 965 |
|
| 966 |
async loadFileFromHandle(fileId) {
|
sw.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
// Use a version that you can update with each release
|
| 2 |
-
const APP_VERSION = '0.1.
|
| 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.12';
|
| 3 |
const CACHE_NAME = `my-pwa-cache-${APP_VERSION}`;
|
| 4 |
|
| 5 |
// List of files to cache
|