Category Archives: ror

Add videos in rails app with VdoCipher ruby gem

VdoCipher videos can be added into any Ruby on Rails application without worrying about API code and setup. VdoCipher ruby gem does all the API related work for you.

https://rubygems.org/gems/vdocipher

Getting started

Add this line to your Gemfile in your rails application

gem 'vdocipher'

And in your required controller add these lines

 

require 'vdocipher'
...

vdo_api = VdoCipher.new(clientSecretKey: "CLIENT_SECRET_KEY");
@embedcode = vdo_api.play_code("VIDEO_ID", "style=\"height:400px;width:640px;max-width:100%%;\"");

Now in your view file, output the embed code where you like to embed videos.

<%= @embedcode.html_safe %>

You can add any attributes other than id in the play_code function for video container. The div id is assigned internally and used for loading video elements.