Implementing

40 replies [Last post]
Joined: 03/29/2009
Points: 764

Implementing

Joined: 03/29/2009
Points: 764

Hi All,

I am new to Kaltura. I was trying to implement the examples given on Kaltura site. But the "upload" and "organizing" examples dont seem to work.

I have just copy/pasted the code from Kaltura. Below is my code:

Code: Select all
=========================================================
Upload
=========================================================

Kaltura Upload

function onContributionWizardAfterAddEntry(entries) {
alert("Added " + entries.length + " entries");
for(var i = 0; i < entries.length; i++) {
alert("entries["+i+"] = " + entries[i].entryId);
}
}

<?php
require_once("kaltura_client.php");
define(KALTURA_PARTNER_ID, 12345);
define(KALTURA_SUBP_ID, 1234567);
define(KALTURA_SECRET, "xxxxxxxxxxxxxxxxxxxxx");
$config = new KalturaConfiguration(KALTURA_PARTNER_ID,KALTURA_SUBP_ID);
$user = new KalturaSessionUser();
$user->userId = "ANONYMOUS";
$user->screenName = "Anonymous";
$client = new KalturaClient($config);
$result = $client->startSession($user, KALTURA_SECRET, false);
$ks = $result["result"]["ks"];
$flashVars = array();
$flashVars["partnerId"] = KALTURA_PARTNER_ID;
$flashVars["subpId"] = KALTURA_SUBP_ID;
$flashVars["uid"] = $user->userId;
$flashVars["ks"] = $ks;
$flashVars["kshowId"] = -2;
$flashVars["afterAddEntry"] = "onContributionWizardAfterAddEntry";
$flashVars["showCloseButton"] = false;
?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};

var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/36200", "kcw", "680", "360", "9.0.0", false, flashVars, params);

========================================================
Organizing
========================================================

function entryClicked ( entry_id )
{
window.location = "./player.php?entry_id=" + entry_id ;
}

<?php
require_once("kaltura_client.php");
$partner_id = 12345;
$subp_id = 1234567;
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$admin_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$service_url = "http://www.kaltura.com";
require_once("kaltura_helper.php");
$conf = kaltura_init_config();
echo " conf

"; print_r($conf); echo "

";
$user = new KalturaSessionUser();
$user->userId = "ANONYMOUS";
$cl = new KalturaClient($conf);
$res =$cl->startSession($user, $conf->secret , null);

$ks = $cl->getKs();
echo "ks " . $ks;
echo "

"; print_r($ks); echo "

";
// create a filter to define what exactly we want to be in the list
$filter = new KalturaEntryFilter ();

$filter->inMediaType = "1,2,5,6"; // allow clips of mediaType 1=video, 2=images, 5=audio, 6=roughcuts. Separate the choice with ',' and no spaces

// order the results by the creation data descending
$filter->orderBy = KalturaEntryFilter::ORDER_BY_CREATED_AT_DESC;
// or ascending :
// $filter->orderBy = KalturaEntryFilter::ORDER_BY_CREATED_AT_ASC;

$page = $_REQUEST[‘page’]; // read the current page from the request.

// choose the page_size to be some number that will fit the area you would like to display the thumbnails gallery
$page_size = 20;
// page=1 is the first page
if ( $page < 1 ) $page = 1;
echo " page " . $page;
$detailed = false;
$res = $cl->listentries ( $user , $filter , $detailed , $page_size , $page );
echo " res

"; print_r($res); echo "

";
$count = @$res["result"]["count"];
$entries = @$res["result"]["entries"];
if ( ! $entries ) $entries =array();
// set the number of images in a single row of the table
$images_in_row = 5;
$pager_string = "";
$start_page = max ( 1 , $page - 5 );
$very_last_page = (int)($count / $page_size);
$end_page = min ( $very_last_page , $start_page + 10 );

for ( $p=$start_page ; $p < $end_page ; $p++)
{
$pager_string .= kaltura_createPagerForGallery ( $p , $page , $page_size , $count , "entryClicked");
}

$before_page_string = "";
$after_page_string = "";

// add page 0 if not in list
if ( $start_page > 0 ) $before_page_string .= kaltura_createPagerForGallery ( 0, $page ,
$page_size , $count , "entryClicked" ) ;

// have some dots if there is a real gap between 0 and the rest
if ( $start_page > 1 ) $before_page_string .= "..."; if ( $end_page < $very_last_page -1 ) $after_page_string .= "...";

//add last page if lot in list
if ( $end_page < $very_last_page ) $after_page_string .= kaltura_createPagerForGallery ( $very_last_page , $page , $page_size, $count, "entryClicked");
// combine all pager strings into one

$pager_string = "total count [ " . $count . "] " . $before_page_string . $pager_string . $after_page_string;

$gallery_html = "";

$i=0;
foreach ( $entries as $entry )
{
$name = $entry["name"];
$type = $entry["type"];
$id = $entry["id"];
$kshow_id = $entry["kshowId"];
$display = $entry['thumbnailUrl'] ?
"" :
"" . $id . " ". $name . "";

// create a link to the player for this specific entry. entryClicked is the name of the javascript function to call.
$gallery_html .= "{$display}" .
"
$name" .
"";
++$i;
if ( $i % $images_in_row == 0 ) $gallery_html .= "";
}

$gallery_html .= "";
// display it all:
echo $pager_string . "
" . $gallery_html;
?>

===========================================================================
Helper Functions
===========================================================================

