diff --git a/css/media_youtube.css b/css/media_youtube.css deleted file mode 100644 index bb5407a..0000000 --- a/css/media_youtube.css +++ /dev/null @@ -1,21 +0,0 @@ - -.media-youtube-preview-wrapper { - max-width: 100%; - min-height: 50px; - position: relative; -} - -.media-youtube-preview-wrapper object, -.media-youtube-preview-wrapper iframe { - max-width: 100%; - position: relative; -} - -.media-youtube-preview-wrapper .js-fallback { - left: 0; - margin-top: -0.5em; - position: absolute; - right: 0; - text-align: center; - top: 50%; -} diff --git a/css/media_youtube.wysiwyg.css b/css/media_youtube.wysiwyg.css index 8dc32f9..27279de 100644 --- a/css/media_youtube.wysiwyg.css +++ b/css/media_youtube.wysiwyg.css @@ -2,6 +2,10 @@ /** * @file * Overlay for YouTube thumbnails in the media library browser. + * + * @TODO: Is this all for the Media Browser Providers logos? If so, + * they've been removed in latest Media dev and this file can be removed. + * */ #media-browser .styles-container-media_youtube { /* Relative wrapper for the overlay. */ diff --git a/includes/media_youtube.formatters.inc b/includes/media_youtube.formatters.inc index b08b016..0842a58 100644 --- a/includes/media_youtube.formatters.inc +++ b/includes/media_youtube.formatters.inc @@ -15,9 +15,11 @@ function media_youtube_file_formatter_info() { 'view callback' => 'media_youtube_file_formatter_video_view', 'settings callback' => 'media_youtube_file_formatter_video_settings', ); - foreach (array('width', 'height', 'autoplay', 'related', 'hd', 'showsearch', 'modestbranding', 'showinfo', 'version', 'theme', 'fullscreen', 'wmode', 'chromeless') as $setting) { + + foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'controls', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'rel', 'showinfo','theme') as $setting) { $formatters['media_youtube_video']['default settings'][$setting] = media_youtube_variable_get($setting); } + $formatters['media_youtube_image'] = array( 'label' => t('YouTube Preview Image'), 'file types' => array('video'), @@ -42,7 +44,8 @@ function media_youtube_file_formatter_video_view($file, $display, $langcode) { '#uri' => $file->uri, '#options' => array(), ); - foreach (array('width', 'height', 'autoplay', 'related', 'hd', 'showsearch', 'modestbranding', 'showinfo', 'version', 'theme', 'fullscreen', 'wmode', 'chromeless') as $setting) { + + foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'controls', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'rel', 'showinfo', 'theme') as $setting) { $element['#options'][$setting] = isset($file->override[$setting]) ? $file->override[$setting] : $display['settings'][$setting]; } return $element; @@ -54,26 +57,6 @@ function media_youtube_file_formatter_video_view($file, $display, $langcode) { */ function media_youtube_file_formatter_video_settings($form, &$form_state, $settings) { $element = array(); - $options = array( - 0 => t('AS2'), - 3 => t('AS3'), - ); - $element['version'] = array( - '#title' => t('YouTube player version'), - '#type' => 'select', - '#options' => $options, - '#default_value' => $settings['version'], - ); - $options = array( - 'dark' => t('dark'), - 'light' => t('light'), - ); - $element['theme'] = array( - '#title' => t('YouTube player theme'), - '#type' => 'select', - '#options' => $options, - '#default_value' => $settings['theme'], - ); $element['width'] = array( '#title' => t('Width'), @@ -85,46 +68,100 @@ function media_youtube_file_formatter_video_settings($form, &$form_state, $setti '#type' => 'textfield', '#default_value' => $settings['height'], ); - $element['fullscreen'] = array( - '#title' => t('Allow the video to be played in full screen mode'), - '#type' => 'checkbox', - '#default_value' => $settings['fullscreen'], + + // @see https://developers.google.com/youtube/player_parameters#Parameters + + // Multiple options. + $element['theme'] = array( + '#title' => t('Player theme'), + '#type' => 'radios', + '#options' => array( + 'dark' => t('Dark'), + 'light' => t('Light'), + ), + '#default_value' => $settings['theme'], + ); + + $element['color'] = array( + '#title' => t('Progress bar color'), + '#type' => 'radios', + '#options' => array( + 'red' => t('Red'), + 'white' => t('White'), + ), + '#default_value' => $settings['color'], + ); + + $element['autohide'] = array( + '#title' => t('Controls during playback'), + '#type' => 'radios', + '#options' => array( + '0' => t('Keep progress bar and player controls on screen while playing'), + '2' => t('Hide progress bar while playing'), + '1' => t('Hide progress bar and player controls'), + ), + '#default_value' => $settings['autohide'], ); + + // Single Options. $element['autoplay'] = array( - '#title' => t('Autoplay'), + '#title' => t('Autoplay video on load'), '#type' => 'checkbox', '#default_value' => $settings['autoplay'], ); - $element['related'] = array( - '#title' => t('Show suggested videos when the video finishes'), + + $element['loop'] = array( + '#title' => t('Loop video'), '#type' => 'checkbox', - '#default_value' => $settings['related'], + '#default_value' => $settings['loop'], ); - $element['hd'] = array( - '#title' => t('Display the high quality version of the video when available'), + + // Note: make sure the positive/negitive language lines up with option + // processing in media_youtube.theme.inc. + $element['controls'] = array( + '#title' => t('Load player with controls hidden (chromeless player)'), '#type' => 'checkbox', - '#default_value' => $settings['hd'], + '#default_value' => $settings['controls'], ); - $element['showsearch'] = array( - '#title' => t('Allow users to search from the video'), + + $element['showinfo'] = array( + '#title' => t('Display video title and uploader'), '#type' => 'checkbox', - '#default_value' => $settings['showsearch'], + '#default_value' => $settings['showinfo'], ); + $element['modestbranding'] = array( - '#title' => t('Use modest YouTube branding (requires AS3 version player)'), + '#title' => t('Remove YouTube logo from the control bar'), '#type' => 'checkbox', '#default_value' => $settings['modestbranding'], ); - $element['showinfo'] = array( - '#title' => t('Display video title'), + + $element['rel'] = array( + '#title' => t('Show related videos when playback ends'), '#type' => 'checkbox', - '#default_value' => $settings['showinfo'], + '#default_value' => $settings['rel'], + ); + + $element['nocookie'] = array( + '#title' => t('Use privacy enhanced (no cookie) mode'), + '#type' => 'checkbox', + '#default_value' => $settings['nocookie'], ); - $element['chromeless'] = array( - '#title' => t('Use chromeless player'), + + // JS api. + $element['enablejsapi'] = array( + '#title' => t('Enable the Javascript API'), '#type' => 'checkbox', - '#default_value' => $settings['chromeless'], + '#default_value' => $settings['enablejsapi'], + ); + + $element['origin'] = array( + '#title' => t('Origin'), + '#type' => 'textfield', + '#description' => t('If the Javascript API is enabled, enter your site\'s domain for added security'), + '#default_value' => $settings['origin'], ); + return $element; } @@ -177,21 +214,24 @@ function media_youtube_file_default_displays() { // Default settings for displaying as a video. $default_video_settings = array( + + // @todo: Remove Large, rewrite default displays once + // http://drupal.org/node/1051090 goes through. 'media_large' => array( - 'width' => 480, - 'height' => 360, + 'width' => 560, + 'height' => 315, 'autoplay' => FALSE, ), + 'media_original' => array( 'width' => 640, - 'height' => 480, + 'height' => 360, 'autoplay' => media_youtube_variable_get('autoplay'), ), ); foreach ($default_video_settings as $view_mode => $settings) { $display_name = 'video__' . $view_mode . '__media_youtube_video'; $default_displays[$display_name] = (object) array( - 'api_version' => 1, 'name' => $display_name, 'status' => 1, 'weight' => 1, @@ -211,7 +251,7 @@ function media_youtube_file_default_displays() { foreach ($default_image_styles as $view_mode => $image_style) { $display_name = 'video__' . $view_mode . '__media_youtube_image'; $default_displays[$display_name] = (object) array( - 'api_version' => 1, + // 'api_version' => 1, 'name' => $display_name, 'status' => 1, 'weight' => 2, diff --git a/includes/media_youtube.variables.inc b/includes/media_youtube.variables.inc index 27949f6..30c628d 100644 --- a/includes/media_youtube.variables.inc +++ b/includes/media_youtube.variables.inc @@ -92,7 +92,7 @@ function media_youtube_variable_del($name) { * * @param string $name * Optional variable name to retrieve the default. Note that it has not yet - * been pre-pended with the MEDIA_YOUTUBE_NAMESPACE namespace at this time. + * been prepended with the MEDIA_YOUTUBE_NAMESPACE namespace at this time. * @return unknown * The default value of this variable, if it's been set, or NULL, unless * $name is NULL, in which case we return an array of all default values. @@ -106,20 +106,20 @@ function media_youtube_variable_default($name = NULL) { if (!isset($defaults)) { $defaults = array( - 'width' => 560, - 'height' =>340, + 'width' => 640, + 'height' => 360, + 'autohide' => 2, 'autoplay' => FALSE, - 'related' => TRUE, - 'hd' => FALSE, - 'showsearch' => TRUE, + 'color' => 'red', + 'controls' => TRUE, + 'enablejsapi' => FALSE, + 'loop' => FALSE, 'modestbranding' => FALSE, - 'showinfo'=> TRUE, - 'version' => 3, + 'nocookie' => FALSE, + 'origin' => '', + 'rel' => TRUE, + 'showinfo' => TRUE, 'theme' => 'dark', - 'fullscreen' => TRUE, - 'wmode' => 'transparent', - 'chromeless' => FALSE, - 'preview_uri' => 'youtube://v/-jubiv7QUco', ); } diff --git a/includes/themes/media-youtube-video.tpl.php b/includes/themes/media-youtube-video.tpl.php index 5e93033..4f4abaa 100644 --- a/includes/themes/media-youtube-video.tpl.php +++ b/includes/themes/media-youtube-video.tpl.php @@ -6,19 +6,17 @@ * Template file for theme('media_youtube_video'). * * Variables available: - * $uri - The uri to the YouTube video, such as youtube://v/xsy7x8c9. - * $video_id - The unique identifier of the YouTube video. - * $width - The width to render. - * $height - The height to render. - * $autoplay - If TRUE, then start the player automatically when displaying. - * $fullscreen - Whether to allow fullscreen playback. + * $uri - The media uri for the YouTube video (e.g., youtube://v/xsy7x8c9). + * $video_id - The unique identifier of the YouTube video (e.g., xsy7x8c9). + * $id - The file entity ID (fid). + * $url - The full url including query options for the Youtube iframe. + * $options - An array containing the Media Youtube formatter options. + * $width - The width value set in Media: Youtube file display options. + * $height - The height value set in Media: Youtube file display options. * - * Note that we set the width & height of the outer wrapper manually so that - * the JS will respect that when resizing later. */ + ?> -