Class: HLS::EncodeJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/hls/encode_job.rb

Overview

ActiveJob wrapper that runs a profile’s full pipeline (encode + upload).

Enqueue with:

HLS::EncodeJob.perform_later(
  profile: "CourseVideo",
  input:   "/path/to/source.mp4",
  output:  "/path/to/working/dir",
  key_prefix: "phlex/forms/overview"
)

Instance Method Summary collapse

Instance Method Details

#perform(profile:, input:, output:, key_prefix: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/hls/encode_job.rb', line 33

def perform(profile:, input:, output:, key_prefix: nil)
  profile_class = profile.is_a?(Class) ? profile : profile.constantize
  input_obj = input.is_a?(HLS::Input) ? input : HLS::Input.new(input)

  profile_class.new(
    input: input_obj,
    output: Pathname.new(output),
    key_prefix: key_prefix
  ).process
end