Search code examples
ruby-on-railsvideorails-activestorage

Active Storage: displaying video in video_tag


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.


Solution

  • 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.