Problems integrating into site

5 replies [Last post]
Joined: 12/09/2009
Points: 1

I am trying to get the KCW up and working on my site. I copy and pasted the example script from the integration help page but when I load the web page it just comes up completely blank, no errors or anything just blank. Heres is my code:

<?php require_once("KalturaClient.php"); ?>

<?php
//define constants
define("KALTURA_PARTNER_ID", 104892);
define("KALTURA_PARTNER_SERVICE_SECRET", "2da55f0b05fbc6d1ab89de3494c7d082");
//define session variables
$partnerUserID = 'ANONYMOUS';
//construct Kaltura objects for session initiation
$config = new KalturaConfiguration(KALTURA_PARTNER_ID);
$client = new KalturaClient($config);
$ks = $client->session->start(KALTURA_PARTNER_SERVICE_SECRET, $partnerUserID, KalturaSessionType::USER);
//Prepare variables to be passed to embedded flash object.
$flashVars = array();
$flashVars["uid"] = $partnerUserID;
$flashVars["partnerId"] = KALTURA_PARTNER_ID;
$flashVars["ks"] = $ks;
$flashVars["afterAddEntry"] = "onContributionWizardAfterAddEntry";
$flashVars["close"] = "onContributionWizardClose";
$flashVars["showCloseButton"] = false;
$flashVars["Permissions"] = 1;
?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};
// php to js
var flashVars = <?php echo json_encode($flashVars); ?>;

swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741 ", "kcw", "680", "360", "9.0.0", "expressInstall.swf", flashVars, params);

function onContributionWizardAfterAddEntry(entries) {
alert(entries.length + " media file/s was/were succsesfully uploaded");
for(var i = 0; i < entries.length; i++) {
alert("entries["+i+"]:EntryID = " + entries[i].entryId);
}
}

function onContributionWizardClose() {
alert("Thank you for using Kaltura ontribution Wizard");
}

Any idea what is wrong?

bdd
bdd's picture
User offline. Last seen 2 years 3 weeks ago.
Joined: 01/07/2010
Points: 10

omg, I'm not the only guy who has this pb.
That's a bug?
Blank page and no error.
Why it's so complicated to run this CW app... Grrr

Joined: 08/14/2009
Points: 20

missing some basics folks....

1. First of all, tags are missing around javascript code.
2. Must include swfobject.
3. Be careful with secrets you have, they may be misused...!!!???!!!

Running code is here...

<?php require_once("lib/KalturaClient.php"); ?>
<?php
//define constants
define("KALTURA_PARTNER_ID", 104892);
define("KALTURA_PARTNER_SERVICE_SECRET", "2da55f0b05fbc6d1ab89de3494c7d082");
//define session variables
$partnerUserID = 'ANONYMOUS';
//construct Kaltura objects for session initiation
$config = new KalturaConfiguration(KALTURA_PARTNER_ID);
$client = new KalturaClient($config);
$ks = $client->session->start(KALTURA_PARTNER_SERVICE_SECRET, $partnerUserID, KalturaSessionType::USER);
//Prepare variables to be passed to embedded flash object.
$flashVars = array();
$flashVars["uid"] = $partnerUserID;
$flashVars["partnerId"] = KALTURA_PARTNER_ID;
$flashVars["ks"] = $ks;
$flashVars["afterAddEntry"] = "onContributionWizardAfterAddEntry";
$flashVars["close"] = "onContributionWizardClose";
$flashVars["showCloseButton"] = false;
$flashVars["Permissions"] = 1;
?>

var params = {
allowScriptAccess: "always",
allowNetworking: "all",
wmode: "opaque"
};
// php to js
var flashVars = <?php echo json_encode($flashVars); ?>;
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741 ", "kcw", "680", "360", "9.0.0", "expressInstall.swf", flashVars, params);
function onContributionWizardAfterAddEntry(entries) {
alert(entries.length + " media file/s was/were succsesfully uploaded");
for(var i = 0; i < entries.length; i++) {
alert("entries["+i+"]:EntryID = " + entries[i].entryId);
}
}
function onContributionWizardClose() {
alert("Thank you for using Kaltura ontribution Wizard");
}

Thanks ;-)

Joined: 05/04/2010
Points: 8

Ok I included my swfobject.js and my java is in its proper tags, but I am having the same problem. Any suggestions?

<html>
<head>

<!--include external scripts and define constants -->
<?php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
        require_once("kaltura_client_v3/KalturaClient.php");
       
        //define constants
        define("KALTURA_PARTNER_ID", 254892);
        define("KALTURA_PARTNER_WEB_SERVICE_SECRET", "6ac67698*****1");

        //define session variables
        $partnerUserID          = "ADMIN";

        //Construction of Kaltura objects for session initiation
        $config           = new KalturaConfiguration(KALTURA_PARTNER_ID);
        $client           = new KalturaClient($config);
        $ks               = $client->session->start(KALTURA_PARTNER_WEB_SERVICE_SECRET, $partnerUserID, KalturaSessionType::ADMIN);

        $flashVars = array();
        $flashVars["uid"]   = $partnerUserID;
        $flashVars["partnerId"]                         = KALTURA_PARTNER_ID;
        $flashVars["subPId"]                    = KALTURA_PARTNER_ID*100;
        $flashVars["ks"]   = $ks;
