discourse/lib/oneboxer/_audio_onebox.rb

13 lines
246 B
Ruby
Raw Normal View History

require_dependency 'oneboxer/base_onebox'
module Oneboxer
class AudioOnebox < BaseOnebox
matcher /^https?:\/\/.*\.mp3$/
def onebox
"<audio controls><source src='#{@url}'><a href='#{@url}'>#{@url}</a></audio>"
end
end
end