简体   繁体   中英

Rails background video on landing page

I am trying to put a video background on my landing page but I am getting a routing error?

No route matches [GET] "/videos/propose.mp4"

This is what I have done so far:

Here is the video path app/assets/videos/propose.mp4

config/application.rb

config.assets.paths << "#{Rails.root}/app/assets/videos"

landing.html.erb

<%= video_tag "propose.mp4", autoplay: :autoplay, loop: :loop, mute: :mute, class: "video" %>

application.css.scss

.video {
 position: fixed;
 top: 50%; left: 50%;
 z-index: 1;
 min-width: 100%;
 min-height: 100%;
 width: auto;
 height: auto;
 transform: translate(-50%, -50%);
}

I have never used a video on a rails site so I feel like I might be missing a step. Thanks!

Thanks Sajan... of course it was something simple. I just had to restart my server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM