Sha256: 1db17bad5e678c10b25ecc0fffa1b19051ec35ffa620bfcc8c901b1e24256da7

Contents?: true

Size: 461 Bytes

Versions: 8

Compression:

Stored size: 461 Bytes

Contents

module Onebox
  module Engine
    class AudioOnebox
      include Engine

      matches_regexp(/^(https?:)?\/\/.*\.(mp3|ogg|wav|m4a)(\?.*)?$/i)

      def always_https?
        WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts)
      end

      def to_html
        url = ::Onebox::Helpers.normalize_url_for_output(@url)
        "<audio controls><source src='#{url}'><a href='#{url}'>#{url}</a></audio>"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
onebox-1.7.3 lib/onebox/engine/audio_onebox.rb
onebox-1.7.2 lib/onebox/engine/audio_onebox.rb
onebox-1.7.1 lib/onebox/engine/audio_onebox.rb
onebox-1.7.0 lib/onebox/engine/audio_onebox.rb
onebox-1.6.9 lib/onebox/engine/audio_onebox.rb
onebox-1.6.8 lib/onebox/engine/audio_onebox.rb
onebox-1.6.7 lib/onebox/engine/audio_onebox.rb
onebox-1.6.6 lib/onebox/engine/audio_onebox.rb