module Streamable extend ActiveSupport::Concern def stream_url storage_location.adapter.stream_url(self) end def streamable? duration.present? && storage_location.enabled? && storage_location.adapter.readable? end def stream_type case source_type when "s3" then :presigned when "local" then :direct else :proxy end end end