<?php
function kaltura_init_config ()
{
global $partner_id,$subp_id ,$secret ,$admin_secret , $service_url ;
$conf = new KalturaConfiguration( $partner_id , $subp_id );
$conf->partnerId = $partner_id;
$conf->subPartnerId = $subp_id;
$conf->secret = $secret;
$conf->adminSecret = $admin_secret;
$conf->serviceUrl = "http://www.kaltura.com";
//$conf->setLogger( new KalturaDemoLogger());
return $conf;
}
function kaltura_createPagerForGallery ( $p , $current_page , $page_size , $count ,$js_callback_paging_clicked )
{
$p = (int)$p;
$a = $p * $page_size + 1;
$b = (($p+1) * $page_size) ;
$b = min ( $b , $count ) ;// don't let the page-end be bigger than the total count
$page_to_goto = $p + 1;
if ( $page_to_goto == $current_page )
{
$str = "[{$a}-{$b}] ";
// $str = "[{$a}-{$b}] ";
}
else
$str = "{$a}-{$b} ";

return $str;
}

?>

Can anyone help me. Any kind of help would be greatly appreciated.

Thank you.

-Amey.

Joined: 03/29/2009
Points: 764

Hi Amey,

What exactly are the problems you experience ?

Joined: 03/29/2009
Points: 764

Hi Kalturian,

Thanks for the reply. In the "Upload" functionality, I tried to upload an image from my machine, it says "entry uploaded", but then the "please wait..." message, keeps showing on the page forever....also once i upload anything where can i see it?

In the "organizing" all i see on the screen is this "total count [ ] [1-] ".

Thanks for your help.

Joined: 03/29/2009
Points: 764

The Upload code you submitted works fine. The reason it does nothing is because you haven't asked it to do anything after uploading.

Code: Select all
function onContributionWizardAfterAddEntry(entries) {
alert("Added " + entries.length + " entries");
for(var i = 0; i < entries.length; i++) {
alert("entries["+i+"] = " + entries[i].entryId);
}
}

If you want it to display the entry after it's uploaded you'll need to modify the onContributionWizardAfterAddEntry, so that it redirects to another page (i.e. a viewer).

In regards to the "organising code" - have you actually got anything uploaded to the Kaltura Network? If not, that would explain the "Total Count []".

Joined: 03/29/2009
Points: 764

Hello Chris,

Thank you for your inputs. The picture is getting clearer now. Still, I have many doubts. If you (and also others) could shed some light on these I would be really grateful. I know I am asking too much, but really need to get this working.

Thank you all in advance. :)

1. How can I upload videos to Kaltura network?(Would I have to do it programatically?)
2. Once I upload something using my "Upload" script, is there any handle that I can use to save it to the network?
3. Is there a detailed manual or guide available, for understanding the Kaltura PHP API?
4. Now ideally for a fully functional Kaltura application, we would want the video library to show in the editor, how can I achieve that? i.e. How can I embed a viewer in an editor?
5. My "Organize" script is giving errors:
This is part of the ks array:

Code: Select all
[error] => Array
(
[0] => Array
(
["code"] => MISSING_KS
[desc] => Missing KS. Session not established
)

)

This is the code:

Code: Select all

function entryClicked ( entry_id )
{
window.location = "./player.php?entry_id=" + entry_id ;
}

<?php
require_once("kaltura_client.php");
$partner_id = 12345;
$subp_id = 1234567;
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
$admin_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$service_url = "http://www.kaltura.com";
require_once("kaltura_helper.php");

Joined: 03/29/2009
Points: 764

Hi All,

Under what conditions does the error MISSING_KS occur?

Here's the code:

Code: Select all

function entryClicked ( entry_id )
{
window.location = "./player.php?entry_id=" + entry_id ;
}

<?php
require_once("kaltura_client.php");
$partner_id = 12345;
$subp_id = 1234567;
$secret = "xxxxxxxxxxxxxxxxxxxxxxxx";
$admin_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$service_url = "http://www.kaltura.com";
require_once("kaltura_helper.php");
$conf = kaltura_init_config();
echo " conf

"; print_r($conf); echo "

";
$user = new KalturaSessionUser();
$user->userId = 2;
$cl = new KalturaClient($conf);
$res =$cl->startSession($user, $conf->adminSecret , 1);

$ks = $cl->getKs();
echo "ks " . $ks;
echo "

"; print_r($ks); echo "

";
// create a filter to define what exactly we want to be in the list
$filter = new KalturaEntryFilter ();

$filter->inMediaType = "1,2,5,6"; // allow clips of mediaType 1=video, 2=images, 5=audio, 6=roughcuts. Separate the choice with ',' and no spaces

// order the results by the creation data descending
$filter->orderBy = KalturaEntryFilter::ORDER_BY_CREATED_AT_DESC;
// or ascending :
// $filter->orderBy = KalturaEntryFilter::ORDER_BY_CREATED_AT_ASC;

$page = $_REQUEST['page']; // read the current page from the request.

// choose the page_size to be some number that will fit the area you would like to display the thumbnails gallery
$page_size = 20;
// page=1 is the first page
if ( $page < 1 ) $page = 1;
echo " page " . $page;
$detailed = false;
$res = $cl->listentries ( $user , $filter , $detailed , $page_size , $page );
echo " res

"; print_r($res); echo "

";
$count = @$res["result"]["count"];
$entries = @$res["result"]["entries"];
if ( ! $entries ) $entries =array();
// set the number of images in a single row of the table
$images_in_row = 5;
$pager_string = "";
$start_page = max ( 1 , $page - 5 );
$very_last_page = (int)($count / $page_size);
$end_page = min ( $very_last_page , $start_page + 10 );

