diff --git a/includes/media_youtube.admin.inc b/includes/media_youtube.admin.inc
index 30a7119..2317657 100644
--- a/includes/media_youtube.admin.inc
+++ b/includes/media_youtube.admin.inc
@@ -105,6 +105,12 @@ function media_youtube_admin_form() {
'#default_value' => media_youtube_variable_get('full_screen'),
'#description' => t('Allow users to view video using the entire computer screen.'),
);
+ $form['player']['player_options'][media_youtube_variable_name('autohide')] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Auto hide controls'),
+ '#default_value' => media_youtube_variable_get('autohide'),
+ '#description' => t('Hides the player controls.'),
+ );
$form['player']['player_options'][media_youtube_variable_name('high_quality')] = array(
'#type' => 'checkbox',
'#title' => t('Use YouTube high quality content'),
diff --git a/includes/media_youtube.variables.inc b/includes/media_youtube.variables.inc
index ea74999..c07aeee 100644
--- a/includes/media_youtube.variables.inc
+++ b/includes/media_youtube.variables.inc
@@ -151,6 +151,7 @@ function media_youtube_variable_default($name = NULL) {
'colors_color1' => MEDIA_YOUTUBE_COLOR1_DEFAULT,
'colors_color2' => MEDIA_YOUTUBE_COLOR2_DEFAULT,
'full_screen' => 1,
+ 'autohide' => 0,
'high_quality' => FALSE,
'display_info' => FALSE,
'enablejsapi' => TRUE,
diff --git a/themes/media-youtube-default-external.tpl.php b/themes/media-youtube-default-external.tpl.php
index 3442ab9..b5bf82c 100644
--- a/themes/media-youtube-default-external.tpl.php
+++ b/themes/media-youtube-default-external.tpl.php
@@ -18,6 +18,7 @@
+
diff --git a/themes/media-youtube-html5.tpl.php b/themes/media-youtube-html5.tpl.php
index 93b5c45..67f6e99 100644
--- a/themes/media-youtube-html5.tpl.php
+++ b/themes/media-youtube-html5.tpl.php
@@ -10,4 +10,4 @@
*
*/
?>
-
+
diff --git a/themes/media_youtube.theme.inc b/themes/media_youtube.theme.inc
index 02b2801..7b61d7e 100644
--- a/themes/media_youtube.theme.inc
+++ b/themes/media_youtube.theme.inc
@@ -33,13 +33,16 @@ function theme_media_youtube_video_upload_failed($message, $status = array()) {
function template_preprocess_media_youtube_html5(&$variables) {
// Merge in our default variables.
$variables = array_merge($variables, $variables['variables']);
-
+
+ $autohide = isset($variables['autohide']) ? $variables['autohide'] : media_youtube_variable_get('autohide');
+
$video_id = $variables['video_id'];
$variables['url'] = isset($variables['url']) ? $variables['url'] : "http://www.youtube.com/v/$video_id";
$variables['url'] = check_plain($variables['url']);
$variables['width'] = check_plain($variables['width']);
$variables['height'] = check_plain($variables['height']);
$variables['fullscreen_value'] = check_plain($variables['fullscreen_value']);
+ $variables['autohide_value'] = check_plain($autohide);
$variables['iframe_title'] = isset($variables['iframe_title']) ? check_plain($variables['iframe_title']) : t('@title', array('@title' => media_youtube_variable_get('iframe_title')));
$variables['classes'] = isset($variables['classes']) ? $variables['classes'] : array('media-youtube-html5');
$variables['class'] = check_plain(implode(' ', $variables['classes']));
@@ -56,6 +59,7 @@ function template_preprocess_media_youtube_default_external(&$variables) {
$variables['width'] = check_plain($variables['width']);
$variables['height'] = check_plain($variables['height']);
$variables['fullscreen_value'] = check_plain($variables['fullscreen_value']);
+ $variables['autohide_value'] = check_plain($variables['autohide_value']);
$variables['thumbnail'] = isset($variables['thumbnail']) ? $variables['thumbnail'] : theme('emvideo_video_thumbnail', $variables['field'], array('value' => $video_id, 'provider' => 'youtube'), 'thumbnail', $variables['node'], FALSE, array('width' => $variables['width'], 'height' => $variables['height'], 'link_url' => media_youtube_video_url($video_id)));
}
@@ -124,6 +128,11 @@ function template_preprocess_media_youtube_flash(&$variables) {
$fullscreen = isset($variables['fullscreen']) ? $variables['fullscreen'] : media_youtube_variable_get('full_screen');
$fullscreen_value = $fullscreen ? "true" : "false";
$fs = $fullscreen ? "&fs=$fullscreen" : "";
+
+ // Set the Auto Hide option; if TRUE, then allow it.
+ $autohide = isset($variables['autohide']) ? $variables['autohide'] : media_youtube_variable_get('autohide');
+ $autohide_value = $autohide ? "1" : "0";
+ $ah = $autohide ? "&autohide=$autohide" : "";
// Set the 'related videos' youtube option.
$related = isset($variables['related']) ? $variables['related'] : media_youtube_variable_get('show_related_videos');
@@ -164,12 +173,12 @@ function template_preprocess_media_youtube_flash(&$variables) {
// Create a URL from our options.
if ($variables['item']['data']['playlist']) {
$video_id = substr($video_id, 9);
- $url = check_plain("http://www.youtube.com/p/$video_id&$related$autoplay_value$colors$border$high_quality$display_info$enablejsapi$fs");
+ $url = check_plain("http://www.youtube.com/p/$video_id&$related$autoplay_value$colors$border$high_quality$display_info$enablejsapi$fs$ah");
// FLV Player doesn't support playlists, so we need to fall back.
$variables['use_flv'] = FALSE;
}
else {
- $url = check_plain("http://www.youtube.com/v/$video_id&$related$autoplay_value$colors$border$high_quality$display_info$enablejsapi$fs");
+ $url = check_plain("http://www.youtube.com/v/$video_id&$related$autoplay_value$colors$border$high_quality$display_info$enablejsapi$fs$ah");
}
// Find the path to the JW FLV Media Player.
@@ -214,6 +223,7 @@ function template_preprocess_media_youtube_flash(&$variables) {
$params['height'] = $height;
$params['div_id'] = $id;
$params['allowFullScreen'] = $fullscreen_value;
+ $params['autohide'] = $autohide_value;
// If we have been told to use a specific FLV Player Option from
// that module, then use it here.
@@ -225,6 +235,7 @@ function template_preprocess_media_youtube_flash(&$variables) {
$data['params']['height'] = $height;
$data['flashvars']['autostart'] = $flashvars['autostart'];
$data['params']['allowFullScreen'] = $fullscreen_value;
+ $data['params']['autohide'] = $autohide_value;
$data['params']['wmode'] = 'transparent';
$data['flashvars']['image'] = $flashvars['image'];
$output = theme('flvmediaplayer_render_player', $url, $data['params'], $data['flashvars']);
@@ -242,6 +253,7 @@ function template_preprocess_media_youtube_flash(&$variables) {
$params['height'] = $height;
$params['div_id'] = $id;
$params['allowFullScreen'] = $fullscreen_value;
+ $params['autohide'] = $autohide_value;
$params['wmode'] = 'transparent';
$output = theme('emfield_swfobject', $url, $params, $flashvars, $id);
}
@@ -256,12 +268,12 @@ function template_preprocess_media_youtube_flash(&$variables) {
// Use object tags rather than embed.
// See http://www.alistapart.com/articles/flashsatay
$output = <<
+
FLV;
}
else {
// The fallback is to display plain old vanilla youtube.
- $output = theme('media_youtube_default_external', array('field' => $variables['field'], 'node' => $variables['node'], 'video_id' => $video_id, 'width' => $width, 'height' => $height, 'url' => $url, 'fullscreen_value' => $fullscreen_value, 'thumbnail' => $variables['thumbnail']));
+ $output = theme('media_youtube_default_external', array('field' => $variables['field'], 'node' => $variables['node'], 'video_id' => $video_id, 'width' => $width, 'height' => $height, 'url' => $url, 'fullscreen_value' => $fullscreen_value, 'autohide_value' => $autohide_value, 'thumbnail' => $variables['thumbnail']));
}
}
$variables['class'] = isset($variables['class']) ? $variables['class'] : array('media-youtube');