Video player for Youtube and Vimeo
Create video player for Youtube and Vimeo videos for Ruby.
And it may support more video hoster with your contributions.
Installation
Add it to your Gemfile:
gem 'video_player'
and run on terminal:
$ bundle
or install the gem on terminal.
$ gem install video_player
Parameters
url
Youtube or Vimeo video link http://www.youtube.com/watch?v=iEPTlhBmwRg or http://vimeo.com/101419884
width (default = 420) height (default = 315) autoplay (default = true) - works only on Youtube
Usage
require 'video_player'
VideoPlayer::player("http://vimeo.com/101419884")
# returns iframe player from Vimeo video
# <iframe src=\"//player.vimeo.com/video/101419884\" width=\"420\" height=\"315\" frameborder=\"0\"></iframe>
VideoPlayer::player("http://www.youtube.com/watch?v=iEPTlhBmwRg", "1200", "800", true)
# returns iframe player which has 1200px width and 800px height with autoplay from Youtube video
# <iframe width=\"1200\" height=\"800\" src=\"//www.youtube.com/embed/iEPTlhBmwRg?autoplay=1&rel=0\" frameborder=\"0\" allowfullscreen></iframe>
Rails 4
VideoPlayer::player("http://vimeo.com/101419884")
# returns iframe player from Vimeo video
# <iframe src=\"//player.vimeo.com/video/101419884\" width=\"420\" height=\"315\" frameborder=\"0\"></iframe>
VideoPlayer::player("http://www.youtube.com/watch?v=iEPTlhBmwRg", "1200", "800", true)
# returns iframe player which has 1200px width and 800px height with autoplay from Youtube video
# <iframe width=\"1200\" height=\"800\" src=\"//www.youtube.com/embed/iEPTlhBmwRg?autoplay=1&rel=0\" frameborder=\"0\" allowfullscreen></iframe>
Contributing
- Fork it ( https://github.com/tgezginis/video_player/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