Kaltura-drupal-module

From Kaltura Wiki

Jump to: navigation, search

Contents

[edit] Requirements

  • To use the views plugin, you must have views module installed and enabled

[edit] module behavior

In case your site is not accessible from the web, the following features will not work:

  1. get real time updates of entries from kaltura server

In the module settings page, you can choose to always display player (even if entry is not ready).

In case your site is not accessible, you can rely on the cron job to update the status of entries (not real-time update), and choose to

display a text warning while the entry is not ready.

You can also provide the text to display in case the entry is not ready.

[edit] cron job

The module implements hook_cron, which at cron run it updates some data from kaltura server, for each entry.

Most of the data is the item's statistics, and is valuable for some of the views provided with the module

We recommend that you configure a cron job for your drupal site (if you didn't do so yet).

Remember that cron jobs are also valuable for site indexing and not just for kaltura updates.

  • Retrieves a list of all kaltura nodes which are published (from local Drupal DB)
  • Fetches the same list of entries found in (1) from Kaltura
  • Updates the local DB with the following fields:
    • Kaltura Status (the Kaltura status of the entry)
    • Views
    • Plays
    • Rank
    • Total_rank
    • Duration
    • Votes
    • Thumbnail_url

[edit] Module Structure

[edit] Kaltura:core

File Name kaltura.module
Description Brings general kaltura functionality into drupal, including registration form in module's settings page.

The module exposes 2 hooks: hook_notification_handler(), hook_use_uiconf()

Notes

[edit] Kaltura:node type Media Remix

File Name node_kaltura_mix.module
Description Adds a new content type "mix"

When creating new node, user should enter title (drupal mandatory field), tags and admin tags (optional).

The mix is created using Kaltura API call, and a node is created in drupal according to the API call result.

The user, then, gets the contribution wizard where he can add media to the mix.

Each media item is saved as an "entry node".

Notes

[edit] Kaltura:node type Media

File Name node_kaltura_entry.module
Description Adds a new content type "entry"

When user goes to create a new node he gets the contribution wizard which allows him to create multiple nodes at once

by uploading files or importing from other sources.

When the CW gets the response from the addEntry service, it sends notification to drupal for each entry that was added.

The notification handler (implemented in the kaltura core module) gets the notifications and creates entry nodes according to the data in each notification.

Notes

[edit] Kaltura:views

File Name kaltura_views.module
Description Provide integration to "views" module.

Enable the use of all kaltura fields in the "views" module and provide the following default views:

  1. Recently uploaded videos
  2. Recently uploaded photos
  3. My Kaltura Media
  4. Most popular videos
  5. Most popular photos
Notes

[edit] Kaltura:comments

File Name kaltura_comments.module
Description Provides integration with Drupal comments system.

Allow users to add video to their comments using the Kaltura CW webcam recorder.

Notes

[edit] Kaltura:field

File Name field_kaltura.module
Description Adds 2 filed types to CCK field list:
  • Kaltura Media - a field that enables you to add media to a node.
    • Because the current CW does not support "single contribution per flow" limit, this field is "multiple values" in it's nature.
  • Kaltura Media Remix - a field that enables you to add a video remix to a node.
    • this filed uses the basic CCK muliple values handler.
Notes

[edit] Kaltura:playlist

File Name kaltura_playlist.module
Description The playlist plugin adds a new content type "kaltura playlist"

The Playlist node is an easy way to select on of your existing Kaltura views, and display that view as a playlist.

See example here

Notes To have your view listed in the list of views (when creating new node), you must include the "Kaltura Media ID" field in the list of fields in the default display of the view.

The "Kaltura Media ID" field can be excluded from display.

[edit] Available Hooks

[edit] kaltura_notification_handler

Notification Handler is a URL in the drupal system, defined by kaltura module, which handles notification from kaltura server/widgets and updates data in drupal DB received from the notification.

If you implement a hook called mymodule_kaltura_notification_handler in your module, your function will be called when notification is received, and you can use the data parameter to handle with the notification yourself.

[edit] kaltura_use_uiconf

If you implement a hook called mymodule_kaltura_use_uiconf in your module, your function will be called when selecting a player widget to display an entry,

and you can return a different uiconf ID according to the data parameter, which holds the current type being played (entry/mix/roughcut) and the current user's permissions.

Note that you can override uiconf selection using theme functions as well. The hook_use_uiconf is more powerful and if you declare a theme function to override

a uiconf, and then you implement the hook, the hook return value will be the uiconf in use and not the theme uiconf.

[edit] kaltura_cw_destination

When creating Kaltura Media nodes, after adding all media in the CW, the CW redirects the user to a specific page defined by the Kaltura module.

If you wish to redirect the user to another page, implement a hook called mymodule_kaltura_cw_destination and return a string that specifies the destination (relative) url.

The returned URL should be relative to your drupal site. the Kaltura module uses the Drupal url() function to reconstruct the full URL.

[edit] kaltura_playlist_format_value

The kaltura_playlist module invokes the hook_format_value

This hook can be used by your module to re-format values of view fields before they are added to the playlist HTML.

The function is called with 2 variables:

  • attribute - the full name of the field (TABLENAME_FIELDNAME, e.g node_kaltura_kaltura_duration)
  • value

The function should return the new value (as string)

[edit] Theme Override

Assuming your are working with phptemplate engine, you can override every theme function implemented in kaltura module by defining a new function in your template.php.

For example: if you would like to change the way mix tags are being displayed, you can copy the function theme_node_kaltura_mix_tags to your template.php file,

change the word theme to the name of your theme (e.g red_node_kaltura_mix_tags), and change the contents to fit your needs.

  1. theme_node_kaltura_mix_entryId (File: node_kaltura_mix.module)
  2. theme_node_kaltura_mix_admin_tags (File: node_kaltura_mix.module)
  3. theme_node_kaltura_mix_tags (File: node_kaltura_mix.module)
  4. theme_node_kaltura_entry_entryId (File: node_kaltura_entry.module)
  5. theme_node_kaltura_entry_admin_tags (File: node_kaltura_entry.module)
  6. theme_node_kaltura_entry_tags (File: node_kaltura_entry.module)
  7. theme_node_kaltura_entry_thumbnail_url (File: node_kaltura_entry.module)

[edit] theme entryId field

The entryId is themed into a "kaltura tag" which is being replaced on runtime with the correct embed code.

If you override a theme function of entryId, you need to return a "kaltura tag" of the following syntax:

[kaltura-widget parameter1="value1" parameter2="value2" (...) /]

Available parameters and values:

parameter values Notes
entry/kid/mix $node->entryId entry should be specified in theme_node_kaltura_entry_entryId

kid should be specified in theme_node_kaltura_mix_entryId in case KShow is used

mix should be specified in theme_node_kaltura_mix_entryId in case RoughCut is used

size large/small
wid widgetId In case you want to use a kaltura widget of your own
align l/m/r l for left, m for center, r for right
custom_style CSS definitions to place in style attribute

values must not contain any spaces or double apostrophes

Example: (php code)

function mytheme_node_kaltura_entry_entryId($node) {
   return '[kaltura-widget entry="'. $node->entryId .'" align="m" size="small"'.
          'custom_style="border-width:1px;border-color:red;border-style:dashed;padding:3px;" /]';
 }

[edit] Taxonomy Integration

The Kaltura nodes (Media node / Remix node) can integrate with up to 2 vocabularies each – one vocabulary for regular tags and another for admin tags. You can set both regular and admin tags to integrate to the same vocabulary if you want. You can also set both Media node and Remix node to integrate to the same vocabulary if you want. This is done through the module's configuration pages ( administration -> site configuration -> Kaltura -> Media node settings / Remix node settings ).

[edit] adding additional taxonomy to the Kaltura video nodes

You can add vocabularies to the content type in the traditional Drupal taxonomy way, and so having more than one vocabulary for each content type, however, only the vocabularies that are set in the module's settings pages will reflect in Kaltura's servers. In that manner, you can have your site wide tax to be applied on "Kaltura Media node" as well, but the terms in this vocabulary will not be saved as the entry tags in Kaltura and will be valuable only in the local Drupal DB.

Programmatically, there should not be a problem having all vocabularies populated into the tags field, but some issues should then be addressed (like term duplication between vocabularies etc…)

[edit] Basic Usage

  1. Install the module
  2. Go to admin/settings/kaltura/general
    1. register (or enter your partner details if you have one)
  3. Start creating kaltura content

[edit] Advanced Usage

Depends on how good you know drupal, you can use the kaltura module to enhance existing content in your drupal site.

A few ways we can think of:

  • Using CCK - create new content types that contains kaltura items as node reference
  • Using your own module and kaltura module, create your own content type with the fields/behavior you need
Personal tools