From a349dbd927a7f60b95b30d7c25382a52d332a052 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sun, 16 Dec 2012 14:04:41 +0100 Subject: Destroy sound object when done playing. --- static/sound.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/sound.js b/static/sound.js index 07366ff..85386ce 100644 --- a/static/sound.js +++ b/static/sound.js @@ -21,7 +21,7 @@ function playsound(model) { slider = $('#progress').slider({ max: sound.duration, slide: function(event, ui) { - if(event.originalEvent) + if(event.originalEvent && sound) sound.setPosition(ui.value); } }); @@ -46,6 +46,10 @@ function playsound(model) { var next = playlist.next(); if(next) { playsound(next, $('#cid-' + next.cid)); + } else { + sound.stop(); + sound.destruct(); + sound = null; } } }); -- cgit v1.2.3