本文整理汇总了PHP中KalturaClient类的典型用法代码示例。如果您正苦于以下问题:PHP KalturaClient类的具体用法?PHP KalturaClient怎么用?PHP KalturaClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KalturaClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getClient
/**
* get the kaltura client
* @param bol $isAdmin default = false
* @param $privileges
* @return unknown_type
*/
function getClient($isAdmin = false, $privileges = null)
{
// get the configuration to use the kaltura client
$kalturaConfig = KalturaHelpers::getServiceConfiguration($this->params);
// inititialize the kaltura client using the above configurations
$kalturaClient = new KalturaClient($kalturaConfig);
// get the current logged in user
$sessionUser = KalturaHelpers::kalturaGetSessionUser();
if ($isAdmin) {
$adminSecret = $this->params->get("kaltura_webservice_admin_secret");
$result = $kalturaClient->startsession($sessionUser, $adminSecret, true, $privileges);
} else {
$secret = $this->params->get("kaltura_webservice_secret");
$result = $kalturaClient->startsession($sessionUser, $secret, false, $privileges);
}
if (count(@$result["error"])) {
return null;
} else {
// now lets get the session key
$session = $result["result"]["ks"];
// set the session so we can use other service methods
$kalturaClient->setKs($session);
}
return $kalturaClient;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:31,代码来源:kaltura_model.php
示例2: getPlayList
function getPlayList()
{
// Your Kaltura partner credentials
define("PARTNER_ID", "xxxxxxx");
define("ADMIN_SECRET", "xxxxxxx");
$user = "SomeoneWeKnow";
$kconf = new KalturaConfiguration(PARTNER_ID);
$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);
$result = $kclient->playlist->get('0_3x0phjri');
$l = explode(",", $result->playlistContent);
foreach ($l as $key => $value) {
$filter = new KalturaMetadataFilter();
$filter->objectIdEqual = $value;
$metadata = $kclient->metadata->listAction($filter)->objects;
$id = $metadata[0]->objectId;
if (isset($metadata[0]->xml)) {
$xml = $metadata[0]->xml;
$meta = new SimpleXMLElement($xml);
$amt = (string) $meta->Amt;
$taxamt = (string) $meta->Taxamt;
}
$obj = array("name" => "Video", "number" => $value, "category" => "Digital", "desc" => "my video", "amt" => $amt, "taxamt" => $taxamt);
$objArray[] = $obj;
}
return $objArray;
}
开发者ID:Vesperton,项目名称:html5-dg,代码行数:31,代码来源:kaltura.php
示例3: get_se_wizard
function get_se_wizard($div, $width, $height, $entryId)
{
$params = "''";
$url = "''";
$platformUser = "\"" . KalturaHelpers::getSessionUser()->userId . "\"";
$kalturaSecret = KalturaHelpers::getPlatformKey("secret", "");
if ($kalturaSecret != null && strlen($kalturaSecret) > 0) {
try {
$kClient = new KalturaClient(KalturaHelpers::getServiceConfiguration());
$kalturaUser = KalturaHelpers::getPlatformKey("user", "");
$ksId = $kClient->session->start($kalturaSecret, $kalturaUser, KalturaSessionType::USER, null, 86400, "*");
$kClient->setKs($ksId);
$url = KalturaHelpers::getSimpleEditorUrl(KalturaHelpers::getPlatformKey("editor", null));
$params = KalturaHelpers::flashVarsToString(KalturaHelpers::getSimpleEditorFlashVars($ksId, $entryId, "entry", ""));
} catch (Exception $exp) {
$flash_embed = $exp->getMessage();
}
$flash_embed = '
<div id="' . $div . '" style="width:' . $width . 'px;height:' . $height . ';">
<script type="text/javascript">
var kso = new SWFObject("' . $url . '", "KalturaSW", "' . $width . '", "' . $height . '", "9", "#ffffff");
kso.addParam("flashVars", "' . $params . '");
kso.addParam("allowScriptAccess", "always");
kso.addParam("allowFullScreen", "TRUE");
kso.addParam("allowNetworking", "all");
if(kso.installedVer.major >= 9) {
kso.write("' . $div . '");
} else {
document.getElementById("' . $div . '").innerHTML = "Flash player version 9 and above is required. <a href=\\"http://get.adobe.com/flashplayer/\\">Upgrade your flash version</a>";
}
</script>
';
return $flash_embed;
}
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:lib.php
示例4: getData
function getData()
{
$params = $this->getParams();
$conf = $this->getKalturaConfig();
$user = new KalturaSessionUser();
$user->userId = "1";
$cl = new KalturaClient($conf);
$res = $cl->startSession($user, $params->get('kaltura_admin_secret'), true);
//$res =$cl->startAdmin($user, $conf->adminSecret , null);
//$ks = $cl->getKs();
$ks = $res['result']['ks'];
echo $ks;
// create a filter to define what exactly we want to be in the list
$filter =& $this->getKalturaFilter();
$page = $this->getKalturaPage();
$page_size = 20; // choose the page_size to be some number that will fit the area you would like to display the thumbnails gallery
$detailed = false;
$res = $cl->listentries ( $user , $filter , $detailed , $page_size , $page);
$count = @$res["result"]["count"];
$entries = @$res["result"]["entries"];
if (!$entries) $entries =array();
return $entries;
}
开发者ID:Jobar87,项目名称:fabrik,代码行数:28,代码来源:kaltura.php
示例5: buildSubTitleCommandParam
private static function buildSubTitleCommandParam(KalturaConvartableJobData $data, KalturaClient $client)
{
// $cmdStr.= " -add ".KDLCmdlinePlaceholders::OutFileName.".temp.srt:hdlr=sbtl:lang=$lang:group=0:layer=-1";
// impersonite
$preImpersoniteId = $client->getConfig()->partnerId;
$client->getConfig()->partnerId = $data->flavorParamsOutput->partnerId;
$flrAsst = $client->flavorAsset->get($data->flavorAssetId);
if (!isset($flrAsst)) {
throw new KOperationEngineException("Failed to retrieve the flavor asset object (" . $data->flavorAssetId . ")");
}
$filter = new KalturaAssetFilter();
$filter->entryIdEqual = $flrAsst->entryId;
$captionsList = $client->captionAsset->listAction($filter, null);
if (!isset($captionsList) || count($captionsList->objects) == 0) {
throw new KOperationEngineException("No caption assets for entry (" . $flrAsst->entryId . ")");
}
$captionsStr = null;
$addedSubs = 0;
foreach ($captionsList->objects as $captionObj) {
try {
$cptUrl = $client->captionAsset->getUrl($captionObj->id, null);
} catch (Exception $ex) {
$cptUrl = null;
KalturaLog::err("Exception on etrieve caption asset url retrieval (" . $captionObj->id . "),\nexception:" . print_r($ex, 1));
}
if (!isset($cptUrl)) {
KalturaLog::err("Failed to retrieve caption asset url (" . $captionObj->id . ")");
continue;
}
$cptFilePath = self::retrieveCaptionFile($captionObj, $cptUrl, $data->destFileSyncLocalPath);
if (!isset($cptFilePath)) {
continue;
}
/*
* group - "An integer that specifies a group or collection of tracks. If this field is 0 there is no information
* on possible relations to other tracks. If this field is not 0, it should be the same for tracks that contain
* alternate data for one another and different for tracks belonging to different such groups. Only one track
* within an alternate group should be played or streamed at any one time, and must be distinguishable from other
* racks in the group via attributes such as bitrate, codec, language, packet size etc. A group may have only one member. "
* To follow that desc, the group id for all subtitles would be set to 1.
* Apart from the first subs track, all the others would be tagged with 'disabled', otherwise the older iOS devices (pre 5.x)
* does not handle it properly.
* layer - "Specifies the front-to-back ordering of video tracks; tracks with lower numbers are closer to the viewer.
* 0 is the normal value, and -1 would be in front of track 0, and so on."
* layer=-1, closest to the viewer
*/
$captionsStr .= " -add " . $cptFilePath . ":hdlr=sbtl:lang=" . $captionObj->languageCode . ":group=1:layer=-1";
if ($addedSubs > 0) {
$captionsStr .= ":disabled";
}
$addedSubs++;
}
// un-impersonite
$client->getConfig()->partnerId = $preImpersoniteId;
if (!isset($captionsStr)) {
throw new KOperationEngineException("Error: missing caption data or files.");
}
return $captionsStr;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:59,代码来源:KOperationEngineMp4box.php
示例6: generate_ks
function generate_ks($service_url, $partnerId, $secret, $type = KalturaSessionType::ADMIN, $userId = null, $expiry = null, $privileges = null)
{
$config = new KalturaConfiguration($partnerId);
$config->serviceUrl = $service_url;
$client = new KalturaClient($config);
$ks = $client->session->start($secret, $userId, $type, $partnerId, $expiry, $privileges);
$client->setKs($ks);
return $client;
}
开发者ID:GeraldNathan,项目名称:platform-install-packages,代码行数:9,代码来源:create_session.php
示例7: isPayItem
function isPayItem($entryId)
{
require_once 'kalturaConfig.php';
require_once 'client/KalturaClient.php';
$config = new KalturaConfiguration(PARTNER_ID);
$config->serviceUrl = 'http://www.kaltura.com/';
$client = new KalturaClient($config);
global $USER_ID;
$ks = $client->generateSession(ADMIN_SECRET, $USER_ID, KalturaSessionType::ADMIN, PARTNER_ID);
$client->setKs($ks);
$entry = $client->media->get($entryId);
$paid = '';
if ($entry->categoriesIds != '') {
$categories = explode(',', $entry->categoriesIds);
foreach ($categories as $category) {
$filter = new KalturaMetadataFilter();
$filter->metadataObjectTypeEqual = KalturaMetadataObjectType::CATEGORY;
$filter->objectIdEqual = trim($category);
$pager = new KalturaFilterPager();
$pager->pageSize = 500;
$pager->pageIndex = 1;
$categoryMetadatas = $client->metadata->listAction($filter, $pager)->objects;
foreach ($categoryMetadatas as $categoryMetadata) {
$categoryMetadataProfile = $client->metadataProfile->get($categoryMetadata->metadataProfileId);
if ($categoryMetadata->metadataProfileId == PAYPAL_CATEGORY_METADATA_PROFILE_ID) {
$xml = simplexml_load_string($categoryMetadata->xml);
if ($paid != 'true') {
$paid = strtolower($xml->Paid);
}
//Only need to find one instance of a paid category
break;
}
}
}
}
//If the video is not part of a paid channel, see if the video itself is paid
if ($paid != 'true') {
$pager = new KalturaFilterPager();
$pageSize = 50;
$pager->pageSize = $pageSize;
$metadataFilter = new KalturaMetadataFilter();
$metadataFilter->objectIdEqual = $entryId;
$metaResults = $client->metadata->listAction($metadataFilter, $pager)->objects;
foreach ($metaResults as $metaResult) {
if ($metaResult->metadataProfileId == PAYPAL_METADATA_PROFILE_ID) {
$xml = simplexml_load_string($metaResult->xml);
$paid = strtolower($xml->Paid);
break;
}
}
}
if ($paid == '') {
echo 'false';
} else {
echo $paid;
}
}
开发者ID:nagyistoce,项目名称:Kaltura-Paid-Content-Gallery-With-Stripe,代码行数:57,代码来源:inventory.php
示例8: establishConnection
private function establishConnection($ini_file)
{
$config = new KalturaConfiguration($ini_file["partner_id"]);
$config->serviceUrl = $ini_file["service_url"];
$client = new KalturaClient($config);
$partnerId = $ini_file["partner_id"];
$ks = $client->session->start($ini_file["admin_secret"], "", KalturaSessionType::ADMIN, $partnerId);
$client->setKs($ks);
return $client;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:10,代码来源:alldigitalFuncs.php
示例9: getSessionOnce
function getSessionOnce($itemId, $userId)
{
//Create a session
$conf = new KalturaConfiguration(PARTNER_ID);
$client = new KalturaClient($conf);
$session = $client->session->start(USER_SECRET, $userId, KalturaSessionType::USER, PARTNER_ID, 86400, 'sview:' . $itemId);
if (!isset($session)) {
die("Could not establish Kaltura session with OLD session credentials. Please verify that you are using valid Kaltura partner credentials.");
}
$client->setKs($session);
echo $session;
}
开发者ID:nagyistoce,项目名称:Kaltura-Paid-Content-Gallery-With-Stripe,代码行数:12,代码来源:kaltura.php
示例10: getAPIObject
/**
*
* Gets an API object from the API - using a client session and KS also using the action get from this service on the object id
*
* @param KalturaObjectBase $objectInstance
* @param string $objectId
* @param int $partnerId
* @param string $secret
* @param string $serviceUrl
* @param string $service
* @throws KalturaAPIException
*/
private static function getAPIObject(KalturaObjectBase $objectInstance, $objectId, $partnerId, $secret, $serviceUrl, $service)
{
//here we create the KS and get the data from the API calls
$config = new KalturaConfiguration((int) $partnerId);
$config->serviceUrl = $serviceUrl;
$client = new KalturaClient($config);
$ks = $client->session->start($secret, null, KalturaSessionType::ADMIN, (int) $partnerId, null, null);
$client->setKs($ks);
$entryId = $objectId;
$result = $client->{$service}->get($entryId);
return $result;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:24,代码来源:KalturaTestDataGenerator.php
示例11: getKalturaClient
private function getKalturaClient($partnerId, $adminSecret, $isAdmin)
{
$kConfig = new KalturaConfiguration($partnerId);
$kConfig->serviceUrl = KalturaTestConfiguration::SERVICE_URL;
$client = new KalturaClient($kConfig);
$userId = "SomeUser";
$sessionType = $isAdmin ? KalturaSessionType::ADMIN : KalturaSessionType::USER;
try {
$ks = $client->generateSession($adminSecret, $userId, $sessionType, $partnerId);
$client->setKs($ks);
} catch (Exception $ex) {
die("could not start session - check configurations in KalturaTestConfiguration class");
}
return $client;
}
开发者ID:ethoz1970,项目名称:kaltura,代码行数:15,代码来源:TestMain.php
示例12: getKalturaClient
private function getKalturaClient($partnerId, $adminSecret, $isAdmin)
{
$kConfig = new KalturaConfiguration();
$kConfig->serviceUrl = $this->config[self::CONFIG_ITEM_SERVICE_URL];
$kConfig->setLogger($this);
$client = new KalturaClient($kConfig);
$userId = "SomeUser";
$sessionType = $isAdmin ? KalturaSessionType::ADMIN : KalturaSessionType::USER;
try {
$ks = $client->generateSession($adminSecret, $userId, $sessionType, $partnerId);
$client->setKs($ks);
} catch (Exception $ex) {
throw new Exception("Could not start session - check configurations in config.ini");
}
return $client;
}
开发者ID:DBezemer,项目名称:server,代码行数:16,代码来源:TestMain.php
示例13: initClient
private function initClient()
{
echo 'initClient' . PHP_EOL;
if ($this->client) {
return;
}
try {
$config = new KalturaConfiguration(Config::PARTNER_ID);
$config->serviceUrl = Config::SERVER_URL;
$client = new KalturaClient($config);
$ks = $client->session->start(Config::PARTNER_ADMIN_SECRET, Config::PARTNER_USER_ID, KalturaSessionType::ADMIN, Config::PARTNER_ID);
$client->setKs($ks);
} catch (Exception $ex) {
$this->assertTrue(false, 'Exception in session->start - ' . $ex->getMessage());
}
$this->client = $client;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:IngestionTest.php
示例14: getClient
function getClient()
{
// Get kaltura configuration file
require_once realpath(dirname(__FILE__)) . '/../config/kConf.php';
$kConf = new kConf();
// Load kaltura client
require_once realpath(dirname(__FILE__)) . '/../../clients/php5/KalturaClient.php';
try {
$conf = new KalturaConfiguration($this->partnerId);
$conf->serviceUrl = 'http://' . $kConf->get('www_host');
$client = new KalturaClient($conf);
$client->setKS($this->Ks);
} catch (Exception $e) {
$this->error = 'Error setting KS. <a href="' . $_SERVER['SCRIPT_NAME'] . '">Try again</a>';
die($this->error);
return false;
}
return $client;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:19,代码来源:secure_form.php
示例15: startKalturaSession
function startKalturaSession()
{
$kConfig = new KalturaConfiguration(PARTNER_ID);
$kConfig->serviceUrl = kalturaServiceURL;
$client = new KalturaClient($kConfig);
writeToLog("startKalturaSession()");
$userID = "OVALAutomatedUploads";
// If this user does not exist in your KMC, then it will be created.
//$sessionType = ($isAdmin)? KalturaSessionType::ADMIN : KalturaSessionType::USER;
$sessionType = KalturaSessionType::ADMIN;
try {
$ks = $client->generateSession(ADMIN_SECRET, $userID, $sessionType, PARTNER_ID);
$client->setKs($ks);
} catch (Exception $ex) {
writeToLog("could not start session - check configurations in KalturaTestConfiguration class");
}
//writeToLog("client: " . print_r($client, true));
return $client;
}
开发者ID:abelardopardo,项目名称:oval,代码行数:19,代码来源:kaltura_functions.php
示例16: getClient
private function getClient()
{
if (!$this->initialized && !$this->client) {
$this->initialized = true;
try {
$client = new KalturaClient($this->getConfig());
if ($session = $this->storedKey()) {
$client->setKs($session);
$this->client = $client;
} elseif ($session = $this->initializeClient($client)) {
$client->setKs($session);
$this->client = $client;
$this->storedKey($session);
}
} catch (Exception $e) {
TikiLib::lib('errorreport')->report($e->getMessage());
}
}
return $this->client;
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:20,代码来源:kalturalib.php
示例17: simplekaltura_create_client
/**
* Helper function to generate the KS (kaltura session)
* @param bool $admin - wether or not to use an admin session
* @return KalturaClient
*/
function simplekaltura_create_client($admin = false)
{
// Get settings
$partner_user_id = elgg_get_plugin_setting('kaltura_partnerid', 'simplekaltura');
//Construction of Kaltura objects for session initiation
$config = simplekaltura_create_config();
$client = new KalturaClient($config);
$partner = $client->partner->getSecrets($config->partnerId, elgg_get_plugin_setting('kaltura_email_account', 'simplekaltura'), elgg_get_plugin_setting('kaltura_password_account', 'simplekaltura'));
if ($admin) {
$st = KalturaSessionType::ADMIN;
$secret = $partner->adminSecret;
} else {
$st = KalturaSessionType::USER;
$secret = $partner->secret;
}
$ks = $client->session->start($secret, $partner_user_id, $st);
// Set KS
$client->setKs($ks);
return $client;
}
开发者ID:beck24,项目名称:Simplekaltura,代码行数:25,代码来源:simplekaltura_lib.php
示例18: createKs
private function createKs(KalturaClient $client, KalturaScheduledTaskJobData $jobData)
{
$partnerId = self::$taskConfig->getPartnerId();
$sessionType = KalturaSessionType::ADMIN;
$puserId = 'batchUser';
$adminSecret = self::$taskConfig->getSecret();
$privileges = array('disableentitlement');
if ($jobData->referenceTime) {
$privileges[] = 'reftime:' . $jobData->referenceTime;
}
return $client->generateSession($adminSecret, $puserId, $sessionType, $partnerId, 86400, implode(',', $privileges));
}
开发者ID:kubrickfr,项目名称:server,代码行数:12,代码来源:KScheduledTaskDryRunner.class.php
示例19: init
protected function init($args)
{
parent::init($args);
if (!isset($args['PartnerID'])) {
throw new KurogoConfigurationException('Kaltura PartnerID not included');
}
$this->token = $args['token'];
if (!isset($args['PartnerSecret'])) {
throw new KurogoConfigurationException('Kaltura PartnerSecret not included');
}
define("KALTURA_PARTNER_ID", PartnerID);
define("KALTURA_PARTNER_ADMIN_SECRET", PartnerSecret);
//define session variables
$this->partnerUserID = 'ANONYMOUS';
//construct Kaltura objects for session initiation
$config = new KalturaConfiguration(KALTURA_PARTNER_ID);
$client = new KalturaClient($config);
$ks = $client->session->start(KALTURA_PARTNER_ADMIN_SECRET, $this->partnerUserID, KalturaSessionType::ADMIN);
$client->setKs($ks);
$this->setBaseURL("http://www.kaltura.com/api_v3");
}
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:21,代码来源:KalturaVideoController.php
示例20: __construct
/**
* @param KSchedularTaskConfig $taskConfig
*/
public function __construct($taskConfig = null)
{
/*
* argv[0] - the script name
* argv[1] - serialized KSchedulerConfig config
*/
global $argv, $g_context;
$this->sessionKey = uniqid('sess');
$this->start = microtime(true);
if (is_null($taskConfig)) {
$data = gzuncompress(base64_decode($argv[1]));
self::$taskConfig = unserialize($data);
} else {
self::$taskConfig = $taskConfig;
}
if (!self::$taskConfig) {
die("Task config not supplied");
}
date_default_timezone_set(self::$taskConfig->getTimezone());
// clear seperator between executions
KalturaLog::debug('___________________________________________________________________________________');
KalturaLog::stderr('___________________________________________________________________________________', KalturaLog::DEBUG);
KalturaLog::info(file_get_contents(dirname(__FILE__) . "/../VERSION.txt"));
if (!self::$taskConfig instanceof KSchedularTaskConfig) {
KalturaLog::err('config is not a KSchedularTaskConfig');
die;
}
KalturaLog::debug("set_time_limit({" . self::$taskConfig->maximumExecutionTime . "})");
set_time_limit(self::$taskConfig->maximumExecutionTime);
KalturaLog::debug('This batch index: ' . $this->getIndex());
KalturaLog::debug('This session key: ' . $this->sessionKey);
self::$kClientConfig = new KalturaConfiguration();
self::$kClientConfig->setLogger($this);
self::$kClientConfig->serviceUrl = self::$taskConfig->getServiceUrl();
self::$kClientConfig->curlTimeout = self::$taskConfig->getCurlTimeout();
if (isset(self::$taskConfig->clientConfig)) {
foreach (self::$taskConfig->clientConfig as $attr => $value) {
self::$kClientConfig->{$attr} = $value;
}
}
self::$kClient = new KalturaClient(self::$kClientConfig);
self::$kClient->setPartnerId(self::$taskConfig->getPartnerId());
self::$clientTag = 'batch: ' . self::$taskConfig->getSchedulerName() . ' ' . get_class($this) . " index: {$this->getIndex()} sessionId: " . UniqueId::get();
self::$kClient->setClientTag(self::$clientTag);
//$ks = self::$kClient->session->start($secret, "user-2", KalturaSessionType::ADMIN);
$ks = $this->createKS();
self::$kClient->setKs($ks);
KDwhClient::setEnabled(self::$taskConfig->getDwhEnabled());
KDwhClient::setFileName(self::$taskConfig->getDwhPath());
$this->onBatchUp();
KScheduleHelperManager::saveRunningBatch($this->getName(), $this->getIndex());
}
开发者ID:kubrickfr,项目名称:server,代码行数:55,代码来源:KBatchBase.class.php
注:本文中的KalturaClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论