Skip to content
JWPlayer Ruby client to easily sign URLs
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Initial release May 13, 2016
lib/jwplayer/api Initial release May 13, 2016
spec Initial release May 13, 2016
.gitignore Initial release May 13, 2016
.rspec Initial release May 13, 2016
.travis.yml Initial release May 13, 2016
Gemfile Initial release May 13, 2016
LICENSE.txt Initial release May 13, 2016 Update documentation Sep 19, 2016
Rakefile Initial release May 13, 2016

JWPlayer::API::Client Build Status

This gem aims to easily sign JWPlayer Platform API URLs according to the documentation: It is not intended to actually send the request but simply to generate the correctly signed URL. An example at the end of this documentation is provided though.


Add this line to your application's Gemfile:

gem 'jwplayer-api-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jwplayer-api-client


To get started, instantiate a new client:

irb> client = 'y0c6CFQ5', secret: 'YZWQ1SfmpFYEfW9kiR1QerRF')
=> #<JWPlayer::API::Client:0x007fb6909e0158 @options={:host=>"", :scheme=>"https", :version=>:v1, :key=>"y0c6CFQ5", :secret=>"YZWQ1SfmpFYEfW9kiR1QerRF", :format=>:json}>

If you have previously set JWPLAYER_API_KEY and JWPLAYER_API_SECRET ENV variables, you can simply do:

irb> client =
=> #<JWPlayer::API::Client:0x007fb6909e0158 @options={:host=>"", :scheme=>"https", :version=>:v1, :key=>"y0c6CFQ5", :secret=>"YZWQ1SfmpFYEfW9kiR1QerRF", :format=>:json}> accepts the following optional parameters:

Name Default Description
key ENV['JWPLAYER_API_KEY'] JWPlayer Platform API key
secret ENV['JWPLAYER_API_SECRET'] JWPlayer Platform API secret
host '' API host
scheme 'https' API scheme
version :v1 API version
format :json API response format
timestamp current time API UNIX timestamp used against replay-attacks
nonce automatically generated for each call 8 digit random number
See for more information.

Then, you can get a signed uri or signed url like this:

irb> client.signed_uri('videos/create')
=> #<URI::Generic>

irb> client.signed_url('videos/create')
=> ""

And with query parameters:

irb> client.signed_url('videos/create', title: 'My Super Video', description: 'This is cool')
=> ""

IRL example

Create a video reference in your JWPlayer Dashboard and get the media_id:

require 'typhoeus'

data = {
  author:        'Raphaël',
  description:   'Yet Another Keynote',
  title:         'Apple Keynote',
  sourceformat:  :m3u8,
  sourcetype:    :url,
  sourceurl:     ''

# Call JWPlayer /videos/create API
jw_client  =
signed_url = jw_client.signed_url('videos/create', data)
response   =
json       = JSON.parse(response.body)
media_id   = json.dig('video', 'key')


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.