for ( $p=$start_page ; $p < $end_page ; $p++)
{
$pager_string .= kaltura_createPagerForGallery ( $p , $page , $page_size , $count , "entryClicked");
}

$before_page_string = "";
$after_page_string = "";

// add page 0 if not in list
if ( $start_page > 0 ) $before_page_string .= kaltura_createPagerForGallery ( 0, $page ,
$page_size , $count , "entryClicked" ) ;

// have some dots if there is a real gap between 0 and the rest
if ( $start_page > 1 ) $before_page_string .= "..."; if ( $end_page < $very_last_page -1 ) $after_page_string .= "...";

//add last page if lot in list
if ( $end_page < $very_last_page ) $after_page_string .= kaltura_createPagerForGallery ( $very_last_page , $page , $page_size, $count, "entryClicked");
// combine all pager strings into one

$pager_string = "total count [ " . $count . "] " . $before_page_string . $pager_string . $after_page_string;

$gallery_html = "";

$i=0;
foreach ( $entries as $entry )
{
$name = $entry["name"];
$type = $entry["type"];
$id = $entry["id"];
$kshow_id = $entry["kshowId"];
$display = $entry['thumbnailUrl'] ?
"" :
"" . $id . " ". $name . "";

// create a link to the player for this specific entry. entryClicked is the name of the javascript function to call.
$gallery_html .= "{$display}" .
"
$name" .
"";
++$i;
if ( $i % $images_in_row == 0 ) $gallery_html .= "";
}

$gallery_html .= "";
// display it all:
echo $pager_string . "
" . $gallery_html;
?>

Thanks.

Joined: 03/29/2009
Points: 764

Hi All,

How can I see the library of videos in my editor, which is used to remix videos etc?

Here's the code:

Code: Select all

Kaltura Remix

function onSimpleEditorBackClick(isModified) {
alert('onSimpleEditorBackClick');
}

function onSimpleEditorSaveClick() {
alert('onSimpleEditorSaveClick');
}

<?php
require_once("kaltura_client.php");
define(KALTURA_PARTNER_ID, 12345);
define(KALTURA_SUBP_ID, 1234567);
define(KALTURA_SECRET, "xxxxxxxxxxxxxxxxxxxxxxxxxxx");
$config = new KalturaConfiguration(KALTURA_PARTNER_ID,KALTURA_SUBP_ID);
$user = new KalturaSessionUser();
$user->userId = "ANONYMOUS";
$user->screenName = "Anonymous";
$client = new KalturaClient($config);
$result = $client->start($user, KALTURA_SECRET, false, "edit:*");

$client->setKS($ks);
$entry = new KalturaEntry();
$entry->name = "My First Mix";
$res = $client->addRoughcutEntry($user, -2, $entry);
//$entryId = @$res["result"]["entry"]["id"];
$entryId = @$res["result"]["entry"]["id"];
$flashVars = array();
$flashVars["partnerId"] = KALTURA_PARTNER_ID;
$flashVars["subpId"] = KALTURA_SUBP_ID;
$flashVars["uid"] = $user->userId;
$flashVars["ks"] = $ks;
$flashVars["kshowId"] = "entry-".$entryId;
$flashVars["entryId"] = $entryId;
$flashVars["backF"] = "onSimpleEditorBackClick";
$flashVars["saveF"] = "onSimpleEditorSaveClick";

?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};

var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kse/ui_conf_id/36300", "kse", "890", "546", "9.0.0", false, flashVars, params);

Thank you.

Joined: 03/29/2009
Points: 764

Although I'm hardly an expert on Kaltura - here are a few answers that may be of some assistance.

1. The Kaltura Contribution Wizard (KCW) is used for uploading items to the Kaltura Network. This can be called independently (i.e you may write a script that has a site dedicated to uploading content), via the Simple Editor or Advanced/Premium Editor, or via the Kaltura Dynamic Player (KDP). Alternatively, if you want a "out of the box" solution (i.e you don't want to build something from the ground up), you can always use the Wordpress Plug-in or Drupal Add-on. So in answer to your question - there are quite a few ways of uploading content to the network. It really depends on what sort of workflow you're after.

2. Once something is uploaded, it's automatically "saved" to the network. Have a look at the KCW Wiki Page.

3. Although there is a fair amount of information out there on the Kaltura API, it's a bit all over the place at the minute. The best place to start is the wiki. This will answer most of your questions. The API Test Console is also EXTREMELY helpful. However, if you can't figure something out after you've ready through the wiki and API documentation, your next point of call is here - the forum. The Kaltura team are INCREDIBLY fast at replying to questions and resolving issues - it's actually quite incredible. Also, a small community is starting to build, so that users (like myself) can also answer questions.

4. I'm not exactly sure what you mean. There is already an editor - and there is already a viewer. Using the current API you can already create a fantastic application - just look at Remix America. Could you be a little more specific on what you're after?

5. Have you actually changed the Partner ID, Sub-Partner ID, Secret and Admin Secret in the script? I wasn't sure if you just fake values in your post, or whether you actually tried to run the script with those values. For example:

Code: Select all
$partner_id = 12345;

...where 12345 should actually be YOUR Partner ID. If you don't have a Partner ID yet - you'll need to register on the Kaltura Website.

If you haven't actually registered yet - and didn't change the code to reflect your registration details - then that's why nothing was working properly!

If it's of any interest, I've also got a customised Kaltura PHP API library that I've been using as a playground. It's basically just an extension of the current PHP library with some added functions (delete all entries, delete all kshows, etc.).

Good luck, and let me know how you go!

Best Regards, Chris!

Joined: 03/29/2009
Points: 764

Also, if you did actually modify the code and put in your own Partner ID, Secret, etc.

After...

Code: Select all
$res =$cl->startSession($user, $conf->adminSecret , 1);

...try this:

Code: Select all
echo "\n\n";

...to see if there were any problems creating the session. Maybe you typed your secret incorrectly or something? Either way, this should tell you what you've done wrong.

Joined: 03/29/2009
Points: 764

Hello Chris,

First of all lemme thank you for taking the time out and replying in detail to my queries. I think your comments will give my efforts a better direction :). To clarify some of your doubts:

