Supports Rails 3.x and 4.x
Add to your Gemfile
gem 'videojs_rails'
And run bundle to install the library.
bundle
Add the resources to your application.js file
# app/assets/javascripts/application.js
//= require video
And that resource to application.css file
/*
*= require_self
*= require video-js
*/
And to production.rb add this line
config.assets.precompile += %w( video-js.swf vjs.eot vjs.svg vjs.ttf vjs.woff )
<%= videojs_rails sources: { mp4: "http://domain.com/path/to/video.mp4", webm: "http://another.com/path/to/video.webm"}, setup: "{}", controls: false, width:"400" %>
If you want add a callback if user don't support JavaScript use block with displayed html code:
<%= videojs_rails sources: { mp4: "http://domain.com/path/to/video.mp4", webm: "http://another.com/path/to/video.webm" }, width:"400" do %>
Please enable <b>JavaScript</b> to see this content.
<%- end %>
This is currently an experimental function.
<%= videojs_rails sources: { mp4: "http://domain.com/path/to/video.mp4" }, width:"400", captions: { en: { src: "http://domain.com/path/to/captions.vvt", label: "English" }, default_caption_language: :en } %>
http://videojs.com/ http://videojs.com/#getting-started
git clone https://github.com/seanbehan/videojs_rails.git
git clone https://github.com/videojs/video.js.git
TAG=v4.12.5
rake videojs:update
Note: The build will fail if you don't have grunt
installed. To install it:
cd ../video.js
npm install -g grunt
git add .
git ci -m "Update to $TAG"
rake release