Sha256: b7db1911171080306774761d27a4fdec9c418ee8b305b5a77e4fb043ee8fce14

Contents?: true

Size: 553 Bytes

Versions: 37

Compression:

Stored size: 553 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
        escaped_url = ::Onebox::Helpers.normalize_url_for_output(@url)

        <<-HTML
          <audio controls>
            <source src="#{escaped_url}">
            <a href="#{escaped_url}">#{@url}</a>
          </audio>
        HTML
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
onebox-1.8.30 lib/onebox/engine/audio_onebox.rb
onebox-1.8.29 lib/onebox/engine/audio_onebox.rb
onebox-1.8.28 lib/onebox/engine/audio_onebox.rb
onebox-1.8.27 lib/onebox/engine/audio_onebox.rb
onebox-1.8.26 lib/onebox/engine/audio_onebox.rb
onebox-1.8.25 lib/onebox/engine/audio_onebox.rb
onebox-1.8.24 lib/onebox/engine/audio_onebox.rb
onebox-1.8.23 lib/onebox/engine/audio_onebox.rb
onebox-1.8.22 lib/onebox/engine/audio_onebox.rb
onebox-1.8.21 lib/onebox/engine/audio_onebox.rb
onebox-1.8.20 lib/onebox/engine/audio_onebox.rb
onebox-1.8.19 lib/onebox/engine/audio_onebox.rb
onebox-1.8.18 lib/onebox/engine/audio_onebox.rb
onebox-1.8.17 lib/onebox/engine/audio_onebox.rb
onebox-1.8.16 lib/onebox/engine/audio_onebox.rb
onebox-1.8.15 lib/onebox/engine/audio_onebox.rb
onebox-1.8.14 lib/onebox/engine/audio_onebox.rb
onebox-1.8.13 lib/onebox/engine/audio_onebox.rb
onebox-1.8.12 lib/onebox/engine/audio_onebox.rb
onebox-1.8.11 lib/onebox/engine/audio_onebox.rb