 
   @playUrl: (channelId, url) ->
     @setAudioUrl(channelId, url)
+    @play(channelId)
+
+  @play: (channelId) ->
     @audioChannel(channelId).play()
+
+  @stopSound: (channelId) ->
+    @audioChannel(channelId).pause()
 
   @currentChannel: () ->
     Kandan.Data.Channels.activeChannelId()

    if @audioChannel(channelId)?
      @unmute(channelId)

# Kandan.Plugins.register "Kandan.Plugins.MusicPlayer"

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


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


  @setError: (errorMessage)->
