Skip to content

Commit

Permalink
Revert "endPromise contingent on startPromise"
Browse files Browse the repository at this point in the history
This reverts commit 8fac680.
  • Loading branch information
ken107 committed Nov 14, 2024
1 parent 37bfdd1 commit c7aa3d5
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions js/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,23 +817,14 @@ function playAudioHere(urlPromise, options, startTime) {
if (err instanceof DOMException) throw new Error(err.name || err.message)
else throw err
})
silenceTrack.start()
})

const endPromise = startPromise
.then(async () => {
if (!audio.ended) {
silenceTrack.start()
try {
await new Promise((fulfill, reject) => {
audio.onended = fulfill
audio.onerror = () => reject(new Error(audio.error.message || audio.error.code))
})
}
finally {
silenceTrack.stop()
}
}
})
const endPromise = new Promise((fulfill, reject) => {
audio.onended = fulfill
audio.onerror = () => reject(new Error(audio.error.message || audio.error.code))
})
.finally(() => silenceTrack.stop())

return {
startPromise,
Expand Down

0 comments on commit c7aa3d5

Please sign in to comment.