1. I have already registered on Kaltura, and do have genuine secret ids etc., though they are not the ones you see in the
posted code as i changed them for security purposes. While executing the code I am using the genuine ones.
2. When I ran the "remix" sample script, it did show the editor on my screen with 3 buttons: "Welcome", "Clips Library"
and "Transitions", but when I click on them there is nothing in the library. I cant see any thumbnails. How can I see the
thumbnails of the videos from the library in this editor?
3. My objective is this, we have a website, and we want to provide the users of our website the ability to remix videos
using the Kaltura application, through our website. So basically, I need to integrate the Kaltura application with my
website.

I will try out all your suggestions and get back to you. I will be returning to this forum quite frequently atleast for the next few days, as I need to achieve my objective fast. :)

Thanks again.

Joined: 03/29/2009
Points: 764

Hello Chris,

I tried your suggestion of using the following:

Code: Select all
echo "\n\n";

It did actually help as I found out that the session identifier was not getting set in the Client object. Thanks for that. :)

My next query is as follows.

Right now when I upload videos, they are not getting saved permanently, as in, when I refresh the page, the library becomes empty. How do I permanently store videos etc. on the servers?

Also how can I save it, when the user tries to save her remixed video?

All forum users are more than welcome with their suggestions.

Thanks.

Joined: 03/29/2009
Points: 764

As I said, everytime you upload something using the Contribution Wizard, it saves it PERMANATELY to the Kaltura Servers. You can double check this by loading up your CMS and looking at all the entries.

However! If you upload items to the server, that doesn't mean they are AUTOMATICALLY brought into the Editor.

I gather you're trying to create a remix site? If so, basically what you need to do is open up the editor using the example code you have, import in all the content you want and save that remix. Make note of the Kshow ID. Then using the API, you can use the clone function to duplicate that remix for the users on your site.

Alternatively, you can also use the API to add entries (i.e. video clips) to a specific KShow/remix.

My suggestion - have a play with the API test console, whilst you've got the CMS loaded in another tab/window. That way you'll get a good idea of how all the functions work.

Feel free to fire away with any more questions... More than happy to help, as I was in your exact position only a couple of weeks ago and I'm STILL trying to get my head around everything!

Joined: 03/29/2009
Points: 764

Hi Chris,

You are absolutely correct. What I am trying to do is create a Remix site, where users can import videos/images.

Using these imported videos/images and transisitons, they can then create a video Mash Up.

After they create a Mash Up, and they click Save, the Mash Up gets saved to the Kaltura servers.

Now next time when the same or another user of our site fires up the editor, the Clips tab should get pre populated with the earlier imported images and the Mash Ups too.

So, as you said will using the Clone function serve this purpose?

Again, I would really like to thank you for your help. :)

Joined: 03/29/2009
Points: 764

First up, have a read of this thread. Then have a good study of the Ghost House website. Creating a site similar to this is suprisingly not that difficult.

First up, using your editor example code create a new KShow. Note the Kshow ID. Make sure quick_edit=0 so that any new media is not automatically loaded into the timeline. Import all the media you want to the editor. Once you've got all the media imported click save. This will become your base Kshow, or template if you will.

The Ghost House site is made up of a couple of different sections:

The Home Page: All this page really does is list the four of the most recent remixes, four of the most viewed remixes and four of the top rated remixes. You can use the listKShows API call with a custom filter to get these items. For example:

Code: Select all
// Get Last KShows
// ==============
$client = KalturaHelpers::getClient(true); // Establish Connection to Kaltura
$user = KalturaHelpers::getSessionUser(); // Tell Kaltura who the user is...
$filter = new KalturaKShowFilter(); // Create New Filter
$filter->orderBy = KalturaKShowFilter::ORDER_BY_CREATED_AT_DESC; // Order by Date Created
$result = $client->listKShows($user, $filter, true, 4, 1); // List 4 KShows on 1 Page
$lastKShows = $result["result"]["kshows"]; // Put Results in new variable...

You probably also want to define a custom field (for example "Index Custom Data 3"), so that you know which KShows belong to which campaign, etc. As each partner only has one Partner ID, you need something to distinguish what each KShow belongs to. You can also use the KDP to play your own version of the remix.

The Player: You'll also need a create a page which is basically the just the player. You can just use a simple query string to tell the page which KShow to load. For example:

Code: Select all
$kshowToLoad = $_GET["id"];

And then using this KShow ID, you can just load up the KDP as per the examples on the wiki.

If you want you can also add a rating function. There are plenty of free PHP rating scripts out there already, so you don't have to start from scratch if you don't want to. You will need to use the rankKShow API call to give a KShow a rating. For example:

Code: Select all
$result = $client->rankKShow($user, $kshowId, $rank);

