Dynamic Player Technology - Custom API Integration Dynamic Player Technology - Custom API Integration

Dynamic Player Technology - Custom API Integration

Integrating Custom Solutions Via API

Zype’s Dynamic Player Technology (DPT) automatically detects the devices your audiences are requesting a video player from and delivers players based on your configured player rules.

To use Zype’s Dynamic Player Technology, you first need to create player rules based on geography and device, allowing audiences to view your content using these rules.

NOTE: Before setting up your player rules, you should already have set up your video library on the Zype platform.

For example, with the help of a player rule, you could declare that end users will receive the Hulu Player if they are accessing your video via desktop in the United States, or the Zype Player if they are accessing your video via desktop in locations other than the United States.

For instructions on creating a player rule, see Setting Up Player Rules.

After creating your player rules, you must get the API and app keys you will need to get the appropriate video players for your end users. For instructions on getting your API and app keys, see API and App Keys.

API Call to Retrieve Videos that Conform to Player Rules

Once you get the API and app keys, you can then retrieve videos that conform to your DPT, or player, rules.

// Retrieve videos that conform to DPT rules

GET https://api.zype.com/videos?DPT=true

API Call to Retrieve a Player from a Custom App

If you are using a custom app, you can make an API call to get  a video player based on the end user’s device and geolocation.

// Retrieve a video player

GET http://api.zype.com/videos/{video_id}/player/?api_key={api_key}&player_key={player_key}

API Call to Retrieve a Player from your Rails Application

If you are using a Rails app, you can use the Zype Ruby Gem to display a video player to your end users. This involves creating an instance of the Zype client, then making an API call from the client to get the appropriate video player.

// Add the Zype Gem to your Gemfile and bundle

gem ‘zype’, :git => ‘git://github.com/edla/zype-cli.git’

// Create a new file config/initializers/zype.rb

 Zype.configure do |config|
   config.api_key = {api_key}
   config.host    =  "api.zype.com"
   config.port    =  80
   config.use_ssl = false
 end

// Add the following javascript to your layout.html.erb to power the appropriate player Javascript.

<script type="text/javascript" src="http://api.zype.com/player.js"></script>
<script type="text/javascript"> zype.player_key = {player_key};</script>

// Create a new instance of the Zype client that will query the Zype platform for the appropriate player for a video

@zype_cli = Zype::Client.new

//  Get the appropriate player for a video

@video = @zype_cli.videos.find(params[:video_id])
@player = @video.player(player_key: params[:player_key])