Module: HydraHls::FileSetsControllerBehavior

Extended by:
ActiveSupport::Concern
Included in:
FileSetsController
Defined in:
app/controllers/concerns/hydra_hls/file_sets_controller_behavior.rb

Instance Method Summary collapse

Instance Method Details

#embedObject



5
6
7
8
9
10
# File 'app/controllers/concerns/hydra_hls/file_sets_controller_behavior.rb', line 5

def embed
  fs = FileSet.find(params[:id])
  @playlist_url = fs.hls_master_url
  @media_partial = media_display_partial(fs)
  render layout: false
end

#masterObject



12
13
14
15
# File 'app/controllers/concerns/hydra_hls/file_sets_controller_behavior.rb', line 12

def master
  fs = FileSet.find(params[:id])
  render inline: fs.hls_master_playlist(root_url), content_type: 'application/x-mpegurl'
end

#media_display_partial(file_set) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/concerns/hydra_hls/file_sets_controller_behavior.rb', line 22

def media_display_partial(file_set)
  'curation_concerns/file_sets/media_display/' +
    if file_set.image?
      'image'
    elsif file_set.video?
      'video_hls'
    elsif file_set.audio?
      'audio_hls'
    elsif file_set.pdf?
      'pdf'
    elsif file_set.office_document?
      'office_document'
    else
      'default'
    end
end

#variantObject



17
18
19
20
# File 'app/controllers/concerns/hydra_hls/file_sets_controller_behavior.rb', line 17

def variant
  fs = FileSet.find(params[:id])
  render inline: fs.hls_segment_playlist(root_url,params[:format]), content_type: 'application/x-mpegurl'
end