The Editor: And finally, you have the editor. Again you can use a Query String to determine which KShow to edit. If nothing is submitted, then the program can default to your newly created template. The script will need to clone the KShow first, and then load the newly cloned KShow into the editor. For example:

Code: Select all
$result = $client->cloneKShow($user, $kshowToClone);

And, in a nutt shell, that's it! Of course, you can expand upon this and make it as simple or complex as you like. All of these functions are listed in the API documentation.

Good luck!

Joined: 03/29/2009
Points: 764

Hi Chris,

A couple of quick questions:

1. quick_edit doesn't seem to work. Could you please show the exact implementation?
2. How do I remove/disable "Add More" button, from the Clips section?
3. Sometimes I get the INVALID_KS error, why is that?

Btw, I am now able to create a new Kshow and also clone a Kshow to successfully pre-populate the Clips section.

Thanks.

-Amey.

Joined: 03/29/2009
Points: 764

Glad to hear you're getting things to work!

1. Try this:

Code: Select all
$flashVars = array();
$flashVars["quick_edit"] = "0";

2. I haven't tried this myself yet (I've been waiting for Kaltura to release the new CMS, which should allow you to easily build and adjust your own skins), so please excuse me if it doesn't actually work. What I believe you have to do is create a new UIConfig. The easiest way to do this is open up the Test Console, start a new admin session, and use the list uiconfs API call to get the details of the UIConfig you are currently using. For example, the Ghost House site uses 30201. If you perform the list uiconfs call with filter__eq_id: 30201, then the server will return:

Code: Select all

1
10
1

30201
3304
3
Editor
se ghosthouse
890
546
/flash/kse/v2.1.1/simpleeditor.swf

/web/content/uiconf/metacafe/ghosthouse/se_ghosthouse.xml

/content/uiconf/metacafe/ghosthouse/Welcome_ghosthouse.swf

None
false

0.4

/flash/kpaint/v1.0.1/Painter.swf
/flash/kpaint/v1.0.1/shapes
/flash/kpaint/v1.0.1/fonts
/flash/kpaint/v1.0.1/kpaint_config.xml

simpleeditor.swf
/content/uiconf/metacafe/ghosthouse/styles_SimpleEditor_ghosthouse.swf
/content/uiconf/metacafe/ghosthouse/en_US_SimpleEditor.swf

1
2008-09-23 03:58:38
2008-09-23 03:58:38

1233382138

1

39ebfd530a351afc96c6a34da1ed6686
0.11646199226379
0.20341992378235
0.39382386207581

You can then use this information to create your own UIConfig using the addUIConfig API call. The settings that are most important to you are:

Code: Select all

false

3. An INVALID_KS error, simply means that the KS you supplied was not valid. Double check the code where you are generating the KS (i.e. starting the Kaltura session). Maybe you're getting an error (such as a timeout) during the creation of the session, but you haven't got any code in place to stop the process if this happens. I've been getting a lot of timeout errors lately, and I'm not sure if it's just my slow Internet connection, or Kaltura's servers.

Good luck!

Joined: 03/29/2009
Points: 764

Alternatively, try using UIConfig: 100005. Let me know if this doesn't work.

Joined: 03/29/2009
Points: 764

the quick_edit is not working for me...also when i try to use the cloneKShow function it gives me invalid session error. it is getting a bit frustrating. here's my code.

script to create a new kshow:

Code: Select all
<?php session_start(); ?>

Kaltura Remix

function onSimpleEditorBackClick(isModified) {
alert('onSimpleEditorBackClick');
}

function onSimpleEditorSaveClick() {
alert('onSimpleEditorSaveClick');
}

<?php
require_once("kaltura_client.php");
define(KALTURA_PARTNER_ID, 12345);
define(KALTURA_SUBP_ID, 1234567);
define(KALTURA_SECRET, "xxxxxxxxxxxxxxxxxxxxxxxxx");
$config = new KalturaConfiguration(KALTURA_PARTNER_ID,KALTURA_SUBP_ID);
$user = new KalturaSessionUser();
$user->userId = "1";
$user->screenName = "Anonymous";
$client = new KalturaClient($config);
$result = $client->startSession($user, KALTURA_SECRET, false, "edit:*");
$ks = $result["result"]["ks"];
$client->setKs($ks);
$k_show = new KalturaKShow();
$k_show->name = "Mash Up Tool";
$k_show->description = "Video Mash Up Tool";
$res = $client->addKShow($user, $k_show, 1);
$kShowId = @$res["result"]["kshow"]["id"];

$flashVars = array();
$flashVars["partnerId"] = KALTURA_PARTNER_ID;
$flashVars["subpId"] = KALTURA_SUBP_ID;
$flashVars["uid"] = $user->userId;
$flashVars["ks"] = $ks;
$flashVars["kshowId"] = $kShowId;
$flashVars["entryId"] = -1;
$flashVars["backF"] = "onSimpleEditorBackClick";
$flashVars["saveF"] = "onSimpleEditorSaveClick";
$flashVars["quick_edit"] = 0;

?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};

var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kse/ui_conf_id/36300", "kse", "890", "546", "9.0.0", false, flashVars, params);

script to clone kShow:

Code: Select all

Kaltura Remix

function onSimpleEditorBackClick(isModified) {
alert('onSimpleEditorBackClick');
}

function onSimpleEditorSaveClick() {
alert('onSimpleEditorSaveClick');
}

