public function addImageEntry()
 {
     $entry = new MediaEntry();
     $entry->name = self::ENTRY_NAME;
     $entry->mediaType = MediaType::IMAGE;
     $entry = $this->_client->getMediaService()->add($entry);
     $uploadToken = new UploadToken();
     $uploadToken->fileName = self::UPLOAD_IMAGE_FILENAME;
     $uploadToken = $this->_client->getUploadTokenService()->add($uploadToken);
     $uploadFilePath = dirname(__FILE__) . '/../resources/' . self::UPLOAD_IMAGE_FILENAME;
     $uploadToken = $this->_client->getUploadTokenService()->upload($uploadToken->id, $uploadFilePath);
     $resource = new UploadedFileTokenResource();
     $resource->token = $uploadToken->id;
     $entry = $this->_client->getMediaService()->addContent($entry->id, $resource);
     return $entry;
 }
Beispiel #2
0
use Kaltura\Client\ClientException;
// load zend framework 2
require_once dirname(__FILE__) . '/ClassLoader/ClassLoader.php';
$loader = new Symfony\Component\ClassLoader\ClassLoader();
// register Kaltura namespace
$loader->addPrefix('Kaltura', dirname(__FILE__) . '/../library');
$loader->addPrefix('Test', dirname(__FILE__));
$loader->register();
$testerConfig = parse_ini_file(dirname(__FILE__) . '/' . CONFIG_FILE);
// init kaltura configuration
$config = new KalturaConfiguration();
$config->setServiceUrl($testerConfig['serviceUrl']);
$config->setCurlTimeout(120);
$config->setLogger(new \Test\SampleLoggerImplementation());
// init kaltura client
$client = new KalturaClient($config);
// generate session
$ks = $client->generateSession($testerConfig['adminSecret'], $testerConfig['userId'], KalturaSessionType::ADMIN, $testerConfig['partnerId']);
$config->getLogger()->log('Kaltura session (ks) was generated successfully: ' . $ks);
$client->setKs($ks);
// check connectivity
try {
    $client->getSystemService()->ping();
} catch (ApiException $ex) {
    $config->getLogger()->log('Ping failed with api error: ' . $ex->getMessage());
    die;
} catch (ClientException $ex) {
    $config->getLogger()->log('Ping failed with client error: ' . $ex->getMessage());
    die;
}
// run the tester