Sha256: a0036e290e21507227e34d4521d15964c9a869b782c29906e6ab86790e79abf1

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

module Pageflow
  class VideoFileUrlTemplates
    def call
      {
        original: url_template(:attachment, :original),

        high: url_template(:mp4_high),
        medium: url_template(:mp4_medium),
        fullhd: url_template(:mp4_fullhd),
        :'4k' => url_template(:mp4_4k),

        :'hls-playlist' => url_template(:hls_playlist),
        :'dash-playlist' => url_template(:dash_playlist),

        poster_medium: url_template(:poster, :medium),
        poster_large: url_template(:poster, :large),
        poster_ultra: url_template(:poster, :ultra),

        print: url_template(:poster, :print)
      }
    end

    private

    def url_template(attachment_name, *style)
      UrlTemplate.from_attachment(example_file.send(attachment_name), *style)
    end

    def example_file
      @example_file ||= VideoFile.new(id: 0).tap do |video_file|
        video_file.file_name = ':basename.:extension'
        video_file.output_presences = {':pageflow_hls_qualities' => true}
        video_file.poster_file_name = video_file.zencoder_poster.original_filename
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/models/pageflow/video_file_url_templates.rb
pageflow-17.0.3 app/models/pageflow/video_file_url_templates.rb
pageflow-17.0.2 app/models/pageflow/video_file_url_templates.rb
pageflow-17.0.1 app/models/pageflow/video_file_url_templates.rb
pageflow-17.0.0 app/models/pageflow/video_file_url_templates.rb
pageflow-16.2.0 app/models/pageflow/video_file_url_templates.rb
pageflow-16.1.0 app/models/pageflow/video_file_url_templates.rb