A few lines of code to a ready-to-watch video player and stream
Developers can use the Zype Video API to upload video files to the Zype platform, transcode them, and receive back a fully integrated video player and ready-to-watch HLS stream to integrate into websites and applications in just a few lines of code.
In this example, we will show how to upload a file via multipart HTTP POST request, along with additional video metadata. Zype will automatically transcode the video as soon as the upload completes. We will then show how to get back a fully integrated video player that is ready to embed, as well as a ready-to-watch video stream.
NOTE: This example is written in ruby and leverages the ‘httpparty` and `json` ruby gems. Any language is supported that can speak http.
1. Setup your Environment
First, you will need a Zype account. If you don’t have one please request one here. You'll need to retrieve your Upload API Key and Player API Keys from the platform from the API Key Settings section.
2. Upload your video
3. Retrieve your VideoID (from the Upload API call response)
Now that you’ve uploaded the file, you can start using the unique Video ID
You can do a lot with the video file outside the scope of this article. Learn more in our Dev Center.
4. Retrieve a Video Player to embed or a Streaming URL
For the player_response, you’ll get back a video player that is ready to embed into your website. It will look something like this:
Retrieving a Streaming URL:
For playing directly using your own player infrastructure, use the streaming URL. This will be a fully functional HLS Manifest URL that is ready to attach to any video player on any device. It will look like this:
This will render a well-formed HLS Manifest that looks something like this:
And that’s it! Happy Streaming!
Complete Ruby Example