Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after_transcoding callback called too soon #39

Open
isuPatches opened this issue Oct 8, 2015 · 0 comments
Open

after_transcoding callback called too soon #39

isuPatches opened this issue Oct 8, 2015 · 0 comments

Comments

@isuPatches
Copy link

I'm using the after_transcoding callback in a method of an uploader for a version of a video file:

def encode
    video = MiniExiftool.new(@file.path)

    aspect_ratio = video.imagewidth.to_f / video.imageheight.to_f
    encode_video(:mp4, resolution: "640x360", aspect: aspect_ratio, audio_codec: "aac", custom: "-strict -2 -b:a 32k", callbacks: { after_transcoding: :set_status })

    instance_variable_set(:@content_type, "video/mp4")
    :set_content_type_mp4
  end

  version :encoded_video do
    process :encode
  end

def set_content_type_mp4(*args)
    self.file.instance_variable_set(:@content_type, "video/mp4")
  end

that hits another method in a model to set a field:

def set_status(format, opts)
      self.update_column(:status, "active")
end

But the callback is being hit before transcoding is complete and the status field is active before the transcoding is complete.

I'm using:

carrierwave (~> 0.10.0)
carrierwave-video (0.5.6)
and ruby 2.2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant