You are here

function emvideo_myspace_data in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emvideo/providers/myspace.inc \emvideo_myspace_data()

hook emvideo_PROVIDER_data

Provides an array to be serialised and made available with $item elsewhere.

This data can be used to store any extraneous information available specifically to the 8tracks provider.

1 call to emvideo_myspace_data()
emvideo_myspace_duration in contrib/emvideo/providers/myspace.inc
hook emvideo_PROVIDER_duration($item) Returns the duration of the video in seconds.

File

contrib/emvideo/providers/myspace.inc, line 48
This include processes myspace.com media files for use by emfield.module.

Code

function emvideo_myspace_data($field, $item) {

  // Initialize the data array.
  $data = array();

  // We are using oEmbed to retrieve a standard set of data from the provider.
  // You should change the URL as specified by the 8tracks provider.
  // If the 8tracks provider does not support oEmbed, you must remove this
  // section entirely, or rewrite it to use their API.
  // See http://oembed.com/ for for information.
  $data = emfield_request_xml('Myspace', 'http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=' . $item['value'], array(), TRUE, FALSE, $item['value']);

  // Create some version control. Thus if we make changes to the data array
  // down the road, we can respect older content. If allowed by Embedded Media
  // Field, any older content will automatically update this array as needed.
  // In any case, you should account for the version if you increment it.
  $data['emvideo_data_version'] = $data['emvideo_myspace_version'] = EMVIDEO_MYSPACE_DATA_VERSION;
  $data['emvideo_myspace_thumbnail'] = $data['ITEM']['MEDIA:THUMBNAIL'][1]['URL'];

  // This stores a URL to the video's thumbnail.
  return $data;
}