In a Rails 5.2 app, I want to display a video previously uploaded in S3 via Active Storage. When I use this:
<%= video_tag [@banner_video.video_mp4, @banner_video.video_webm] %>
I get this error:
The asset "" is not present in the asset pipeline.
I checked in console, and my variable @banner_video is exactly what I think it should be.
2 variants that I used to make it work
<%= video_tag url_for(@banner_video.file), size: "150x120", controls: true %>
or with to get S3 url
<%= video_tag @banner_video.file.service_url, size: "150x120", controls: true %>
I found a solution not using video_tag
, with a little hack.
<video>
<source src=<%= rails_blob_path(@banner_video.video_mp4) %> type="video/mp4" />
<source src=<%= rails_blob_path(@banner_video.video_webm) %> type="video/webm" />
</video>
This is working, looks like video_tag
is not handling remote sources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With