You are here

function video_filter_soundcloud in Video Filter 7.3

Callback for Soundcloud codec.

See also

video_filter_codec_info()

1 string reference to 'video_filter_soundcloud'
video_filter_codec_info in ./video_filter.codecs.inc
Implements hook_codec_info().

File

./video_filter.codecs.inc, line 836
This file contains all codecs provided by Video Filter.

Code

function video_filter_soundcloud($video) {
  $html =& drupal_static(__FUNCTION__);
  $id = $video['codec']['matches'][1] . '/' . $video['codec']['matches'][2];
  if ($cache = cache_get('video_filter_soundcloud:' . $id)) {
    $html = $cache->data;
  }
  else {
    $endpoint = 'http://soundcloud.com/oembed';
    $options = array(
      'url' => $video['source'],
      'format' => 'json',
    );
    $data = video_filter_oembed_request($endpoint, $options);
    if (!empty($data['html'])) {
      $html = $data['html'];
    }
    cache_set('video_filter_soundcloud:' . $id, $html, 'cache');
  }
  return $html;
}