You are here

function brightcove_add_playlist in Brightcove Video Connect 7.4

Same name and namespace in other branches
  1. 7.3 brightcove.module \brightcove_add_playlist()
  2. 7.5 brightcove.module \brightcove_add_playlist()

Wrapper function around playlist save.

Parameters

$metadata:

Return value

bool|string

2 calls to brightcove_add_playlist()
brightcove_playlist_edit_form_submit in ./brightcove.playlist.inc
brightcove_playlist_edit_form submit handler.
_brightcove_create_form_callback in ./brightcove.module
Create the new playlist.

File

./brightcove.module, line 245
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function brightcove_add_playlist($metadata) {
  $playlist_id = FALSE;
  $bc = brightcove_initialize();
  try {
    $playlist_id = $bc
      ->createPlaylist('video', $metadata);
  } catch (Exception $error) {
    drupal_set_message(t('Playlist upload to Brightcove failed. Error: @error', array(
      '@error' => $error,
    )), 'error');
    return FALSE;
  }

  // Invalidate playlist cache.
  brightcove_invalidate_cache('brightcove:playlist:list', TRUE);
  return $playlist_id;
}