Sha256: 4d654d7473cd7862c42125d4a927b7a2fe9fafdcb98949c88efbe7df09fe77bc

Contents?: true

Size: 399 Bytes

Versions: 17

Compression:

Stored size: 399 Bytes

Contents

module Onebox
  module Engine
    class AudioOnebox
      include Engine

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

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

      def to_html
        "<audio controls><source src='#{@url}'><a href='#{@url}'>#{@url}</a></audio>"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
onebox-1.6.5 lib/onebox/engine/audio_onebox.rb
onebox-1.6.4 lib/onebox/engine/audio_onebox.rb
onebox-1.6.3 lib/onebox/engine/audio_onebox.rb
onebox-1.6.2 lib/onebox/engine/audio_onebox.rb
onebox-1.6.1 lib/onebox/engine/audio_onebox.rb
onebox-1.6.0 lib/onebox/engine/audio_onebox.rb
onebox-1.5.65 lib/onebox/engine/audio_onebox.rb
onebox-1.5.64 lib/onebox/engine/audio_onebox.rb
onebox-1.5.63 lib/onebox/engine/audio_onebox.rb
onebox-1.5.62 lib/onebox/engine/audio_onebox.rb
onebox-1.5.61 lib/onebox/engine/audio_onebox.rb
onebox-1.5.60 lib/onebox/engine/audio_onebox.rb
onebox-1.5.50 lib/onebox/engine/audio_onebox.rb
onebox-1.5.49 lib/onebox/engine/audio_onebox.rb
onebox-1.5.48 lib/onebox/engine/audio_onebox.rb
onebox-1.5.47 lib/onebox/engine/audio_onebox.rb
onebox-1.5.45 lib/onebox/engine/audio_onebox.rb