Example #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;
 }
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;
    }
}
<?php

require_once "../../config.php";
require_once 'lib.php';
try {
    $kClient = new KalturaClient(KalturaHelpers::getServiceConfiguration());
    $kalturaUser = KalturaHelpers::getPlatformKey("user", "");
    $kalturaSecret = KalturaHelpers::getPlatformKey("secret", "");
    $ksId = $kClient->session->start($kalturaSecret, $kalturaUser, KalturaSessionType::USER);
    $kClient->setKs($ksId);
    $mix = new KalturaMixEntry();
    //	$mix -> name = "Editable video";
    $mix->name = empty($_POST["name"]) ? "Editable video" : $_POST["name"];
    $mix->editorType = KalturaEditorType::ADVANCED;
    $mix = $kClient->mixing->add($mix);
    $arrEntries = explode(',', $_POST['entries']);
    foreach ($arrEntries as $index => $entryId) {
        if (!empty($entryId)) {
            $kClient->mixing->appendMediaEntry($mix->id, $entryId);
        }
    }
    echo 'y:' . $mix->id;
} catch (Exception $exp) {
    die('n:' . $exp->getMessage());
}
Example #4
0
 function getThumbnailUrl($widgetId = null, $entryId = null, $width = 240, $height = 180, $version = 100000)
 {
     $config = KalturaHelpers::getServiceConfiguration();
     $url = kalturaGetCdnUrl();
     $url .= "/p/" . $config->partnerId;
     $url .= "/sp/" . $config->subPartnerId;
     $url .= "/thumbnail";
     if ($widgetId) {
         $url .= "/widget_id/" . $widgetId;
     } else {
         if ($entryId) {
             $url .= "/entry_id/" . $entryId;
         }
     }
     $url .= "/width/" . $width;
     $url .= "/height/" . $height;
     $url .= "/type/2";
     $url .= "/bgcolor/000000";
     if ($version !== null) {
         $url .= "/version/" . $version;
     }
     return $url;
 }
 function getKalturaClient($isAdmin = false, $privileges = null)
 {
     // get the configuration to use the kaltura client
     $kalturaConfig = KalturaHelpers::getServiceConfiguration();
     $sessionUser = KalturaHelpers::getSessionUser();
     if (!$privileges) {
         $privileges = 'edit:*';
     }
     // inititialize the kaltura client using the above configurations
     $kalturaClient = new KalturaClient($kalturaConfig);
     // get the current logged in user
     //		$user = KalturaHelpers::getPlatformKey("user", "");
     $user = $sessionUser->userId;
     if ($isAdmin) {
         $adminSecret = KalturaHelpers::getPlatformKey("admin_secret", "");
         $ksId = $kalturaClient->session->start($adminSecret, $user, KalturaSessionType::ADMIN, -1, 86400, $privileges);
     } else {
         $secret = KalturaHelpers::getPlatformKey("secret", "");
         $ksId = $kalturaClient->session->start($secret, $user, KalturaSessionType::USER, -1, 86400, $privileges);
     }
     $kalturaClient->setKs($ksId);
     return $kalturaClient;
 }
Example #6
0
 function getKalturaClient($isAdmin = false, $privileges = null)
 {
     // get the configuration to use the kaltura client
     $kalturaConfig = KalturaHelpers::getServiceConfiguration();
     if (!$privileges) {
         $privileges = 'edit:*';
     }
     // inititialize the kaltura client using the above configurations
     $kalturaClient = new KalturaClient($kalturaConfig);
     // get the current logged in user
     $k_helpers = new KalturaHelpers();
     $sessionUser = $k_helpers->getSessionUser();
     // get the variables requireed to start a session
     $partnerId = variable_get('kaltura_partner_id', '');
     $secret = variable_get('kaltura_secret', '');
     $adminSecret = variable_get('kaltura_admin_secret', '');
     if ($isAdmin) {
         $result = $kalturaClient->session->start($adminSecret, $sessionUser->id, KalturaSessionType::ADMIN, $partnerId, 86400, $privileges);
     } else {
         $result = $kalturaClient->session->start($secret, $sessionUser->id, KalturaSessionType::USER, $partnerId, 86400, $privileges);
     }
     $len = strlen($result);
     /** proper method for error checking please
         if ($len!=116)
         {
           watchdog("kaltura", $result );
           return null;
         }else {
          */
     // set the session so we can use other service methods
     $kalturaClient->setKs($result);
     //}
     return $kalturaClient;
 }
 function getKalturaClient($isAdmin = false, $privileges = null)
 {
     // get the configuration to use the kaltura client
     $kalturaConfig = KalturaHelpers::getServiceConfiguration();
     if (!$privileges) {
         $privileges = 'edit:*';
     }
     // inititialize the kaltura client using the above configurations
     $kalturaClient = new KalturaClient($kalturaConfig);
     // get the current logged in user
     $sessionUser = KalturaHelpers::getSessionUser();
     if ($isAdmin) {
         $adminSecret = variable_get("kaltura_admin_secret", "");
         $result = $kalturaClient->startSession($sessionUser, $adminSecret, true, $privileges);
     } else {
         $secret = variable_get("kaltura_secret", "");
         $result = $kalturaClient->startSession($sessionUser, $secret, false, $privileges);
     }
     if (count(@$result["error"])) {
         watchdog("kaltura", $result["error"][0]["code"] . " - " . $result["error"][0]["desc"]);
         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;
 }