Class: AnimateIt::AudioController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AnimateIt::AudioController
- Defined in:
- app/controllers/animate_it/audio_controller.rb
Constant Summary collapse
- AUDIO_BASE =
Rails.root.join("app/audio").freeze
Constants inherited from ApplicationController
AnimateIt::ApplicationController::NullPolicy
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/animate_it/audio_controller.rb', line 5 def show audio_segments = composition.timeline.segments.select { |seg| seg.kind == :audio } segment = audio_segments[params[:index].to_i] return head :not_found unless segment file_path = resolve_audio_path(segment.source[:path]) return head :not_found unless file_path && File.file?(file_path) send_file file_path, type: Mime::Type.lookup_by_extension(File.extname(file_path).delete(".")), disposition: "inline" end |