Permalink
Browse files

Fix auto play controller play/pause button state.

  • Loading branch information...
1 parent 552b0c6 commit 3f86edc6cd647b53e03e5563869eb3307ded1b6d Alexis Bernard committed Dec 23, 2012
Showing with 5 additions and 5 deletions.
  1. +0 −5 app/assets/javascripts/player.js.coffee
  2. +5 −0 app/assets/javascripts/swag_fm.js.coffee
@@ -7,7 +7,6 @@ class @Player
window.onYouTubePlayerReady = @onYouTubePlayerReady.bind(this)
window.onYouTubeStateChanged = @onYouTubeStateChanged.bind(this)
@youtube = new YoutubeWrapper()
- @autoPlay()
observe: (name, callback) ->
@callbacks || (@callbacks = {})
@@ -19,10 +18,6 @@ class @Player
for callback in @callbacks[name]
callback.apply(undefined, Array.prototype.slice.call(arguments, 1))
- autoPlay: () ->
- if window.location.hash && $(window.location.hash)[0]
- @play(@findTrackByAnchor(window.location.hash.replace('#', '')))
-
findTrackByAnchor: (anchor) ->
for track in @tracks()
if track.anchor == anchor
@@ -3,7 +3,12 @@ class @SwagFm
@player = new Player()
@gallery = new Gallery(@player)
@controller = new Controller(@player)
+ @autoPlay()
pageChanged: () ->
@gallery.initializeEvents()
@controller.initializeEvents()
+
+ autoPlay: () ->
+ if window.location.hash && $(window.location.hash)[0]
+ @player.play(@player.findTrackByAnchor(window.location.hash.replace('#', '')))

0 comments on commit 3f86edc

Please sign in to comment.