updateThumbnailFromUrl returns SERVICE_FORBIDDEN


#1

I’m uploading an audio only file and assigning the mediatype as audio but anything longer than 1 second it removed the speaker thumbnail and leaves you a black box (probably extracted from no video from from file)

so I try to replace it with a thumbnail after conversion. I get forbidden access using updateThumbnailFromUrl

$config = new KalturaConfiguration();
$config->serviceUrl = ‘https://www.kaltura.com/’;
$client = new KalturaClient($config);
$entryId = ‘0_entryID’;
$url = ‘https://mysite.com/images/720.jpg’;
$result = $client->media->updateThumbnailFromUrl($entryId, $url);

returns

        <code>SERVICE_FORBIDDEN</code>
        <message>The access to service [media-&gt;updateThumbnailFromUrl] is forbidden</message>

#2

If the file you’re uploading is audio only, I see no reason for it not to be assigned the default audio thumbnail. If the file has a video track, however, I can see why this would happen. You can check whether a video track exists using the mediainfo util. If that’s the case and you are only interested in the audio, you can use ffmpeg to extract only the audio track and save it onto a separate file.
As for KalturaAPIException SERVICE_FORBIDDEN The access to service [media->updateThumbnailFromUrl] is forbidden, I don’t see you’re setting a KS in your code… are you setting it and did not provide the full code?

You need something like this:

<?php
  $secret = "YOUR_KALTURA_ADMIN_SECRET";
  $type = KalturaSessionType::ADMIN;
  $partnerId = 0;
  $expiry = 86400;
  $privileges = null;

  try {
    $ks = $client->session->start($secret, $userId, $type, $partnerId, $expiry, $privileges);
    $client->setKs($ks);
  } catch (Exception $e) {
    echo $e->getMessage();
  }

If you are setting the KS in your code, please provide the full code [masking your secret, of course] and I’ll take a look.


#3

yes I’ve created a $client with a session

then all I would have to do is update an entry with a url to a valid image

$client->media->updateThumbnailFromUrl($entryId, $url);

but ti returns SERVICE_FORBIDDEN

you can try it in the test me console


#4

I did. Worked perfectly well for me.
Please provide the full code.


#5

sorry for not getting back, been busy. seems I forgot to paste session into testme after starting a session. used to be you didn’t have to do that will subsequent calls after started a session.

back back to original issue. audio thumbnail gets replaced with black because the transcoding removes it and tries to find a frame of nothing. and I was trying to swap thumbnail before transcodes finish. so I have to do a cron that checks whether the ntry is ready then swap in the audio thumbnail