Fatal error: Call to a member function getByEntryId() on a non-object

3 replies [Last post]
Joined: 06/29/2011
Points: 23

If i use the service flavorAsset with every action method, my php script calls an error.

Fatal error: Call to a member function getByEntryId() on a non-object

...
$user = "SomeoneWeKnow";
$kconf = new KalturaConfiguration(PARTNER_ID);
$kconf->serviceUrl = SERVER_URL;
// If you want to use the API against your self-hosted CE,
// go to your KMC and look at Settings -> Integration Settings to find your partner credentials
// and add them above. Then insert the domain name of your CE below.
// $kconf->serviceUrl = "http://www.mySelfHostedCEsite.com/";
$kclient = new KalturaClient($kconf);
$ksession = $kclient->session->start(ADMIN_SECRET, $user, KalturaSessionType::ADMIN);

if (!isset($ksession)) {
        die("Could not establish Kaltura session. Please verify that you are using valid Kaltura partner credentials.");
}

$kclient->setKs($ksession);

// Set the response format
// KALTURA_SERVICE_FORMAT_JSON  json
// KALTURA_SERVICE_FORMAT_XML   xml
// KALTURA_SERVICE_FORMAT_PHP   php
$kconf->format = KalturaClientBase::KALTURA_SERVICE_FORMAT_PHP;

$kfilter = new KalturaMediaEntryFilter();
$kfilter->mediaTypeEqual = KalturaMediaType::VIDEO;
$kfilter->status = KalturaEntryStatus::READY;

$result = $kclient->media->listAction($kfilter);

echo "<h1>My Videos</h1>";
echo "<table>";
foreach ($result->objects as $entry) {
        echo '<tr><td><img src="'.$entry->thumbnailUrl.'">&nbsp;&nbsp;
    Title: '
.$entry->name.'&nbsp;&nbsp;
     <a href="'
.$entry->downloadUrl.'">download</a>&nbsp;&nbsp;
     Created on: '
.date("D M j G:i:s T Y", $entry->createdAt).'&nbsp;&nbsp<br />Flavors: ';
        $r = $kclient->flavorAsset->getByEntryId($entry->id);
        foreach ($r as $e) {
                if ($e->status != KalturaFlavorAssetStatus::READY) continue;
                echo '<a href="'.$kclient->flavorAsset->getDownloadUrl($e->id).'">'.$e->containerFormat.'/'.$e->videoCodecId.'</a>&nbsp;&nbsp';
        }
        echo '</td></tr>';
}
echo "</table>";
...

media->listAction method is ok.

Can anybody help my?

Thanks a lot

Thomas

Joined: 08/30/2011
Points: 65

Could you write all the error message please?
I would like to know in what file and on what line is the problem.

Also, wich version of Kaltura are you using? CE 4.0?

Joined: 06/29/2011
Points: 23

The complite Error-Message:

Fatal error: Call to a member function getByEntryId() on a non-object in ... /media_gallery2.php on line 53

I use KalturaCE 3.0.0

Joined: 08/30/2011
Points: 65

Look in your client API source code if you can find getByEntryId() function or the flavorAsset Object. It looks like you have out of date API.

The flavorAsset object is suppose to be in .../php5/KalturaClient.php at line 4210

Your are using php5 or php4 API?