Zype’s DPT allows you to create player rules based on geography and device. For example, you could declare that end users will receive the Hulu Player if he or she is accessing your video via desktop in the United States or the Zype Player if he or she is accessing your video via desktop in Australia.

What you need to start

You will need to have a video collection on the Zype Platform from the video sources that you want to create player rules for.

1. Make sure you have imported your videos into your video catalogue on the Zype Platform.

video imports

What you need to do in the Zype Platform

1. Visit the Player Rule Page and click on New Player Rule

player rules

2. Complete the Player Rules Form. You will need to know the countries and devices you want for your rule. Based on countries and devices, you will be given player options that can be served to the end user.

player rule form

Using the API

You can query the Zype API to only show videos that dynamically conform to your DPT rules given an end user’s device and geolocation. Set dpt to equal true in your GET request.

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

Using the Player API

1. Once you have set up your video catalogue in the Zype Platform and you have created your player rules, you are ready to use the Zype Player API!

2. You can find your player key and api key using the Zype Platform

site keys

3a. To make the API call to get the appropriate player

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

3b. To use the Zype Ruby Gem to get the appropriate player

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

Check our previous post on how to set up your Rails App with the Zype Gem!