Beispiel #1
0
 /**
  * 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;
 }