0

I'm trying to embed a video in my rails app with this code <%= video_tag('greeting.mp4', controls: true, class: 'tnit-about-video') %> In Chrome and Firefox everything works fine, but on Safari in Mac and general on iOS the video doesn't play. I read on SO that the video should have certain dimensions and bitrate etc. and converted it accordingly, but it was no use. Also tried webm instead of mp4.

In general I am open to use a different free solution than the standard rails video tag, if anyone can suggest a good videoplayer.

Donvini
  • 15
  • 5

1 Answers1

0

By default, files are loaded from public/videos. To load from assets/video add the following line to your config/application.rb file. So add this line to your application.rb.

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

Try this code

<video loop autoplay controls="true" width='100%' height='100%' src='//some_video.mp4' type='video/mp4'></video>

OR

using rails tags

<%= video_tag (["movie.mp4", "movie.ogg", "movie.webm"] :size => "320x240", :controls => true, :autobuffer => true) %>
Aniket Tiwari
  • 3,561
  • 4
  • 21
  • 61
  • The reason really was the config file, after adding that my code works now without change, thank you! – Donvini Dec 13 '17 at 13:07