Kaltura: Open Source Video Developer Community
Published on Kaltura: Open Source Video Developer Community (http://www.kaltura.org)

Home > Drupal Kaltura Module - All-in-One Video Module

By petanu
Created 02/23/2009 - 16:58

Drupal Kaltura Module - All-in-One Video Module

Documentation and Guides for the Drupal - Kaltura Module. [1]

Changing the default video status to "Not Published"

Overview

When creating a new node using the Drupal Kaltura Module and adding a video to it, the status of the video is automatically set as "Published". sometimes it is necessary to set the default status to "Not Published" so that we will be able to moderate the content.

Integration Steps

Open the file includes/Kaltura.notification.inc
Find the function:
Function Kaltura_notify_node_entry_add

find the following line

$node->status=1;

and change it to:
$node->status=0;

Content Synchronization between Drupal and Kaltura

Overview

Media uploaded to Kaltura system can be managed from within Drupal management system as well as from Kaltura Management Console (KMC). Sometimes it is necessary to synchronize these systems to make sure media content is up-to-date on both systems and to enable synchronized workflows. Synchronization between Kaltura and Drupal is done in several ways, and in various scenarios. Below are few examples to such synchronization use cases.

On Going Synchronization

  • Drupal to Kaltura
    1. Metadata - All metadata changes done on Drupal affect only Drupal local database. Updates are not automatically sent back to the Kaltura system. A Drupal site administrator can run a cron job from Drupal to activate such updates a-synchronically.
    2. Entry Deletion - To make sure an entry that is deleted on Drupal is also deleted on Kaltura’s system; one should add a call to Kaltura Client’s deleteEntry method to the node deletion process manually.
  • Kaltura to Drupal
    1. File Upload - The main update required from Kaltura to Drupal is when uploading a media file. As long as client side notifications are active and working and the uploading is done from Drupal’s contribution wizard, nodes will be created in Drupal upon upload completion. However if a node needs to be created when a file is uploaded from the KMC, then the Drupal admin needs to make sure that server side notifications are turned on as well. If these are active then a file uploaded for this partner, no matter where from, will send a notification and generate a node on Drupal.
    2. Metadata – metadata entry updates on KMC (title, tags, etc) will reflect on Drupal when server side notifications are turned on.

One time Migration

  • Kaltura to Drupal
    1. New content – When a partner uploads new content to Kaltura through KMC’s bulk upload option, but plans to use Drupal to manage this content, all he needs to do is to make sure his Drupal installation is working properly and server-side notifications are turned on and being sent. After that, uploading from a CSV file using KMC bulk upload option, will initiate notifications which will then generate the relevant nodes on Drupal.
    2. Existing content – When a partner already has content on the KMC, and then wants to transfer it to Drupal, he would have to use Kaltura’s Drupal import function which is built in the module. In order to activate it, partner should go to http://www.partner_domain.com/?q=admin/settings/kaltura/import , and use the import tool available at this page.
  • Drupal to Kaltura
    Partners, who wish to export Drupal nodes to Kaltura system, should use the KMC bulk upload option and import their drupal content using a CSV file. For more information on the KMC bulk upload option please refer to the KMC quick start guide [2].

Delete files from Kaltura DB when deleting nodes

screenshot774 2009-06-01, 07_59_18.jpg [3]

Overview

The Kaltura Drupal module allows admins and users to delete content. However, content deleted from Drupal (i.e. deleting Drupal nodes) is not removed from the Kaltura databse. Content will continue to be accessible through the Kaltura Management Console while it won't have a corresponding node on the Drupal site.

Some partners find it useful to be able to delete media from the website and the actual database simultaneously instead of deleting files from their Drupal site and then login to Kaltura Management Console and delete again.

Please note: the module is built that way as Kaltura believes deleting the actual content should be done by admin only, and not by users even if they are registered as the content owners.

Implementation

In order to implement the simultanous deleting, follow these steps -

a. Create a new module (or add to existing kaltura_nodeapi())
b. The new module implements a single hook – hook_nodeapi
c. This hook acts upon "delete" action, and if the node deleted is of type "kaltura_?", it calls "delete_entry" in Kaltura's API

Drupal Kaltura Module: Common Post-Installation issues

Table of contents

  • Why do I get a crossdomain.xml error after installing Kaltura’s module?
  • Do I need to register to Kaltura in order to complete Kaltura’s Drupal module installation process?
  • Do I need to set Kaltura to Drupal notification Settings?
  • I tried to create a new Kaltura node, but the Contributor Wizard did not show up
  • I uploaded media to a new Kaltura node, but the media I uploaded did not show up
  • How to limit number of items Kaltura’s views?
  • Can I store all videos and media at my local server?

Why do I get a crossdomain.xml error after installing Kaltura’s module?

As instructed in Kaltura’s module README file, after you unzip Kaltura’s module into your Drupal modules folder, you need to copy the crossdomain.xml file from its original location at the Kaltura modules folder into the root directory of your domain. If your domain is www.domain.com then the crossdomain.xml file should be copied to http://www.domain.com/crossdomain.xml.

Do I need to register to Kaltura in order to complete Kaltura’s Drupal module installation process?

Yes. To complete the installation of Kaltura All-in-one video module for Drupal, you need to register to Kaltura partners program. This could be done during installation process, when you are directed to Kaltura registration page, or you can go to Administer > Site Configuration > Kaltura > Server Integration Settings and as a partner. Your Kaltura partner information will be automatically saved into module’s configuration, and will be sent to you in an email as well.

If you previously registered to Kaltura, and already have your partner identifiers, there is no need to register again. At the Kaltura Server Integration Settings page, click the “Click here if you already have a Partner ID” link and just put your partner information to complete your installation process.

Do I need to set Kaltura to Drupal notification Settings?

Yes. Kaltura implements a set of notifications, sent from Kaltura servers to your Drupal website. These notifications update your Drupal website with the status of your media. In order to support server side notifications, your server must be publicly available on the internet:
Please go to Administer > Site Configuration > Kaltura > Server Integration Settings > Kaltura to Drupal Notifications Settings and put your Drupal base URL: http://www.yourdomain.com. This will configure your notification url. For password-protected site, you should set the notification URL as http://user:pass@yourdomain.com/. Kaltura will concatenate a /?q=kaltura/notification_handler string to this base URL to have a direct link to the notifications handling functionality. In addition to your URL settings, you should check the ‘Enable server side notifications’ option at the notification settings form.

It is recommended that you verify (using an HTTP sniffer) that the notification URL returns HTTP 200 and does not redirect traffic to another URL. Redirection will cause notifications to miss their destination.

I tried to create a new Kaltura node, but the Contributor Wizard did not show up

The most common reason for such problem is that your crossdomain.xml file is not available at the root directory of your domain. To correct this problem, copy the crossdomain.xml file from Kaltura’s module folder into the root directory of your domain.

I uploaded media to a new Kaltura node, but the media I uploaded did not show up

The most common reasons for such a problem are:

  1. Your crossdomain.xml file is not available at the Root directory of your domain. To correct this problem, copy the crossdomain.xml file from Kaltura’s module folder into the root directory of your domain.
  2. Your notification URL is not configured correctly. Or the ‘Enable server side notifications’ is not checked. To correct this problem, go to Administer > Site Configuration > Kaltura > Server Integration Settings > Kaltura to Drupal Notifications Settings and adjust your notifications settings.
  3. If you are running a Drupal instance on a localhost or if your Drupal site is not accessible from the web, the Kaltura notification mechanism is not applicable. In this case you should go to Administer > Site Configuration > Kaltura > Kaltura Media Node Settings>Video display and check the ‘Display in player even if not ready’ option.

How to limit number of items Kaltura’s views?

If you wish to limit the number of items displayed within the various drupal media views provided by Kaltura, Go to Administer > Site Building > Views. From the views list, choose and edit the relevant Kaltura view. At the ‘Edit’ screen set the ‘Items per page’ basic settings to the number of items you want to appear within the view.

Can I store all videos and media at my local server?

Kaltura offers self-hosted solutions using the Community and Enterprise Editions.
To learn more about this option please go to Kaltura Community Edition project [4] page.

Please visit the FAQ [5] for more info.

Drupal Kaltura Module: KCW modifications

Overview

This category contain a set of guides describing how to tweak and modify the KCW widget within the Drupal-Kaltura module.

Guides

  • How to use more than one uploader (KCW) in your Drupal [6]
  • How to remove the Add Interactive Video option from Drupal KCW [7]
  • How to customize Drupal Contributor Wizard [8]
  • How to change the Terms of Use link in Drupal Contributor Wizard [9]

How to change the Terms of Use link in Drupal Contributor Wizard

Overview

The Kaltura Network Terms of Use can be reviewed here [10]. However, when hosting the content locally the user may change those terms of use. In order to do so:

  • Go to kaltura_client/kaltura_helpers.php and find the getContributionWizardFlashVars() function.
  • Replace the terms_of_use value being passed via flashVars to point to your own terms of use page. The following line should be changed from:
    $flashVars["terms_of_use"]      = "http://corp.kaltura.com/tandc";
    To:
    $flashVars["terms_of_use"]      = "Full URL to your terms of use page";

How to customize Drupal Contributor Wizard

Overview

Customizing the appearance and functionality of Kaltura’s drupal contributor wizard is possible either as a self-customization project or as a Kaltura professional services project.
Please look for information on self-customization at the KCW project documentation [11] and Kaltura-Drupal forums [12], or contact Kaltura’s sales team [13] to issue a professional services request.

On both cases you will obtain a new UIConf ID for the customized contributor wizard. For using this UIConf ID to replace drupal’s default contributor wizard, please follow the following steps:

  1. Go to kaltura_client/kaltura_settings.php and find the definition of the KalturaSettings_CW_UICONF_ID constant.
  2. Replace the current value of KalturaSettings_CW_UICONF_ID with the new customized UIConf ID by changing the following line from:
    define('KalturaSettings_CW_UICONF_ID', 601);
    to:
    define('KalturaSettings_CW_UICONF_ID', Your customized UIConf ID);

How to customize Drupal Contributor Wizard (KCW) - Additional Info

With this tutorial, you'll be able to configure the Contribution Wizard to use preexisting templates or create your own!

Step 1. Overview
Open your KalturaCE database and locate table "ui_conf". Each row here, is a setting for a specific Kaltura widgets. Rows with IDs 380, 501, 502, 503, 504, 601, 602, 610, 36200, 36202 represent different settings for Contribution Wizard.

Each row has a "conf_file_path". This url (minus the "/web" prefix) is the URL to the configuration file, which you can additionally modify/tweak.

Step 2: Changing the Theme (ID)
Open {drupal}/modules/kaltura/kaltura_client/kaltura_settings.php and locate

define('KalturaSettings_CW_UICONF_ID', 601);

This tells Drupal to go into KalturaCE database, table "ui_conf" and use ID 601 (mentioned in step 1).

Try changing the above code to

define('KalturaSettings_CW_UICONF_ID', 602);

It tells Drupal to use ID 602. Contribution Wizard is now dark.

Try out other IDs. This way you can also get rid of an ad at the end of the Contribution Wizard.

Step 3. Further Editing
To remove Audio, Picture upload tabs, disable import from YouTube, Facebook, remove Terms of Use pop-up, you will have to edit the configuration (xml) file of the widget.

For this, I suggest you duplicate the row from "ui_conf", relating to KCW. Then duplicate the configuration (xml) file (the file listed in "conf_file_path"). Make sure that the ID you're using is not currently being used and update the path to your configuration file in "conf_file_path". Now edit the configuration file for final changes.

Top update the Terms of Use link, see this post [9].

You can also recompile *.SWF files with custom styles and text (translate, etc) using Adobe Flex by downloading the KCW package from here [14], editing the source code and compiling it via command line (see the included buildResourceModules.bat file).

How to remove the Add Interactive Video option from Drupal KCW

Overview

The following guide will explain required steps to remove the "Add Interactive Video" option from the KCW widget with in the Drupal-Kaltura module.

Implementation steps

  1. Go to the kaltura.module file and find the kaltura_list_entries() function.
  2. Remove the following code lines:
    <ul [15] id="sidemenu">                

    <li [16] id="tab-kaltura"><a [17] href="'. $_GET['cwurl'] .'">Add Interactive Video</a [17]></li [16]>                

    <li [16] id="tab-kaltura_browse"><a [17] class="current" href="'. url('kaltura/entries/allow-insert/'. $field_id) .'">Browse Interactive Videos</a [17]></li [16]>        

    <li [16]><a [17] href="#" onclick="window.top.kalturaCloseModalBox();return false;">Close</a [17]></li [16]>        

    </ul [15]>

  3. Go to the Kaltura.thememing.inc file and find the theme_contribution_wizard_field() function. Look for the code block that starts with: $add_existing = '<div id="media-upload-header"> and remove the following lines:
    <ul [15] id="sidemenu">          

    <li [16] id="tab-kaltura"><a [17] class="current" href="'. url($_GET['q']) .'">Add Interactive Video</a [17]></li [16]>        

    <li [16] id="tab-kaltura_browse"><a [17] href="'. url('kaltura/entries/allow-insert/'. $field_id, array( 'query' => array( 'filter' => $add_filter, 'cwurl' => url($_GET['q']) ) )) .'">Browse Interactive Videos</a [17]></li [16]>        

    <li [16]><a [17] href="#" onclick="window.top.kalturaCloseModalBox();return false;">Close</a [17]></li [16]>    

     </ul [15]>

How to use more than one uploader (KCW) in your Drupal

Overview

The uploader (KCW) that comes with the Drupal module has one uploader configuration with 3 tabs - Image, Video and Audio. follow this guide if you want to change this configuration to only images (if your site has only images) or to split the uploading flows to three different flows (for example - image uploader separate from video uploader).

Function kaltura_contribution_wizard() is always called with one argument. The argument should be a serialized PHP associated array.

The array is being converted into variables, so the key is the variable name, and the value is the variable value.
For example, if the array has an element like: 'test_key' = 'my_value',
Then in the function, the variable $test_key will be defined, and will contain the string "my_value".

In that manner, one more element could be "uiconf_id", which its value will change according to the upload context.

In the same function, there is a call to function getContributionWizardUrl().
If a UIConf ID is passed to that function, the returned value will be a URL on Kaltura server that will load CW with that UIConf.

Implementation steps

  1. Find all places that call kalturaInitModalBox js function, most of those will call a URL of kaltura/contribution_wizard
  2. In each call, there should be an array 1-2 lines above, which holds all the parameters that will be sent to the CW.
    in each call, add the relevant UIConf ID to that array.
  3. In function kaltura_contribution_wizard(), add the variable in the call to getContributionWizardUrl()
    so instead of:

    $theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl();

    you should have

    $theme_params->swfUrl = KalturaHelpers::getContributionWizardUrl($uiconf_id);

    (assuming the key in the parameters array is 'uiconf_id')

  4. In the same function as in #3, find the following line:
    $flash_vars = KalturaHelpers::getContributionWizardFlashVars($kaltura_client->getKs(),   $kshow_id, $partner_data, $type, (($context == `comment')? TRUE: FALSE));

    after this line, add:

    if(isset [18]($uiconf_id)) $flash_vars[`uiConfId'] = $uiconf_id;

How to customize Drupal media player

Overview

Kaltura’s Drupal player could be customized from the Kaltura Application studio tab at the Kaltura Management Console (KMC) application. To customize your drupal player login to the KMC [19] (or your own hosted KMC) and switch to the Application Studio tab to create a customized player. After you save your new player, use its player ID to replace drupal’s player settings by following the steps below.

Create a widget of your own

  1. Login to “Kaltura Management Console” (http://kaltura.com/kmc)
  2. Go to “Application Studio” make a “New player (Single Video)” with the features that you want for your player
  3. Get the “Name” and “ID” of your new player e.g. Name - “haysstreet”, ID - “1001725”

Steps to changing the player widget uiConf

You will now have to change 2 of the files that are included in the Kaltura Drupal module.

  1. kaltura_client/kaltura_settings.php.
    'video' => array [20](
           'dark' => array [20]( 'view_uiconf' => '605', 'remix_uiconf' => '604', 'preview_image' => 'dark-player.jpg' ),
           'gray' => array [20]( 'view_uiconf' => '607', 'remix_uiconf' => '606', 'preview_image' => 'gray-player.jpg' ),
           'white-blue' => array [20]( 'view_uiconf' => '609', 'remix_uiconf' => '608', 'preview_image' => 'white-blue-player.jpg' ),
    ),

    Open kaltura_client/kaltura_settings.php and find the $kdp_widgets array within the KalturaSettings class.

  2. In the 'video' array; Add your own custom widget or adjust an existing line for the player skin you are using, e.g. if you are using the dark player skin, adjust the following line :
    'dark' =>array( 'view_uiconf' => '605', 'remix_uiconf' => '604', 'preview_image' => 'dark-player.jpg' ),

    to include your customized UIConf ID:

    'dark' =>array( 'view_uiconf' => 'your customized player ID', 'remix_uiconf' => 'your customized player ID', 'preview_image' => 'dark-player.jpg' ),
  3. This will then show up on the admin setting of the Kaltura module (admin/settings/kaltura/kaltura_entry_settings) - Make sure the new player skin (dark skin, at the example above) is chosen in Kaltura module’s settings, within Drupal site configuration.
  4. The second file to edit is Kaltura\includes\kaltura.themeing.inc on line 556.
    Change this:

    $swf_url = KalturaHelpers::getSwfUrlForWidget($wid .'_'. $uicid .'/entry_id/'. $params["entry"] .'/uiconf_id/'. $uicid);

    By removing the string .'_'. $uicid, so it looks like this:

    $swf_url = KalturaHelpers::getSwfUrlForWidget($wid .'/entry_id/'. $params["entry"] .'/uiconf_id/'. $uicid);

    You can also just replace the line by doing a copy-paste from this guide.

For advanced customization and for custom built players, refer to the KDP guides [21] or contact Kaltura sales team [13].

How to customize Drupal Standard Editor

Overview

Customizing the appearance and functionality of Kaltura’s drupal Standard Editor is possible either as a self-customization project or as a Kaltura professional services project.
Please look for information on self-customization at the KSE project documentation [22] and Kaltura-Drupal forum [23], or contact Kaltura’s sales team [13] to issue a professional services request.

Implementation steps

On both cases you will obtain a new UIConf ID for the customized Editor. For using this UIConf ID to replace drupal’s default Standard Editor, please follow the following steps:

  1. Go to kaltura_client/kaltura_settings.php and find the definition of the KalturaSettings_SE_UICONF_ID constant.
  2. Replace the current value of KalturaSettings_SE_UICONF_ID with the new customized UIConf ID by changing the following line from:
    define [24]('KalturaSettings_SE_UICONF_ID', 603);
    to:
    define [24]('KalturaSettings_SE_UICONF_ID', Your customized UIConf ID);

How to use the same player in two different sizes!

Edit Entry Player Broken [25]

Overview

The module allows you to set the default size for Media Node and Remix Node.
In case you want to display players in different sizes for the same node type, you have to do it through template.php theme override or in the relevant .tpl file.

Implementation

Using template.php:

Assuming your theme is called "mytheme", you can implement an override function that returns the rendered HTML for a certain item.
For this example, I'll assume that we need to set different sizes for Media Node.
- First, we will declare the function in template.php file:

function mytheme_node_kaltura_entry_entryId($node, $teaser);

- This function should return a kaltura special tag of the following structure:

[kaltura-widget media_type="$node->kaltura_media_type" entry="$node->kaltura_entryId" width="???" height="???" /]

You should set the width/height according to the context.
Recommended – look at the original function (in this case, in plugins/node_kaltura_entry/node_kaltura_entry.module), you might want to copy most of the code and add your own changes where needed.

Using .tpl file:

Assuming you have template file for Media node type, with the name of node-kaltura_entry.tpl.php
This function can include the HTML that will be displayed when rendering a Kaltura media node.
In the same manner as the first method described above, you should create the kaltura special tag with the wanted values,
Than call kaltura_replace_tags() function, passing it a string variable that contains the special tag.

In both methods, the tag will be replaced with the embed code with the wanted size.

Copyright © 2012 Kaltura Inc.
All Rights Reserved. Designated trademarks and brands are the property of their respective owners.
Use of this web site constitutes acceptance of the Terms of Use and Privacy Policy.

Kaltura.Org developer community site is powered by Drupal Stop Spam! Use Mollom. Creative Commons License Kaltura - Open Source Online Video Platform EduVideo.org

Source URL: http://www.kaltura.org/drupal-kaltura-module-all-one-video-module

Links:
[1] http://http://pramcenter.net
[2] http://www.kaltura.com/lib/pdf/KMC_Quick_Start_Guide.pdf
[3] http://www.kaltura.org/screenshot774-2009-06-01-075918jpg
[4] http://www.kaltura.org/project/kalturaCE
[5] http://www.kaltura.org/faq-all-one-video-module-please-read-first
[6] http://www.kaltura.org/how-use-more-one-uploader-kcw-your-drupal
[7] http://www.kaltura.org/how-remove-add-interactive-video-option-drupal-kcw
[8] http://www.kaltura.org/how-customize-drupal-contributor-wizard
[9] http://www.kaltura.org/how-change-terms-use-link-drupal-contributor-wizard
[10] http://corp.kaltura.com/tandc
[11] http://www.kaltura.org/kcw-contribution-wizard
[12] http://www.kaltura.org/forums/client-side-and-widgets/kcw-contribution-wizard
[13] http://corp.kaltura.com/about/contact
[14] http://www.kaltura.org/project/kcw
[15] http://december.com/html/4/element/ul.html
[16] http://december.com/html/4/element/li.html
[17] http://december.com/html/4/element/a.html
[18] http://www.php.net/isset
[19] http://www.kaltura.com/index.php/kmc
[20] http://www.php.net/array
[21] http://www.kaltura.org/kdp-dynamic-player-and-playlist-widget
[22] http://www.kaltura.org/kse-simple-editor
[23] http://www.kaltura.org/forums/applications-and-cms-extensions/drupal-kaltura-module-all-one-video-module-forums
[24] http://www.php.net/define
[25] http://www.kaltura.org/edit-entry-player-broken