<?php
require_once("kaltura_client.php");
define(KALTURA_PARTNER_ID, 12345);
define(KALTURA_SUBP_ID, 1234567);
define(KALTURA_SECRET, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
$config = new KalturaConfiguration(KALTURA_PARTNER_ID,KALTURA_SUBP_ID);
$user = new KalturaSessionUser();
$user->userId = "1";
$user->screenName = "Anonymous";
$client = new KalturaClient($config);
$result = $client->startSession($user, KALTURA_SECRET, false, "edit:*");
$ks = $result["result"]["ks"];
$client->setKs($ks);

if(isset($_GET["k_show_id"])){
$kShowId = $_GET["k_show_id"];
}

$result = $client->cloneKShow($user, $kShowId);
print_r($result);

$flashVars = array();
$flashVars["partnerId"] = KALTURA_PARTNER_ID;
$flashVars["subpId"] = KALTURA_SUBP_ID;
$flashVars["uid"] = $user->userId;
$flashVars["ks"] = $ks;
$flashVars["kshowId"] = $kShowId;
$flashVars["entryId"] = -1;
$flashVars["backF"] = "onSimpleEditorBackClick";
$flashVars["saveF"] = "onSimpleEditorSaveClick";
$flashVars["quick_edit"] = 0;

?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};

var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kse/ui_conf_id/36300", "kse", "890", "546", "9.0.0", false, flashVars, params);

what mistake am i making?
thanks.

Joined: 03/29/2009
Points: 764

When does the following error show up, because I get it quite frequently:

Code: Select all
LoadEntryMRCommand ==> fault, load show/entry faild please try again later...

Thanks.

Joined: 03/29/2009
Points: 764

In regards to that error - I presume that's popping up as a dialogue box in the Flash application? If so, I believe that normally means that your trying to get the editor to open a KShow entry that simply doesn't exist. I can't tell you exactly what's going wrong without all the code - but my suggestion would be to write a function that checks to see if an entry actually exists before you try and open it.

Joined: 03/29/2009
Points: 764

Hi Chris,

Yes, it is popping up as a dialog box in the Flash Application.

I will try these things out and will let you know how it went.

Thank you.

-Amey.

Joined: 03/29/2009
Points: 764

Do we have to use the Admin session while cloning the Kshow?

I am getting the following Flash error:

Code: Select all
LoadEntryMRCommand ==> fault, load show/entry faildplease try again later...

I tried a lot of different things to get rid of this error, but in vain.

Basically do I need to pass the original or the cloned kshowId to :

Code: Select all
$flashVars["kshowId"]

The code I am using to clone is as follow. The partnerId etc. are fake:

Code: Select all
<?php include_once("kaltura_helper.php"); ?>

Kaltura Remix

function onSimpleEditorBackClick(isModified) {
alert('onSimpleEditorBackClick');
}

function onSimpleEditorSaveClick() {
alert('onSimpleEditorSaveClick');
}

<?php
require_once("kaltura_client.php");
$partner_id = 12345;
$subp_id = 1234567;
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$admin_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$service_url = "http://www.kaltura.com";
$config = kaltura_init_config();
//echo "

";print_r($config);echo "

";
$user = new KalturaSessionUser();
$user->userId = "2";
$user->screenName = "Admin";
$client = new KalturaClient($config);
$result = $client->startSession($user, $config->secret, false, "edit:*");
$ks = $result["result"]["ks"];
$client->setKs($ks);

if(isset($_GET["k_show_id"])){
$kShowId = $_GET["k_show_id"];
}

$result1 = $client->cloneKShow($user, $kShowId);
echo "

 CLONE : 
";print_r($result1);echo "

";

$flashVars = array();
$flashVars["partnerId"] = $partner_id;
$flashVars["subpId"] = $subp_id;
$flashVars["uid"] = $user->userId;
$flashVars["ks"] = $ks;
$flashVars["kshowId"] = $kShowId;//$result1["result"]["kshow"]["id"];
//$flashVars["entryId"] = -1;
$flashVars["backF"] = "onSimpleEditorBackClick";
$flashVars["saveF"] = "onSimpleEditorSaveClick";
$flashVars["quick_edit"] = "0";
echo "

";print_r($flashVars);echo "

";
?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};

var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kse/ui_conf_id/36300", "kse", "890", "546", "9.0.0", false, flashVars, params);

Helper File:

Code: Select all
function kaltura_init_config ()
{
global $partner_id,$subp_id ,$secret ,$admin_secret , $service_url;
$conf = new KalturaConfiguration( $partner_id , $subp_id );
$conf->partnerId = $partner_id;
$conf->subPartnerId = $subp_id;
$conf->secret = $secret;
$conf->adminSecret = $admin_secret;
$conf->serviceUrl = "http://www.kaltura.com";
//$conf->setLogger( new KalturaDemoLogger());
return $conf;
}
function

I don't understand what I am doing wrong. Please help me.

Thanks.

-Amey.

Joined: 03/29/2009
Points: 764

Hello Chris,

I am no longer getting the flash error. I was passing an Admin userid to flashVars whereas it was required to pass a webservices userid. Hope I am doing this right. My script works.

Code: Select all
<?php include_once("kaltura_helper.php"); ?>

Kaltura Remix

function onSimpleEditorBackClick(isModified) {
alert('onSimpleEditorBackClick');
}

function onSimpleEditorSaveClick() {
alert('onSimpleEditorSaveClick');
}

<?php
require_once("kaltura_client.php");

$partner_id = 12345;
$subp_id = 1234567;
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$admin_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$service_url = "http://www.kaltura.com";
$config = kaltura_init_config();

