function video_cck_youtube_data in Embedded Media Field 5
hook emfield_PROVIDER_data
provides an array to be serialised and made available with $item elsewhere
1 call to video_cck_youtube_data()
- video_cck_youtube_rss in contrib/
video_cck/ providers/ youtube.inc
File
- contrib/
video_cck/ providers/ youtube.inc, line 154
Code
function video_cck_youtube_data($field, $item) {
$data = array();
// create some 'field' version control
$data['video_cck_youtube_version'] = 1;
// be nice to make this an array for changing media:thumbnail?
$data['thumbnail']['url'] = 'http://img.youtube.com/vi/' . $item['value'] . '/0.jpg';
// gather info about the item
// RSS / MRSS feeds with the item would have enough info
// alternative try getting the minimum from an http get
$url = 'http://youtube.com/v/' . $item['value'];
$response = emfield_request_header('youtube', $url);
if ($response->code == 200) {
// probably shouldn't give the 303 path
$data['flash']['url'] = $url;
$data['flash']['size'] = $response->headers['Content-Length'];
$data['flash']['mime'] = $response->headers['Content-Type'];
}
return $data;
}