Skip to content

Commit d255e5e

Browse files
committed
#479 revokeObjectURL after audio playback finishes
1 parent 7bc3b1a commit d255e5e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

js/player.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ const audioPlayer = immediate(() => {
6262
return {
6363
play(src, rate, volume) {
6464
if (current) current.playback.unsubscribe()
65-
const url = (src instanceof Blob) ? URL.createObjectURL(src) : src
65+
const isBlob = src instanceof Blob
66+
const url = isBlob ? URL.createObjectURL(src) : src
6667
const playbackState$ = new rxjs.BehaviorSubject("resumed")
6768
return new Promise((fulfill, reject) => {
6869
current = {
@@ -72,6 +73,7 @@ const audioPlayer = immediate(() => {
7273
error: reject
7374
})
7475
}
76+
if (isBlob) current.playback.add(() => URL.revokeObjectURL(url))
7577
})
7678
},
7779
pause() {

0 commit comments

Comments
 (0)