$user = new KalturaSessionUser();
$user->userId = "2";
$user->screenName = "Admin";
$client = new KalturaClient($config);
$result = $client->startSession($user, $config->adminSecret, true, "edit:*");
$ks = $result["result"]["ks"];
$client->setKs($ks);

if(isset($_GET["k_show_id"])){
$kShowId = $_GET["k_show_id"];
}

$user4 = new KalturaSessionUser();
$user4->userId = "1";
$user4->screenName = "Anonymous";
$client1 = new KalturaClient($config);
$result4 = $client1->startSession($user4, $config->secret, false, "edit:*");
$ks1 = $result4["result"]["ks"];
$client1->setKs($ks1);

$result1 = $client->cloneKShow($user4, $kShowId, 1);
echo "

 CLONE : 
";print_r($result1);echo "

";

$flashVars = array();
$flashVars["partnerId"] = $partner_id;
$flashVars["subpId"] = $subp_id;
$flashVars["uid"] = $user4->userId;
$flashVars["ks"] = $ks1;
$flashVars["kshowId"] = $result1["result"]["kshow"]["id"];//$cloneKShowId;
$flashVars["entryId"] = -1;
$flashVars["backF"] = "onSimpleEditorBackClick";
$flashVars["saveF"] = "onSimpleEditorSaveClick";
$flashVars["quick_edit"] = FALSE;
echo "

";print_r($flashVars);echo "

";
?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};

var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kse/ui_conf_id/36300", "kse", "890", "546", "9.0.0", false, flashVars, params);

Now what is happening is, when I create a new KShow or clone a KShow and save it, and next time when I load the KShow into the Editor, the Rough-Cut is also loaded into the Timeline. I don't want this to happen. Whenever a user fires up the Editor, I want the Timeline to be empty, though I want the user to be able to choose from the Clips section, which should be pre-loaded, with the imported files. If quick_edit is the solution for this, it isn't working for me.

Another question. Is it possible to load the Remixes created by various users in the Clips section along with the original Entries? If yes,how?

Any kind of help will be greatly appreciated.

Thank you.

-Amey.

Joined: 03/29/2009
Points: 764

To be honest, I'm slightly confused as to what you're saying, but I'll try and help none-the-less.

When you first create your "Master Template KShow" (i.e. the original KShow in which all other remixes are going to be based upon), you need to make sure that you have the quick_edit option set to false. This will mean that when you import media into the editor, it won't automatically load it into the timeline. It actually doesn't matter if you forget to put quick_edit off, as you can always manually delete all the clips in the timeline. After you've imported all of the media you want into the editor, make sure the timeline is empty, and then click save. This will save the SDL to the Kaltura servers. This KShow will become the building block for all remixes, so make sure you've included all the video, music and stills you need. Write down the KShow ID.

Once you've done this, every time you clone this particular KShow, the newly created KShow will be identical (i.e. there will be nothing in the timeline).

I think what you've done wrong is, that you've actually got clips in the timeline on your Master KShow. You can easily check this by loading up the editor and looking.

Is it possible to load the Remixes created by various users in the Clips section along with the original Entries? If yes,how?

I'm not exactly sure what you're asking. Do you mean, after a user succesfully completes a remix, that the remix is exported out as a single clip (i.e. one continuious video file), and inserted into the Clip Library of the Master KShow? If this is the case, technically it is possible, but you'd need to do some serious workarounds.

Alternatively, if you're asking if users can "remix another person's remix", then the answer is yes. Just submit the KShow ID of the remix to the editor.

Sorry if I've confused you even more!

Best Regards, Chris!

Joined: 03/29/2009
Points: 764

Hi Chris,

You have managed to understand, what I was trying to convey, perfectly :) . My apologies for not being clearer. And thanks for taking time in trying to understand my problem.

Yes, I am now able to save the Master KShow with an empty Timeline. The thing that was throwing me off, was a Flash message like this:

Code: Select all
Can't save empty rough cut, add at least 1 clip.

coming up every time I tried to save a KShow with an empty Timeline. Hence, I was assuming that it won't get saved.

Regarding Remixes showing up in Clips section, what I want is exactly as you mentioned i.e. for the Remixes to get added to the Clips of the Master KShow.

Could you give me some sort of a hint or a clue, as regards to which direction I should be looking in, for a solution?

Thanks a ton, for again saving the day. :)

-Amey.

Joined: 03/29/2009
Points: 764

How do you want it to work? Every time a new user creates a remix, their remix gets added to the "Clip Library" of any and all future remixes?

That would mean if you have 200 users create a remix - then you would have 200+ clips in the library. I'm not sure if the Simple Editor would really like that!

Joined: 03/29/2009
Points: 764

Yes, ideally that is how I want it to be. But what you say is right too and we may actually decide against it.

Thanks.

-Amey.

Joined: 03/29/2009
Points: 764

I've never tried it, but you MIGHT be able to just use the addEntry API call, and add a rough-cut to the "Clip Library". Rough-cuts are technically entries, so this might just work. If it does - that's pretty cool - it means you can in affect "nest" things, as you would in a normal NLE.

Alternatively, the only other way I can think of achiving this would be to request an export of a completed rough-cut to a tempory location on your server, wait for the notification that the file has been created, upload that file to the Kaltura Network, and once you've got confirmation that it's been added, delete the temporary file. It's a bit of a long way of doing it, but in theory at least, it should work.

Joined: 03/29/2009
Points: 764

Hi Chris,

Is there a way to list KShows of a particular user?

