Skip to content

Commit 5ea0e1e

Browse files
committed
bugfix: playing logic
1 parent abea81f commit 5ea0e1e

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

media/vscodeignore/spec-sc4.png

2.95 MB
Loading

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,22 @@
4040
{
4141
"command": "spectrogram.revealInFileExplorer",
4242
"title": "Reveal in File Explorer"
43+
},
44+
{
45+
"command": "spectrogram.refresh",
46+
"title": "Refresh",
47+
"icon": "$(refresh)"
4348
}
4449
],
4550
"menus": {
4651
"commandPalette": [
4752
{
4853
"command": "spectrogram.revealInFileExplorer",
4954
"when": "false"
55+
},
56+
{
57+
"command": "spectrogram.refresh",
58+
"when": "false"
5059
}
5160
],
5261
"view/item/context": [

src/controller.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const REFRESH_ICON = '<i class="codicon codicon-refresh"></i>'
8181
susresBtn.innerHTML = PLAY_ICON
8282
cancelAnimationFrame(id)
8383
played += Date.now() - startAt
84+
togglePlaybackButtons('PAUSED')
8485
})
8586
} else if (isEnded) {
8687
isEnded = false
@@ -108,6 +109,7 @@ const REFRESH_ICON = '<i class="codicon codicon-refresh"></i>'
108109
startAt = Date.now()
109110
draw()
110111
durationWatch()
112+
togglePlaybackButtons('PLAYING')
111113
})
112114
}
113115
}
@@ -215,8 +217,16 @@ const REFRESH_ICON = '<i class="codicon codicon-refresh"></i>'
215217
seekbar.style.display = 'none'
216218
break
217219
case 'READY':
220+
susresBtn.innerHTML = PLAY_ICON
221+
susresBtn.classList.remove('disabled')
222+
susresBtn.disabled = false
223+
backBtn.style.display = 'none'
224+
forwardBtn.style.display = 'none'
225+
seekbar.style.display = 'none'
226+
break
227+
case 'PAUSED':
218228
case 'PLAYING':
219-
susresBtn.innerHTML = state === 'PLAYING' ? PAUSE_ICON : PLAY_ICON
229+
susresBtn.innerHTML = state === 'PAUSED' ? PLAY_ICON : PAUSE_ICON
220230
susresBtn.classList.remove('disabled')
221231
susresBtn.disabled = false
222232
backBtn.style.display = 'inline-block'

src/extension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function activate(context) {
1919
}
2020
const { fullFilePath } = file.selection[0]
2121
const format = fullFilePath.split('.').pop()
22-
if (!['flac', 'mp3'].includes(format)) return
22+
if (!['flac', 'mp3', 'wav'].includes(format.toLowerCase())) return
2323

2424
const label = path.parse(file.selection[0].label).name
2525
const songPath = Uri.file(fullFilePath)

0 commit comments

Comments
 (0)