$flashVars["afterAddEntry"]     = "onContributionWizardAfterAddEntry";
$flashVars["close"]       = "onContributionWizardClose";
$flashVars["showCloseButton"]   = false;
$flashVars["Permissions"]       = 1;
?>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<div id="kcw"></div>
<script type="text/javascript">
var params = {
        allowScriptAccess: "always",
        allowNetworking: "all",
        wmode: "opaque"
};
// php to js
var flashVars = <?php echo json_encode($flashVars); ?>;
 <//!--embed flash object-->
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741 ", "kcw", "680", "360", "9.0.0", "expressInstall.swf", flashVars, params);
</script>
<//!--implement callback scripts-->
<script type="text/javascript">
function onContributionWizardAfterAddEntry(entries) {
        alert(entries.length + " media file/s was/were succsesfully uploaded");
        for(var i = 0; i < entries.length; i++) {
                alert("entries["+i+"]:EntryID = " + entries[i].entryId);
        }
}
</script>
<script type="text/javascript">
function onContributionWizardClose() {
        alert("Thank you for using Kaltura ontribution Wizard");
}
</script>
</body>
</html>

Joined: 05/04/2010
Points: 8

Ok so I ran through the code and output and came up with this, this snippit of code,

<script type="text/javascript">
var params = {
        allowScriptAccess: "always",
        allowNetworking: "all",
        wmode: "opaque"
};
// php to js
var flashVars = <?php echo json_encode($flashVars); ?>;<//!--embed flash object-->
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741", "kcw", "680", "360", "9.0.0", "expressInstall.swf", flashVars, params);</script>

is outputing this

 <script type="text/javascript">
var params = {
        allowScriptAccess: "always",
        allowNetworking: "all",
        wmode: "opaque"
};
// php to js
var flashVars = {"uid":"ANONYMOUS","partnerId":"254892","ks":"YWQyM2M3ZjFmNDcyYWZjNTQwOWQyNWQxNzQxZmYwYzliNzk2YTE3MnwyNTQ4OTI7MjU0ODkyOzEyNzMzODI1MjI7MjsxMjczMjk2MTIyLjkwNzM7QU5PTllNT1VTOw==","afterAddEntry":"onContributionWizardAfterAddEntry","close":"onContributionWizardClose","showCloseButton":false,"Permissions":1};<//!--embed flash object-->
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741 ", "kcw", "680", "360", "9.0.0", "expressInstall.swf", flashVars, params);</script>

Looks like the javascript variables (flashVars and params) are not rendering in the swf embed. Now I'm useless with java, can anyone point me in the right direction?

Joined: 05/04/2010
Points: 8

I am just documenting my attempts now to get this all working. Quite frankly I am about running out of patience with these horrible "sample codes" and the complete lack of support with the kaltura platform. I understand I am not yet a paying member but if I can't get 2 out of 3 of what should be simple widgets working, I doubt ill ever be.

So I tried to take as much javascipt as I could out of it and tried to populate the swf embed call with php, something I am much more comfortable with and threw this together.

<script type="text/javascript">
var params = {
        allowScriptAccess: "always",
        allowNetworking: "all",
        wmode: "opaque"
};
// php to js
<?php $flash2 = json_encode($flashVars);
$params2 = '{allowScriptAccess:"always",allowNetworking:"all",wmode:"opaque"}';
$comma = ",";
$flash2 .= $comma;
$flash2 .= $params2;  
 ?>;<//!--embed flash object-->
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741 ", "kcw", "680", "360", "9.0.0", "expressInstall.swf", <?php echo $flash2 ?>);</script>

That outputted something that looks a lot more correct;

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
        <head>
                <title>SWFObject 2 dynamic publishing example page</title>
                        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                <script type="text/javascript" src="swfobject.js"></script>
                <script type="text/javascript">
                </script>
        </head>
        <body>
                <div id="kcw"></div>
<script type="text/javascript">
var params = {
        allowScriptAccess: "always",
        allowNetworking: "all",
        wmode: "opaque"
};
// php to js
;<//!--embed flash object-->
swfobject.embedSWF("http://www.kaltura.com/kcw/ui_conf_id/1000741 ", "kcw", "680", "360", "9.0.0", "expressInstall.swf", {"uid":"ANONYMOUS","partnerId":"254892","ks":"MDAzN2NmNjliZDVjYjBkNzFmMjA1MTNhNDZhODg3NWZiYTg1ZDIzMXwyNTQ4OTI7MjU0ODkyOzEyNzM0MjIxMDk7MjsxMjczMzM1NzA5LjA2NzY7QU5PTllNT1VTOw==","afterAddEntry":"onContributionWizardAfterAddEntry","close":"onContributionWizardClose","showCloseButton":false,"Permissions":1},{allowScriptAccess:"always",allowNetworking:"all",wmode:"opaque"});</script>
       
    <script type="text/javascript">
function onContributionWizardAfterAddEntry(entries) {
        alert(entries.length + " media file/s was/were succsesfully uploaded");
        for(var i = 0; i < entries.length; i++) {
                alert("entries["+i+"]:EntryID = " + entries[i].entryId);
        }
}
</script>
<script type="text/javascript">
function onContributionWizardClose() {
        alert("Thank you for using Kaltura ontribution Wizard");
}
</script>
    </body>
</html>

But still no hints of the object actually, you know, embedding