FAQ  •  Register  •  Login

[CDS API] Retreiving resources and cover image

<<

kissskoool

Streaming enthusiast

Posts: 25

Joined: Mon Aug 05, 2013 1:15 pm

Post Mon Aug 05, 2013 1:24 pm

[CDS API] Retreiving resources and cover image

Hi,

First thanks for all the good work and the well documented APIs.

But i still have some little questions :

- When i browse the medias with the CDS API, i get this value for thumbnailUrl : cds/resource/12/COVER_IMAGE,1
Then i try to retreive the cover image giving this complete url to curl : http://localhost:23424/cds/resource/12/ ... xxxxxxxxxx
But it doesn't work. is it right ?

- My other question is with the browse method.
In this url, /cds/browse/{profile_id}/{object_id}/{browse_method}/{filter}/{start_index}/{requested_count}?authToken={token}, what profile_id stands for ?
Where cab i find the different values for this parameter ?

Thanks !
<<

kissskoool

Streaming enthusiast

Posts: 25

Joined: Mon Aug 05, 2013 1:15 pm

Post Mon Aug 05, 2013 4:09 pm

Re: [CDS API] Retreiving resources and cover image

I made a little step forward, and i found that the problem wasn't with the url but with my php/curl code.

Now, i retreive the image binary but i'm trying to display it.

Here is my php code :


  Code:
$url = 'http://localhost:23424/cds/resource/12/COVER_IMAGE,1?authToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxx';

function cds_cover($url) {
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: image/jpeg"));

   $res = curl_exec($ch);
   curl_close($ch);

   return $res;      
}


How to show the cover image from the binary ?
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Aug 05, 2013 4:37 pm

Re: [CDS API] Retreiving resources and cover image

to your original question, profile id is found in application-profiles.xml or profile.xml, try with 'flv_player'
You must also add token at the end of the URL.
<<

kissskoool

Streaming enthusiast

Posts: 25

Joined: Mon Aug 05, 2013 1:15 pm

Post Mon Aug 05, 2013 11:25 pm

Re: [CDS API] Retreiving resources and cover image

Thanks for your answer !

About my original question, i found the solution if someone has the same problem :

  Code:
function cds_cover($url) {
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: image/jpeg"));

   $res = curl_exec($ch);
   curl_close($ch);

   return $res;      
}

$t = $item->thumbnailUrl;
$t = "http://localhost:23424".$t."?authToken=".$token;
$img = cds_cover($t);

$img = base64_encode($img);

<div class="cover_image">
   <img src="data:image/jpeg;base64,'.$img.'">
</div>
<<

kissskoool

Streaming enthusiast

Posts: 25

Joined: Mon Aug 05, 2013 1:15 pm

Post Tue Aug 06, 2013 2:07 am

Re: [CDS API] Retreiving resources and cover image

I'm sorry, but all this topic is my mistake :oops: ;/

The previous solution works but is really heavy.

I must be tired because i was writing html with php, setting image sources to localhost links .... :cry:

Forget all i said, and just be careful to set the right url for your cover images :

<img src="http://yourdomain_or_ip:23424/cds/resource/12/COVER_IMAGE,flv_player?authToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxx" />

Sorry !

+

Return to Third-party tools integration

Who is online

Users browsing this forum: No registered users and 9 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.