Fallback image for Rail's video_tag

It seems like there is no way to provide a fallback image with Rail’s video_tag.

Is there a specific reason that the method was created this way? http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html

Has anyone else come across the need to use a fallback image when using video_tag, or found a way to do it without using raw html?

on that note any plans to support picture_tag (the emerging new standard for displaying pictures?)

something like what you see here: https://github.com/G5/picture_tag-rails

Seems like you can do it using the poster option.

Seems like you can do it using the poster option.

I believe Aaron is referring to putting an img tag inside the video element, to accommodate browsers that don’t understand video at all.


Setting a placeholder won’t help those browsers, since they don’t handle the tag at all.

—Matt Jones

I think people using video_tag or picture_tag will probably be using polyfils or fallbacks.

While we’re on the subject, it would be great to think long-term about supporting picture_tag too, generally it needs a polyfil and a CarrierWave/Paperclip integration, so it may or may not be something to integrate into the Rails core.

I think Rails should take emerging standards (picture_tag and video_tag) seriously as we transition into this new territory.


Yes Matt,

That is precisely what I am referring to.