public function MediaSoundCloudStreamWrapper::getOEmbed in Media: SoundCloud 7        
                          
                  
                        
1 call to MediaSoundCloudStreamWrapper::getOEmbed()
  - MediaSoundCloudStreamWrapper::getOriginalThumbnailPath in includes/MediaSoundCloudStreamWrapper.inc
 
  
 
File
 
   - includes/MediaSoundCloudStreamWrapper.inc, line 83
 
  - Create a SoundCloud Stream Wrapper class for the Media/Resource module.
 
  Class
  
  - MediaSoundCloudStreamWrapper 
 
  - Create an instance like this:
$soundcloud = new ResourceSoundCloudStreamWrapper('soundcloud://u/[user-name]/a/[audio-code]');
 
Code
public function getOEmbed($url, $options = array()) {
  
  $oembed_parameters = array_merge(array(
    'url' => $url,
    'format' => 'json',
  ), $options);
  $oembed_url = url('http://soundcloud.com/oembed', array(
    'query' => $oembed_parameters,
  ));
  
  $response = drupal_http_request($oembed_url);
  
  if (!isset($response->error)) {
    return drupal_json_decode($response->data);
  }
  else {
    $error_msg = t("Error Embedding SoundCloud Media '@file'. Error code(@code) : !message", array(
      '@file' => $url,
      '@code' => $response->code,
      '!message' => $response->status_message,
    ));
    
    watchdog('Media Soundcloud', $error_msg, NULL, WATCHDOG_WARNING);
    
    if (user_access('edit media')) {
      drupal_set_message($error_msg, "error", FALSE);
      drupal_set_message(t('Please check sharing permissions'), 'error', FALSE);
    }
  }
}