Hcode/fix suno (#89)

This commit is contained in:
HCode authored and GitHub committed 2024-07-29 12:44:45 +08:00
1 parent 0e966fa202
commit cb5d49a819
2 files changed
+14 -5

No files matched your search

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix suno bug",
"packageName": "@acedatacloud/nexior",
"email": "1348977728@qq.com",
"dependentChangeType": "patch"
}
+7 -5
View File
@@ -35,7 +35,6 @@ watch(audio, (value, oldValue) => {
delete value.object;
}
const object = new Audio(value.audio_url);
object.currentTime = 0;
if (value.state === 'playing') {
object.play();
} else {
@@ -43,10 +42,13 @@ watch(audio, (value, oldValue) => {
}
// listen to the time change of audio
object.addEventListener('timeupdate', () => {
store.commit('suno/setAudio', {
...store.state.suno.audio,
progress: object.currentTime
object.addEventListener('loadedmetadata', () => {
object.currentTime = 0;
object.addEventListener('timeupdate', () => {
store.commit('suno/setAudio', {
...store.state.suno.audio,
progress: object.currentTime
});
});
});