 
   playState: ->
     if typeof(window.player) != "undefined"
-      data = $(window.player.domNode).data()
-      duration = window.player.duration
-      if !isNaN(duration)
-        feedbin.setDuration(data.entryId, duration)
+      if feedbin.hasDuration()
+        feedbin.setDuration(feedbin.nowPlayingData.entryId, window.player.duration)
 
-      play = $("[data-behavior~=audio_play_#{data.entryId}]")
+      play = $("[data-behavior~=audio_play_#{feedbin.nowPlayingData.entryId}]")
       if window.player.paused
         play.addClass('paused')
         play.removeClass('playing')

      minutes = Math.floor(duration / 60);
      durationElement.text("#{minutes} minutes")

  playTime: (entryId) ->
    if (entryId of feedbin.data.progress)
      progress = feedbin.data.progress[entryId]
      durationElement = $("[data-behavior~=audio_duration_#{entryId}]")
      left = progress.duration - progress.progress
      minutes = Math.ceil(left / 60);

window.feedbin ?= {}

$.extend feedbin,

  nowPlayingdata: {}

  hasDuration: ->
    if isNaN(window.player.duration) || window.player.duration == 0
      false
    else
      true

  loadProgress: (entryId) ->
    if (entryId of feedbin.data.progress)
      feedbin.data.progress[entryId]
    else
      false

  initPlayer: (play = true) ->
    $('body').removeClass('audio-panel-minimized')
