function video_filter_rutube in Video Filter 7.3
Callback for Rutube codec.
See also
1 string reference to 'video_filter_rutube'
- video_filter_codec_info in ./
video_filter.codecs.inc - Implements hook_codec_info().
File
- ./
video_filter.codecs.inc, line 799 - This file contains all codecs provided by Video Filter.
Code
function video_filter_rutube($video) {
$attributes = array(
'skinColor' => isset($video['skinColor']) && !empty($video['standardColor']) ? 'skinColor=' . (string) $video['skinColor'] : '',
'sTitle' => isset($video['sTitle']) && $video['sTitle'] == 1 ? 'sTitle=true' : 'sTitle=false',
'sAuthor' => isset($video['sAuthor']) && $video['sAuthor'] == 1 ? 'sAuthor=true' : 'sAuthor=false',
'bmstart' => isset($video['bmstart']) && $video['bmstart'] > 1 ? 'bmstart=' . (int) $video['bmstart'] : 'bmstart=false',
);
$endpoint = '//rutube.ru/api/oembed';
$options = array(
'url' => $video['source'],
'format' => 'json',
);
$data = video_filter_oembed_request($endpoint, $options);
if (!empty($data['html'])) {
if (preg_match('/src="([^"]+)"/', $data['html'], $match)) {
$video['source'] = $match[1] . '?' . implode('&', $attributes);
return video_filter_iframe($video);
}
}
}