Sha256: 74553a475924f9606608e6868f4e7bb7cdebb66438bedea9bc71d0d33f2177ab

Contents?: true

Size: 680 Bytes

Versions: 10

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Engine
    class VideoOnebox
      include Engine

      matches_regexp(/^(https?:)?\/\/.*\.(mov|mp4|webm|ogv)(\?.*)?$/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
          <div class="onebox video-onebox">
            <video width='100%' height='100%' controls>
              <source src='#{escaped_url}'>
              <a href='#{escaped_url}'>#{@url}</a>
            </video>
          </div>
        HTML
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
onebox-1.8.99 lib/onebox/engine/video_onebox.rb
onebox-1.8.98 lib/onebox/engine/video_onebox.rb
onebox-1.8.97 lib/onebox/engine/video_onebox.rb
onebox-1.8.96 lib/onebox/engine/video_onebox.rb
onebox-1.8.95 lib/onebox/engine/video_onebox.rb
onebox-1.8.94 lib/onebox/engine/video_onebox.rb
onebox-1.8.93 lib/onebox/engine/video_onebox.rb
onebox-1.8.92 lib/onebox/engine/video_onebox.rb
onebox-1.8.91 lib/onebox/engine/video_onebox.rb
onebox-1.8.90 lib/onebox/engine/video_onebox.rb