Showing posts with label Brightcove. Show all posts
Showing posts with label Brightcove. Show all posts

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
}

Wednesday, January 30, 2013

How to use brightcove video Search in drupal


Brightcove video cloud, a cloud based video hosting and publishing solution. Drupal is one of the most commonly used open source CMS.

To integrates brightcove video cloud into drupal, drupal community provides one module called Brightcove module. . Using this module you can add Brightcove video to your content and access the information from the Video Cloud in your site.
 In brightcove module they are using Brightcove Media API and this APi provides various methods to retrieve properties from brightcove video cloud. But this module is mainly focusing on find method. So here I am trying to explain how to use search method in drupal. Search method is also a simple function to retrieve properties and information from Brightcove.

To call search method we need to pass three arguments - method, terms and params.Using this method we can search custom fields from brightcove. Here I'm explaining how to search custom fields value from brightcove using search method.

Below code shows how to search for a video with "jobs" in the title AND tags.
 
// Define our parameters
$params = array(
    'video_fields' => 'id,name,shortDescription'
);

// Set our search terms
$terms = array(
    'all' => 'display_name:jobs,tag:jobs'
);
  
 // Make our API call 
$videos = $bc->search('video', $terms, $params);

 Below code will explain how to search video with custom fields. 
custom field name is drupal_user and this field is used for storing uploaded user name(Drupal Username) in brightcove.


// Define our parameters
$params = array(
    'video_fields' => 'id,name,shortDescription'
);

// Set our search terms
$terms = array(
    'all' => 'drupal_user:jobs'
);
  
 // Make our API call 
$videos = $bc->search('video', $terms, $params);



Twitter Delicious Facebook Digg Stumbleupon Favorites More

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