How to Request a Video Player How to Request a Video Player

How to Request a Video Player

Leon Hurtado Leon Hurtado

Zype's Dynamic Player Technology will automatically detect which device you are requesting a player from and deliver players based on your configured player rules.

  1. Embedding Zype Web Player

  2. Embedding a Native Player

  3. Third-Party Web Integrations

Embedding Zype's Web Player

For web-based players like desktop, iOS, and Android browsers, the Player API will return a JavaScript or iFrame player response that can be used to embed the player on a web page. 

The iFrame or JavaScript player will incorporate all security checks that are required to enable playback, so it is important that the Player API is used to access players and content URLs.

A comprehensive list of Player API options is available on the Player API Reference page.

Sample iFrame Embed

<iframe src="https://player.zype.com/embed/[video_id].html?api_key=[api_key]&autoplay="true"&controls=true"width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

Sample JavaScript Embed

<div id="zype_[video_id]"></div><script src="https://player.zype.com/embed/[video_id].js?api_key=[api_key]&autoplay=true&controls="true" type="text/javascript"></script>

Troubleshooting

When using HTML and JavaScript embeds the player should be embedded directly onto your website. The Player API will intelligently determine a web player is required based on the user agent and other characteristics of the request. It is important that embeds are used this way to ensure that the Player API has the correct information to process the request based on the end user's browser.

The Player API and Zype incorporate security checks as well as configurable player and content rules to allow or block content based on the geolocation of the player request. This makes it critical that the player request originates from the end consumer's browser on their desktop or mobile device. If the request is made from a server, content access restrictions may not work as expected.

Embedding a Native Player

For native devices like iOS, Android, and OTT set-top boxes, the Player API will return a JSON player response that can be used to play your videos. The JSON player response will include everything you need to play your video, including media files, advertising schedules, and subtitles.

The JSON player will also incorporate any security checks that are required to enable playback of your content, so it is important that the Player API is used to access your content.

Unlike HTML or JavaScript players, native players require additional integration to enable playback of the video. Zype provides templated applications that can be used to quickly enable playback, or a custom integration can be built using the Player API.

User-Agents

Developers need to specify the User-Agent header for all requests that are coming from native players. This will ensure that the Player API returns the proper metadata to integrate.

Device

User-Agent

Android (Native)

zype android

Apple TV

zype tvos

Amazon Fire TV

AmazonWebAppPlatform

Roku

Roku

iOS Native

cfnetwork

 

Example Request (Ruby)

require 'uri'
require 'net/http'
require 'openssl'
video_id = 'video id'
api_key = 'api key'
user_agent = 'user agent'

url = URI("https://player.zype.com/embed/#{video_id}.json?api_key=#{api_key}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["User-Agent"] = user_agent

response = http.request(request)
puts response.read_body

Troubleshooting

The Player API and Zype incorporate security checks as well as configurable player and content rules to allow or block content based on the geo-location of the player's request, so it is important the player request originates from the end user’s device. If the request is made from a server content access restrictions may not work as expected.

Third-Party Web Integrations

It's possible to implement custom third-player integration using the Player API.

Using the JSON extension on the request and adding player_type=custom to the payload, The endpoint will return a JSON payload with Metadata and m3u8 manifest files regardless of the user-agent.

  • The player request must-have .json extension

  • The Player request payload must have param player_type=custom