[Feature][ActiveStorage] Make a preview from a middle frame of the attached video

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Feature][ActiveStorage] Make a preview from a middle frame of the attached video

Dmitriy Shcherbakan
Currently, if you want to make a preview for a video file ActiveStorage::Previewer::VideoPreviewer will pick the first frame of the video https://github.com/rails/rails/blob/master/activestorage/lib/active_storage/previewer/video_previewer.rb#L19 without any options to customize this behavior.

Since the first frames are often not very informative(f.e. black start screen) I suggest adding the ability to pick a screenshot for a preview from a middle of the video.
record.attachment.preview(middle_frame: true)
This API would be convenient, but since the variation isn't passed into the previewer, it will require changes not only in VideoPreviewer class.

What will be your thoughts about this feature?
In the case of positive feedback, I'll be glad to start implementation.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/a0e7713c-2341-4f81-bc5d-d16a0d660af2%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Feature][ActiveStorage] Make a preview from a middle frame of the attached video

Andrew Kaspick
Or passing a frame: option that accepts a specific frame number or a flag such as :middle.

On Mon., Sep. 30, 2019, 11:15 p.m. Dmitriy Shcherbakan, <[hidden email]> wrote:
Currently, if you want to make a preview for a video file ActiveStorage::Previewer::VideoPreviewer will pick the first frame of the video https://github.com/rails/rails/blob/master/activestorage/lib/active_storage/previewer/video_previewer.rb#L19 without any options to customize this behavior.

Since the first frames are often not very informative(f.e. black start screen) I suggest adding the ability to pick a screenshot for a preview from a middle of the video.
record.attachment.preview(middle_frame: true)
This API would be convenient, but since the variation isn't passed into the previewer, it will require changes not only in VideoPreviewer class.

What will be your thoughts about this feature?
In the case of positive feedback, I'll be glad to start implementation.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/a0e7713c-2341-4f81-bc5d-d16a0d660af2%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/CAEUKiYE_T%3DTMSiRkX6zVAYCAKiWuXDR9oGKpPDQYhs1vmnNMLw%40mail.gmail.com.