dqnamo / gembed

Ruby gem providing tools for media embedding.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embed Media By URL

Use gembed to embed media from various sources into your application.

Install

Add this to your Gemfile:

gem 'gembed'

Then run bundle install and you're ready to go! 🎉

Usage

Basic

In your view pass in the media url.

Gembed.insert("https://www.youtube.com/watch?v=jNQXAC9IVRw")

Voila! Thats it. See below for a full list of sources, options and supported url types.

Get ID

Gembed.find_id("https://www.youtube.com/watch?v=jNQXAC9IVRw")

This will return just the ID: jNQXAC9IVRw

Supported Sources

Here is the full list of sources supported on gembed:

Source Options Supported URL Schemes
Loom - https://useloom.com/share/* https://loom.com/share/* http://loom.com/share/* http://useloom.com/share/*
YouTube - https://youtu.be/* https://youtube.com/* http://youtube.com/* http://youtu.be/*
Vimeo - https://vimeo.com/*, http://vimeo.com/*

Contributing

Looking to add to the list of supported sources? We would love to have you contribute.

  1. Fork the repo
  2. Run the tests rake test
  3. Write tests in test_gembed.rb
  4. Add the accepted urls to the sources hash in lib/gembed.rb
  5. Create a new file for the source you want to add in lib/gembed with a class method called embed

About

Ruby gem providing tools for media embedding.


Languages

Language:Ruby 100.0%