Coder Social home page Coder Social logo

video_player's Introduction

Video player for Youtube, Vimeo, İzlesene and Wistia

Gem Version

Create video player for Youtube, Vimeo, İzlesene and Wistia 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, Vimeo, İzlesene and Wistia video link

http://www.youtube.com/watch?v=iEPTlhBmwRg

or

http://vimeo.com/101419884

or

http://www.izlesene.com/video/feder-goodbye-feat-lyse/7886121

or

https://.wistia.com/medias/9ub91enoph

width (default = 420)

height (default = 315)

autoplay (default = true) - works only on Youtube

Usage

require 'video_player' # if you're not use Rails 4
VideoPlayer::player("http://vimeo.com/101419884")
# returns iframe player from Vimeo video
#   <iframe width=\"420\" height=\"315\"
#           src=\"//player.vimeo.com/video/101419884\"
#           frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></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" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

VideoPlayer::player("http://www.izlesene.com/video/feder-goodbye-feat-lyse/7886121")
# returns iframe player from İzlesene video
#   <iframe width=\"420\" height=\"315\"
#           src=\"//www.izlesene.com/embedplayer/7886121/?autoplay=1&showrel=0&showinfo=0\"
#           frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

VideoPlayer::player("https://example.wistia.com/medias/9ub91enoph")
# returns iframe player from Wistia video
#   <iframe width=\"420\" height=\"315\"
#           src=\"//fast.wistia.net/embed/iframe/9ub91enoph/?autoplay=1&showrel=0&showinfo=0\"
#           frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

It gets you only raw data. You must handle it on erb, haml, slim, etc for output without HTML escaping.

video = VideoPlayer::player("http://vimeo.com/101419884")

# erb
<%= video.html_safe %>

# haml, slim
= video.html_safe
# or
== video

Contributing

  1. Fork it ( https://github.com/tgezginis/video_player/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Extend the specs, run with rake
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Thanks mikel foxgaocn

video_player's People

Contributors

tgezginis avatar harry-gao avatar

Watchers

NM avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.