Use gembed to embed media from various sources into your application.
Add this to your Gemfile:
gem 'gembed'Then run bundle install and you're ready to go! 🎉
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.
Gembed.find_id("https://www.youtube.com/watch?v=jNQXAC9IVRw")This will return just the ID: jNQXAC9IVRw
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/* |
Looking to add to the list of supported sources? We would love to have you contribute.
- Fork the repo
- Run the tests
rake test - Write tests in
test_gembed.rb - Add the accepted urls to the sources hash in
lib/gembed.rb - Create a new file for the source you want to add in
lib/gembedwith a class method calledembed
