0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

railsのvideo_tagのパスの指定

Posted at

htmlのvideoタグを生成するhelper

URL指定

<%= video_tag("https://sample.com/videos/sample.mp4", :autoplay => true, :loop => true) %>
= video_tag "https://sample.com/videos/sample.mp4", :autoplay => true, :loop => true

ファイルパス指定

public/assets/videos配下に動画ファイルを置いて

= video_tag "sample.mp4", :autoplay => true, :loop => true
<%= video_tag("sample.mp4", :autoplay => true, :loop => true) %>

まとめ

app/assets/videosに置いても読み込まれないのはなぜか & どうしたら読み込まれるのか
ここ

Returns an HTML video tag for the sources. If sources is a string, a single video tag will be returned. If sources is an array, a video tag with nested source tags for each source will be returned. The sources can be full paths or files that exists in your public videos directory.

full pathかpublic videoとあるからapp/assets/videosはそもそも読まれないのか

0
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?