I have written a code for it, but it is returning all KShows and not the ones belonging to that user.

Code: Select all
<?php
include_once("kaltura_helper.php");
require_once("kaltura_client.php");

$partner_id = 12345;
$subp_id = 1234567;
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
$admin_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$service_url = "http://www.kaltura.com";
$config = kaltura_init_config();

$adminUser = new KalturaSessionUser();
$adminUser->userId = "2";
$adminUser->screenName = "Admin";

$adminClient = new KalturaClient($config);
$adminResult = $adminClient->startSession($adminUser, $config->adminSecret, true, "edit:*");
$adminKs = $adminResult["result"]["ks"];
$adminClient->setKs($adminKs);

if(isset($_GET["user_id"])){
$kUserId = $_GET["user_id"];
}
if(isset($_GET["user_name"])){
$kUserName = $_GET["user_name"];
}

$webUser = new KalturaSessionUser();
$webUser->userId = $kUserId;
$webUser->screenName = $kUserName;

$webFilter = new KalturaKShowFilter();
$userKShowRes = $adminClient->listKShows($webUser, $webFilter, 1);
echo "

 LIST:
";print_r($userKShowRes);echo "

";

Thanks.

-Amey.

Joined: 03/29/2009
Points: 764

Try setting use_filter_puser_id to true. For example:

Code: Select all
$userKShowRes = $adminClient->listKShows($webUser, $webFilter, 1, 10, 1, true);

Joined: 03/29/2009
Points: 764

Hi Chris,

Thank you for your suggestions regarding how to add Remixes to the Clips library.

It will definitely be helpful, if and when we decide to implement it.

Thanks.

-Amey.

Joined: 03/29/2009
Points: 764

How's it going Amey? Have you got a working site happening yet?

Make sure you keep us all posted on your progress! I'm really interested to see what you come up with!

Best Regards, Chris!

Joined: 08/12/2010
Points: 1

Implementing looks effective for my writing in college.

Tim http://writing4students.blogspot.com

Joined: 10/16/2010
Points: 4

Hi all! I am very new to Kaltura and the whole website building process. I'm attempting to create a remix site as well, using the latest versions of WordPress MU & BuddyPress, on a Linux shared hosting environment, PHP5, Firefox...
so far, I've -downloaded and installed the Kaltura All-In-One-Video plug-in, -gotten my partner ID and secret ID, -read the quick start guide, -read the wikis, -created a player in the KMS, and -added some test content. But when I embed the code on my site, the 'Upload' and 'Remix' buttons don't work--when I click them nothing happens. I also get a little yellow message in WordPress that says they aren't going to work before I even post. so I tried embedding it on an html page outside of WP --with the same results. I think maybe there is some step or instruction I am overlooking? (The primary reason I think this is because- part of the KMS editor is cut off and I can't read the words and instructions on the rightmost side of the screen no matter how much I try to adjust my window and display settings.)
Nevertheless...in an earlier post in this forum, it is mentioned that Kaltura offers an out-of-the-box solution for WordPress/Drupal users, so should I still be downloading the KSU files and fiddling with code and such? I've searched several forums on both Kaltura and WordPress, and still don't quite understand exactly what Kaltura product I even have or what product I actually need to get things going. Most of the posts I find that address this issue start off quite simple before exploding into computer code (yikes!)
Pardon my ignorance, but can someone kindly let me know my next steps are in getting the Upload/Remix buttons to work in WordPress? Or maybe this a service that you have to pay for thru Kaltura.com if you don't know how to program? If so, I'll gladly pay but can't seem to find any pricing guides either. I've emailed Kaltura about 5 days ago, but haven't gotten a reply yet; however, I do appreciate that there seem to be quicker responses in the forums, so here goes!!....
Please help? I'm so desperate to get going! Any assistance will be greatly appreciated!! :) Thanks so much!!

Joined: 11/05/2009
Points: 249

give the videox7 ugc plugin a shot. its still in beta but it provides some pretty good functionality

http://www.kalturacehost.com

Joined: 10/16/2010
Points: 4

Thanks so much for taking time to reply. The plug-in looks awesome, i can't make it work just yet with WordPress but I'm going to keep trying. If it works its exactly what I need! Maybe I can get some technical help from them or anyone on their forum. I'm still open to suggestions :)

Joined: 11/05/2009
Points: 249

well you are more than welcome to ask for support on the plugin website, or i am fully able to answer most questions here in this forum as i have helped to develop it. what problems are you experiencing?

Joined: 10/16/2010
Points: 4

Thanks for your help! :) So far...when I ftp the x7video folder to my wp/content/plugins folder (per the installation instructions), it doesn't show up in the WordPress plugin manager so I can activate it. Am I doing something wrong?

Joined: 11/05/2009
Points: 249

hmmm well as long as after the zip file is extracted you have a structure like this: http://yourWPdirectory/wp-content/plugins/x7video/x7ugc.php then it should definitely appear when you next visit your WP Plugin manager page. i gotta admit that it is very odd for it not to appear at all...

Joined: 10/16/2010
Points: 4

Thanks, rtcwp07! I got it up and working! (Turns out the file unzipped as 'x7video2', so I just needed to rename it without the '2')
*I installed the Exec-PHP plugin,
*got all the authorization keys,
*embedded the player on a page,
*and it looks awesome!
I'm going to play around with it and see just how much I can customize it for my site. I'll keep you posted on how it's going.
Thanks so much for introducing me to JayCut!! I think I'm going to love it!

~Mitra
virtualvinyldotorg