Skip to content

Commit

Permalink
Hcode/fix suno (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf-github-user authored Jul 29, 2024
1 parent 0e966fa commit cb5d49a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix suno bug",
"packageName": "@acedatacloud/nexior",
"email": "[email protected]",
"dependentChangeType": "patch"
}
12 changes: 7 additions & 5 deletions src/components/suno/player/PlayerSong.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ watch(audio, (value, oldValue) => {
delete value.object;
}
const object = new Audio(value.audio_url);
object.currentTime = 0;
if (value.state === 'playing') {
object.play();
} else {
object.pause();
}
// 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
});
});
});
Expand Down

0 comments on commit cb5d49a

Please sign in to comment.