Skip to content

Commit

Permalink
Cleanup MediaTag#build_markup a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeck committed May 3, 2016
1 parent bfe5972 commit 5ce7e97
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/embed/media_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ def initialize(ng_doc, viewer)
attr_reader :ng_document, :purl_document, :request, :viewer

def build_markup
file_index = 0
purl_document.contents.each do |resource|
label = resource.description
next unless SUPPORTED_MEDIA_TYPES.include?(resource.type.to_sym)
label = resource.description
resource.files.each do |file|
label = file.title if label.blank?
ng_document.send(
Expand All @@ -30,10 +29,8 @@ def build_markup
'data-src': streaming_url_for(file, :dash),
controls: 'controls',
height: "#{viewer.body_height.to_i - 24}px"
) do
enabled_streaming_sources(file)
end
file_index += 1
) { enabled_streaming_sources(file) }
@file_index += 1
end
end
end
Expand All @@ -55,6 +52,10 @@ def enabled_streaming_types
Settings.streaming[:source_types]
end

def file_index
@file_index ||= 0
end

def streaming_url_for(file, type)
suffix = streaming_settings_for(type)[:suffix]
"#{Settings.stacks_url}/media/#{purl_document.druid}/#{file.title}/stream#{suffix}"
Expand Down

0 comments on commit 5ce7e97

Please sign in to comment.