A Ruby gem to wrap the functionalities of the Vide jQuery plugin.
- Write some RSpec tests for this gem
- :wq
Add this line to your application's Gemfile:
gem 'vider', github: 'wazery/vider'
And then execute:
$ bundle
Or install it yourself as:
$ gem install vider
Add the required JS file to your app/assets/javascripts/application.js
//= require jquery.vide
- All modern desktop browsers are supported.
- IE9+
- iOS plays video from a browser only in the native player. So video for iOS is disabled, only fullscreen poster will be used.
- Some Android devices play video, some not — go figure. So video for Android is disabled, only fullscreen poster will be used.
Prepare your video in several formats like '.webm', '.mp4' for cross browser compatability, also add a poster with .jpg
, .png
or .gif
extension:
path/
├── to/
│ ├── video.mp4
│ ├── video.ogv
│ ├── video.webm
│ └── video.jpg
You can use the Vider view helpers to add video elements to your Rails views.
<%= vider_tag 'path/to/video', position: '100% 100%' %>
I recommend the video to be in the assets directory like so for example: 'assets/video.mp4'
Note that video.mp4 will be under videos
directory
Below is a complete list of options, and matching default values:
- volume default is 1,
- playbackRate default is 1
- muted default is true
- loop default is true
- autoplay default is true
- position default is "50% 50%"
- posterType default is "detect"
If you like this project you may support me by donating something on Gittip, starring this repository or reporting bugs and ideas in the issue section.
- Fork it ( https://github.com/wazery/vider/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
The MIT License (MIT)
Copyright (c) 2014 Islam Wazery, http://www.whitespace.company
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.