Friday, February 22, 2013

Listing current user uploaded brightcove videos in drupal

If you want to list current user uploaded video in drupal, use below code.
Drupal brightcove module provides an option to store the Drupal username of the user who uploaded a video. You need to create this field(custom field) in brightcove before using this feature. Click here to understand how to create cutsom field in BC Studio.


Goto drupal brightcove configuration page and add this field name in "Brightcove Drupal User Custom Field" field. Brightcove module automatically update drupal username in brightcove while uploading new video into video cloud. The below function will fetch all the videos which uploaded by the user.


function video_list(){
  global $user;
 
  // Define our parameters
  $params = array();
  $user_field = variable_get('brightcove_user_field', '');
  // Set our search terms
  $terms = array(
    'all' => $user_field .':'. $user->name
  );
  
  // Make our API call 
  $videos = $bc->search('video', $terms, $params);
  // $videos contains all video which uploaded by the current user
  //write your code for display the result
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Maintained by Web Themes