当前位置: 首页>>代码示例>>PHP>>正文


PHP KalturaClient类代码示例

本文整理汇总了PHP中KalturaClient的典型用法代码示例。如果您正苦于以下问题:PHP KalturaClient类的具体用法?PHP KalturaClient怎么用?PHP KalturaClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KalturaClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的KalturaClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。