L’API GET /api/video/geturl permet d’obtenir les URL de téléchargement direct d’une vidéo via son identifiant.
Permet de fournir à vos intégrations une URL directe pour streamer ou télécharger une vidéo disponible dans la plateforme Digiteka.
Ces informations sont fournies par Digiteka :
applicationIdpasswordsecretKey
GET /api/video/geturl
| En-tête | Valeur | Description |
|---|---|---|
Accept |
application/xml ou application/json |
Format de réponse souhaité |
Content-Type |
multipart/form-data |
Type de contenu attendu |
Date |
date actuelle GMT | Horodatage utilisé dans la signature |
Ulti-Key |
$applicationId:$signature |
Clé d’authentification calculée |
| Paramètre | Type | Obligatoire | Description |
|---|---|---|---|
id |
string | Oui |
|
// Variables
$uri = '/api/video/geturl';
$applicationId = '<APPLICATION_ID>';
$password = '<PASSWORD>';
$secretKey = '"<SECRET_KEY>';
$data = array('id' => 'id_video'); // au format 50mmvr ou 21_50mmvr
// Date et signature
$date = gmdate("D, d M Y H:i:s", time()).' GMT'; // date de la demande
$string2sign = 'GET ' . $uri . ' ' . $secretKey . ' ' . $date;
$signature = base64_encode(hash_hmac('sha1',utf8_encode($string2sign),$password)); // creation de la signature
$Authorization = $applicationId . ':' . $signature;
// URL complète
$curlUrl = 'http://www.ultimedia.com' . $uri;
// Configuration cURL
$headers = array();
$headers[] = 'Accept: application/xml'; // type de contenu à récupérer (json ou xml)
$headers[] = 'Content-type: multipart/form-data';
$headers[] = 'Date: ' . $date;
$headers[] = 'Ulti-Key: ' . $Authorization;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $curlUrl);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Exécution
$response = curl_exec ($ch);
$info = curl_getinfo($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$body = substr($response, $header_size);
curl_close ($ch);
echo $body; // contient les URL des vidéos
La réponse contient les URLs accessibles selon différents formats/qualités :
<?xml version="1.0"?>
<url>
<mp4>
<mp4_480>url</mp4_480>
</mp4>
<hls>
<hls_auto>url</hls_auto>
<hls_240>url</hls_240>
<hls_360>url</hls_360>
<hls_480>url</hls_480>
<hls_720>url</hls_720>
<hls_1080>url</hls_1080>
</hls>
</url>