the translated name of the provider
* 'url' => the url to the main page for the provider
* 'settings_description' => a description of the provider that will be posted in the admin settings form
* 'supported_features' => an array of rows describing the state of certain supported features by the provider.
* These will be rendered in a table, with the columns being 'Feature', 'Supported', 'Notes'.
*/
function video_cck_overstream_info() {
$name = t('Overstream');
$features = array(
array(t('Autoplay'), t('Yes'), ''),
array(t('RSS Attachment'), t('No'), ''),
array(t('Thumbnails'), t('No'), t('Overstream uses the original providers thumbnail - this is not available via the overstream URL')),
);
return array(
'provider' => 'overstream',
'name' => $name,
'url' => VIDEO_CCK_OVERSTREAM_MAIN_URL,
'settings_description' => t('These settings specifically affect videos displayed from !overstream. You can learn more about its !api here.', array('!overstream' => l($name, VIDEO_CCK_OVERSTREAM_MAIN_URL, array('target' => '_blank')), '!api' => l(t('API'), VIDEO_CCK_OVERSTREAM_API_INFO, array('target' => '_blank')))),
'supported_features' => $features,
);
}
/**
* hook video_cck_PROVIDER_settings
* this should return a subform to be added to the video_cck_settings() admin settings page.
* note that a form field will already be provided, at $form['PROVIDER'] (such as $form['youtube'])
* so if you want specific provider settings within that field, you can add the elements to that form field.
*/
// not used
/**
* hook video_cck_PROVIDER_extract
* this is called to extract the video code from a pasted URL or embed code.
* @param $embed
* an optional string with the pasted URL or embed code
* @return
* either an array of regex expressions to be tested, or a string with the video code to be used
* if the hook tests the code itself, it should return either the string of the video code (if matched), or an empty array.
* otherwise, the calling function will handle testing the embed code against each regex string in the returned array.
*/
function video_cck_overstream_extract($embed = '') {
// http://www.overstream.net/view.php?oid=mwm8u8eytyln
//http://overstream.net/swf/player/oplx?oid=mwm8u8eytyln&noplay
return array(
'@overstream\.net/view\.php\?oid=([^"\&]+)@i',
'@overstream\.net/swf/player/oplx\?oid=([^"\&]+)@i',
);
}
/**
* hook video_cck_PROVIDER_embedded_link($video_code)
* returns a link to view the video at the provider's site
* @param $video_code
* the string containing the video to watch
* @return
* a string containing the URL to view the video at the original provider's site
*/
function video_cck_overstream_embedded_link($video_code) {
return 'http://www.overstream.net/view.php?oid=' . $video_code;
}
/**
* the embedded flash displaying the overstream - modify this it's not standard's compliant!
*/
function theme_video_cck_overstream_flash($embed, $width, $height, $autoplay, $options = array()) {
static $count;
if ($embed) {
$autoplay = isset($options['autoplay']) ? $options['autoplay'] : $autoplay;
$autoplay_value = $autoplay ? '' : '&noplay=1';
$allowScriptAcess = $enablejsapi ? 'always' : 'sameDomain';
$id = isset($options['id']) ? $options['id'] : 'video-cck-overstream-flash-'. (++$count);
$div_id = isset($options['div_id']) ? $options['div_id'] : 'video-cck-overstream-flash-wrapper-'. $count;
$url = "http://www.overstream.net/swf/player/oplx?oid=$embed$autoplay_value";
if (variable_get('emfield_swfobject', FALSE) && (module_exists('swfobject_api') || variable_get('emfield_swfobject_location', ''))) {
if (module_exists('swfobject_api')) {
$params['width'] = $width;
$params['height'] = $height;
$params['div_id'] = $id;
$output .= theme('swfobject_api', $url, $params, $vars, $id);
}
else {
drupal_add_js(variable_get('emfield_swfobject_location', ''));
$output .= <<
Sorry, you need to install flash to see this content.
FLASH;
}
}
else {
$output .= <<
FLASH;
}
}
return $output;
}
/**
function theme_video_cck_overstream_flash($embed, $width, $height, $autoplay) {
if ($embed) {
$autoplay_value = 'noplay=1';
if ($autoplay) {
$autoplay_value = '';
}
$output .= " \n";
}
return $output;
}
/**
*/
/**
* hook video_cck_PROVIDER_video
* this actually displays the full/normal-sized video we want, usually on the default page view
* @param $embed
* the video code for the video to embed
* @param $width
* the width to display the video
* @param $height
* the height to display the video
* @param $field
* the field info from the requesting node
* @param $item
* the actual content from the field
* @return
* the html of the embedded video
*/
function video_cck_overstream_video($embed, $width, $height, $field, $item, $autoplay) {
$output = theme('video_cck_overstream_flash', $embed, $width, $height, $autoplay);
return $output;
}
/**
* hook video_cck_PROVIDER_video
* this actually displays the preview-sized video we want, commonly for the teaser
* @param $embed
* the video code for the video to embed
* @param $width
* the width to display the video
* @param $height
* the height to display the video
* @param $field
* the field info from the requesting node
* @param $item
* the actual content from the field
* @return
* the html of the embedded video
*/
function video_cck_overstream_preview($embed, $width, $height, $field, $item, $autoplay) {
$output = theme('video_cck_overstream_flash', $embed, $width, $height, $autoplay);
return $output;
}