There is a problem after upload a video:
The BC field get bad value after upload. The following rows include the source of this bad behavior in brightcove_field.module file at the line of 1528:

$id = brightcove_upload_video(drupal_realpath($file->uri), $meta);

if ($id) {
  // Construct Video object with ID - we need to cache it and save to
  // session. Brightcove Media API doesn't clear it's cache when a new
  // video is uploaded, therefore the node save would fail.
  $video = new StdClass;
  $video->id = $id;
  foreach ($meta as $id => $data) {
    $video->$id = $data;
  }

In this case, the $id is overwritten by the $meta array's key. If use another variable in foreach, the problem will be solved:

    $id = brightcove_upload_video(drupal_realpath($file->uri), $meta);

    if ($id) {
      // Construct Video object with ID - we need to cache it and save to
      // session. Brightcove Media API doesn't clear it's cache when a new
      // video is uploaded, therefore the node save would fail.
      $video = new StdClass;
      $video->id = $id;
      foreach ($meta as $key => $data) {
        $video->$key = $data;
      }

There is another problem when set the cache. Always save a FALSE value instead of the video object in brightcove_field.module at line 1541:

// invalidating brightcove video load cache
cache_set("bc:video:{$id}", FALSE, 'cache');

This should be the following:

 // invalidating brightcove video load cache
 cache_set("bc:video:{$id}", $video, 'cache');

Comments

Coornail’s picture

Status: Active » Closed (duplicate)

Hey,

Thanks, the fix for overwriting the $id is commited in: http://drupalcode.org/project/brightcove.git/commit/3f630c7, discussed in http://drupal.org/node/1566172 .

The caching is not an issue, since the mentioned lines doesn't want to populate the cache, it only invalidates it.