nixme / warble

The intelligent communal jukebox
10 stars 2 forks source link

jukebox/player: Pandora not advancing to next song when song is complete #53

Open jmouel opened 11 years ago

jmouel commented 11 years ago

There's a JS error when Pandora finishes a song. It causes the player to stop progressing in the queue.

jmouel commented 11 years ago

Not sure if this is a good way to submit patches... let me know if not.

From 2d9cd87f6ef7e64696d44f63c13a1ceb2c148f9c Mon Sep 17 00:00:00 2001
From: Jason Ouellette <jason@parkstconsulting.com>
Date: Fri, 11 Jan 2013 11:15:45 -0800
Subject: [PATCH] https://github.com/nixme/warble/issues/53

---
 app/assets/javascripts/ui/player/pandora.js.coffee |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/app/assets/javascripts/ui/player/pandora.js.coffee b/app/assets/javascripts/ui/player/pandora.js.coffee
index 7dac659..0fe648f 100644
--- a/app/assets/javascripts/ui/player/pandora.js.coffee
+++ b/app/assets/javascripts/ui/player/pandora.js.coffee
@@ -21,11 +21,9 @@ class Warble.PandoraPlayerView extends Backbone.View
       @$('audio').bind 'canplay', ->
         @volume = (vol ? DEFAULT_VOLUME) / 100
         @play()  # chrome 10 bug workaround: autoplay on <audio> doesn't work
-      @$('audio').bind 'ended', @finished   # ended doesn't bubble so backbone can't handle it
+      @$('audio').bind 'ended', =>
+        @trigger 'song:finished' # ended doesn't bubble so backbone can't handle it

   volume: ->
     value = @model.get('volume') / 100
     @$('audio').each -> @volume = value
-
-  finished: ->
-    @trigger 'song:finished'
--
1.7.9.6 (Apple Git-31.1)