     if @audioChannel(channelId)?
       @unmute(channelId)
 
+  @playAudioNotice: ->
+    url    = @localFileUrl('ding.wav')
+    player = $('.audio_private')[0]
+    player.setAttribute('src', url)
+    player.play()
+
 # Kandan.Plugins.register "Kandan.Plugins.MusicPlayer"

  @widgetTitle: "Player"
  @playRegex: /^&#x2F;play .+/
  @stopRegex: /^&#x2F;stop/
  @localSongData: false


  @playTemplate: _.template('<strong><a class="audio-play">playing</a> <a target="_blank" href="<%- url %>"><%- url %></a></strong>')
  @songTemplate: _.template('<li><%= song.split("/").pop() %></li>')


  @setError: (errorMessage)->

  @init: (pluginId)->
    @pluginId = pluginId
    Kandan.Data.Channels.registerCallback("change", $.proxy(@onChannelChange, this))
    @registerPlayModifier()
    @registerStopModifier()
    @registerResumeModifier()
    # Disabled for now
    #@registerWidget()


  @registerWidget: ()->
    Kandan.Widgets.register @pluginNamespace


  @registerPlayModifier: ()->
    Kandan.Modifiers.register @playRegex, (message, state) =>
      url = $.trim(message.content.substr(message.content.indexOf(" ") + 1));
      if true and Kandan.Data.Channels.activeChannelId()? # and state == Kandan.Helpers.Activities.ACTIVE_STATE commented out because state == undefined for some reason
        rawInput  = Kandan.Helpers.Utils.unescape(url)
        soundUrl  = null
        soundUrl  = @localSounds(rawInput)
        soundUrl ?= rawInput

        @playUrl(message.channel_id, soundUrl)
      else
        console.log "Not playing stale song"

      message.content = @playTemplate({url: url})
      return Kandan.Helpers.Activities.buildFromBaseTemplate message

  @registerStopModifier: ()->
    Kandan.Modifiers.register @stopRegex, (message, state) =>
      url = $.trim(message.content.substr(message.content.indexOf(" ") + 1));
      if true and Kandan.Data.Channels.activeChannelId()?
        @stopSound(message.channel_id)

      message.content = @stopTemplate()
      return Kandan.Helpers.Activities.buildFromBaseTemplate message

  @registerResumeModifier: ()->
    Kandan.Modifiers.register @resumeRegex, (message, state) =>
      if true and Kandan.Data.Channels.activeChannelId()?
        @play(message.channel_id)

      message.content = @resumeTemplate()
      return Kandan.Helpers.Activities.buildFromBaseTemplate message


