Module: SamveraHls::FileSetsControllerBehavior

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

Instance Method Summary collapse

Instance Method Details

#embedObject



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

def embed
  response.headers["X-FRAME-OPTIONS"] = "ALLOWALL"
  @playlist_url = File.join("file_set",params[:id],"hls.m3u8")
  @media_partial = media_display_partial(params[:id])
  render layout: false
end

#masterObject



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

def master
  render inline: SamveraHls::HlsPlaylistGenerator.hls_master_playlist(params[:id],root_url), content_type: 'application/x-mpegurl'
end

#media_display_partial(file_set_id) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/concerns/samvera_hls/file_sets_controller_behavior.rb', line 25

def media_display_partial(file_set_id)
  file_set = SolrDocument.find(file_set_id)
  base = 'file_sets/media_display'
    if file_set.image?
      File.join('hyrax',base,'image')
    elsif file_set.video?
      File.join(base,'video_hls')
    elsif file_set.audio?
      File.join(base,'audio_hls')
    elsif file_set.pdf?
      File.join('hyrax',base,'pdf')
    elsif file_set.office_document?
      File.join('hyrax',base,'office_document')
    else
      File.join('hyrax',base,'default')
    end
end

#variantObject



21
22
23
# File 'app/controllers/concerns/samvera_hls/file_sets_controller_behavior.rb', line 21

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