Commit 24cfabd8 authored by lphuberdeau's avatar lphuberdeau

[MOD] Moving URL generation to the library

parent f450b7e5
......@@ -49,6 +49,12 @@ class KalturaLib
}
}
function getMediaUrl($entryId, $playerId)
{
global $prefs;
return $this->kconfig->serviceUrl . "kwidget/wid/_{$prefs['kaltura_partnerId']}/uiconf_id/$playerId/entry_id/$entryId";
}
function testSetup() {
global $prefs;
if (!$this->initialized || empty($prefs['kaltura_partnerId']) || !is_numeric($prefs['kaltura_partnerId']) || empty($prefs['kaltura_secret']) || empty($prefs['kaltura_adminSecret'])) {
......
......@@ -153,7 +153,11 @@ $("#kaltura_upload_btn' . $instance . ' a").live("click", function() {
$params['player_id'] = $prefs['kaltura_kdpUIConf'];
}
global $kalturaadminlib; require_once 'lib/videogals/kalturalib.php';
global $kalturaadminlib, $kalturalib; require_once 'lib/videogals/kalturalib.php';
if (! $kalturalib) {
return '<div>Kaltura not configured.</div>';
}
if ($kalturaadminlib && $kalturaadminlib->session && (empty($params['width']) || empty($params['height']))) {
$player = $kalturaadminlib->getPlayersUiConf($params['player_id']);
......@@ -170,6 +174,7 @@ $("#kaltura_upload_btn' . $instance . ' a").live("click", function() {
}
$params = array_merge($defaults, $params);
$params['session'] = $kalturalib->session;
$params['media_url'] = $kalturalib->getMediaUrl($params['id'], $params['player_id']);
$smarty = TikiLib::lib('smarty');
$smarty->assign('kaltura', $params);
......
<object name="kaltura_player" id="kaltura_player" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="365" width="400" data="{$prefs.kaltura_kServiceUrl|escape}index.php/kwidget/wid/_{$prefs.kaltura_partnerId|escape}/uiconf_id/{$kaltura.player_id|escape}/entry_id/{$kaltura.id|escape:'url'}">
<object name="kaltura_player" id="kaltura_player" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="{$kaltura.height|escape}" width="{$kaltura.width|escape}" data="{$kaltura.media_url|escape}" resource="{$kaltura.media_url|escape}">
<param name="allowScriptAccess" value="always" />
<param name="allowNetworking" value="all" />
<param name="allowFullScreen" value="true" />
<param name="movie" value="{$prefs.kaltura_kServiceUrl|escape}index.php/kwidget/wid/_{$prefs.kaltura_partnerId|escape}/uiconf_id/{$kaltura.player_id|escape}/entry_id/{$kaltura.id|escape:'url'}"/>
<param name="movie" value="{$kaltura.media_url|escape}"/>
<param name="flashVars" value="entry_id={$kaltura.id|escape:'url'}&amp;ks={$kaltura.session|escape:'url'}"/>
<param name="wmode" value="opaque"/>
</object>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment