function theme_emvideo_zzz_custom_url_embedded_video in Embedded Media Field 6
Same name and namespace in other branches
- 6.3 contrib/emvideo/providers/zzz_custom_url.inc \theme_emvideo_zzz_custom_url_embedded_video()
2 theme calls to theme_emvideo_zzz_custom_url_embedded_video()
- emvideo_zzz_custom_url_preview in contrib/emvideo/providers/zzz_custom_url.inc
- emvideo_zzz_custom_url_video in contrib/emvideo/providers/zzz_custom_url.inc
File
- contrib/emvideo/providers/zzz_custom_url.inc, line 117
- This is an include file used by emfield.module.
Code
function theme_emvideo_zzz_custom_url_embedded_video($type, $url, $width, $height, $autoplay = FALSE, $field = NULL, $item = NULL, $options = array()) {
if (!valid_url($url, TRUE) && !valid_url($url)) {
return '';
}
if ($url = url($url, array(
'external' => TRUE,
'absolute' => TRUE,
))) {
global $base_path;
$url = $base_path . $url;
if (module_exists('flowplayer')) {
$config = array(
'clip' => array(
'autoPlay' => $autoplay,
'url' => $url,
),
);
$attributes = array(
'style' => "width:{$width}px;height:{$height}px;",
);
$tn_options = array(
'width' => $width,
'height' => $height,
);
$thumbnail = '<span></span>' . theme('emvideo_video_thumbnail', NULL, $item, 'emvideo_thumbnail', $options['node'], TRUE, $tn_options);
drupal_add_css(drupal_get_path('module', 'emvideo') . '/emvideo.custom-url.css');
return theme('flowplayer', $config, 'emvideo-zzz-custom-url-embedded-video', $attributes, $thumbnail);
}
$path = emfield_flvmediaplayer_url();
$use_flv = isset($options['use_flv']) ? $options['use_flv'] : variable_get('emvideo_zzz_custom_url_use_jw_flv', TRUE);
if ($use_flv && ($flv_path = emfield_flvmediaplayer_url())) {
global $base_path;
$tn_options = array(
'width' => $width,
'height' => $height,
'return_url' => TRUE,
);
$flashvars = array();
$flashvars['image'] = theme('emvideo_video_thumbnail', NULL, $item, 'emvideo_thumbnail', $options['node'], FALSE, $tn_options);
$flashvars['file'] = $url;
$flashvars['autostart'] = $autoplay ? 'true' : 'false';
$url = $base_path . $flv_path;
}
else {
$use_flv = FALSE;
}
if ($use_flv && module_exists('flvmediaplayer')) {
$params['width'] = $width;
$params['height'] = $height;
$params['div_id'] = $id;
$params['allowFullScreen'] = $fullscreen_value;
$flv_profile = isset($options['flv_profile']) ? $options['flv_profile'] : variable_get('emfield_flv_profile', '');
if ($flv_profile) {
$data = flvmediaplayer_build_player_data($options['node'], $flv_profile, array(
'file' => $flashvars['file'],
));
$data['params']['width'] = $width;
$data['params']['height'] = $height;
$data['flashvars']['autostart'] = $flashvars['autostart'];
$data['params']['allowFullScreen'] = $fullscreen_value;
$data['flashvars']['image'] = $flashvars['image'];
$output = theme('flvmediaplayer_render_player', $url, $data['params'], $data['flashvars']);
}
else {
$output = theme('flvmediaplayer_render_player', $url, $params, $flashvars);
}
}
else {
if (variable_get('emfield_swfobject', FALSE) && (module_exists('swfobject_api') || variable_get('emfield_swfobject_location', ''))) {
$params['width'] = $width;
$params['height'] = $height;
$params['div_id'] = $id;
$params['allowFullScreen'] = $fullscreen_value;
$output = theme('emfield_swfobject', $url, $params, $flashvars, $id);
}
else {
if ($use_flv) {
$flashvars = drupal_query_string_encode($flashvars);
$output = <<<FLV
<div id="{<span class="php-variable">$div_id</span>}"><embed src="{<span class="php-variable">$url</span>}" width="{<span class="php-variable">$width</span>}" height="{<span class="php-variable">$height</span>}" allowscriptaccess="always" allowfullscreen="{<span class="php-variable">$fullscreen_value</span>}" flashvars="{<span class="php-variable">$flashvars</span>}" /></div>
FLV;
}
else {
switch ($type) {
case 'wmv':
case 'wma':
$autostart = $autoplay ? '1' : '0';
$output = '<embed src="' . $url . '" width="' . $width . '" height="' . $height . '" autostart="' . $autostart . '" showcontrols="1" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/"> </embed>';
break;
case 'mov':
case 'mp4':
case 'm4v':
$autostart = $autoplay ? 'true' : 'false';
$output = '<embed src="' . $url . '" width="' . $width . '" height="' . $height . '" autoplay="' . $autostart . '" controller="true" type="video/quicktime" scale="tofit" pluginspage="http://www.apple.com/quicktime/download/"> </embed>';
break;
case 'rm':
$autostart = $autoplay ? 'true' : 'false';
$output = '<embed type="audio/x-pn-realaudio-plugin" src="' . $url . '" width="' . $width . '" height="' . $height . '" autostart="' . $autostart . '" controls="imagewindow" nojava="true" console="c1183760810807" pluginspage="http://www.real.com/"></embed><br /><embed type="audio/x-pn-realaudio-plugin" src="' . $url . '" width="' . $width . '" height="26" autostart="' . $autostart . '" nojava="true" controls="ControlPanel" console="c1183760810807"> </embed>';
break;
case 'swf':
$output = '<embed src="' . $url . '" width="' . $width . '" height="' . $height . '" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
break;
case 'flv':
$autostart = $autoplay ? 'true' : 'false';
$output = '<embed src="http://freevideocoding.com/flvplayer.swf?file=' . $url . '&autoStart=' . $autostart . '" width="' . $width . '" height="' . $height . '" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
break;
}
}
}
}
return $output;
}
}