Private Video Delivery With Mp4 Built In Players
api.video recommends that you read Private Videos to ensure that you understand the concept of private videos before proceeding.
There are cases where you would want to use built-in players that are not api.video. We support private video delivery via other players other than our in-house. In this article you can find how to deliver private videos with MP4 built-in player
MP4 private video url
Playing your private video on an MP4 player, like video.js or Android native player is as easy as just passing on the url we provide while you retrieve for example, if you would like to play the video on video.js, we provide a ready made url with mp4 extension :
Serving private videos to HTML on Chrome, Mozilla or Safari:
You can use the video tag directly to play the video in a browser, for example:
Serving private videos dynamically
In order to build a dynamically served private videos, you can leverage the /videos endpoint in order to get the url of the video and private token. For example the following steps are possible:
- Make a request to
curl --request GET \ --url https://ws.api.video/videos/ABC \ --header 'accept: application/json' \ --header 'authorization: Basic ZYX='
- You will get the following response, where the private token in the url and you can get the mp4 url from the
- All you have to do now is to get the
mp4url and pass it as a value to the HTML that will be generated by the server. We will handle the rest.
Private video delivery on Android native player
You can follow the same steps as you've seen above to retrieve the video url and pass it to the native Android media player, like the example below.
Reference can be found here: https://developer.android.com/guide/topics/media/mediaplayer
String url ; MediaPlayer mediaPlayer ; mediaPlayer.; mediaPlayer.; mediaPlayer.; // might take long! (for buffering, etc) mediaPlayer.;
Was this page helpful?