If you have an SSL only site and are using the Video Filter module to embed YouTube videos, it's likely your users will get a mixed content warning. This is because the URL to the YouTube video is rewritten by the filter and is only linking to the non-SSL YouTube path. This issue is described in this issue: #786774: Incompatible with HTTPS sites

A simple way around this is to alter the theme function that prints the link to the video. In your custom theme template.php file, simply insert this theme function from the video_filter module with the slight replace of http with https.

/**
 * Override video filter display to rewrite url to https
 */
function CUSTOMTHEME_video_filter_flash($variables) {
  $output = '';

  $video = $variables['video'];
  $params = isset($variables['params']) ? $variables['params'] : array();

  // Rewrite the url to be SSL to eliminate the mixed content warnings
  $video['source'] = preg_replace("/http/", "https", $video['source']);

  // Create classes
  $classes = array(
    'video-filter',
    'video-' . $video['codec']['codec_name'],  // Adds codec name
  );

  // Adds alignment
  if (isset($video['align'])) {
    $classes[] = 'video-' . $video['align'];
  }

  // First match is the URL, we don't want that as a class.
  unset($video['codec']['matches'][0]);
  foreach ($video['codec']['matches'] AS $match) {
    $classes[] = 'vf-' . strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $match));
  }

  $output .= '<object class="' . implode(' ', $classes) . '" type="application/x-shockwave-flash" ';

  $output .= 'width="' . $video['width'] . '" height="' . $video['height'] . '" data="' . $video['source'] . '">' . "\n";

  $defaults = array(
    'movie' => $video['source'],
    'wmode' => 'transparent',
    'allowFullScreen' => 'true',
  );

  $params = array_merge($defaults, (is_array($params) && count($params)) ? $params : array());

  foreach ($params as $name => $value) {
    $output .= '  <param name="' . $name . '" value="' . $value . '" />' . "\n";
  }

  $output .= '</object>' . "\n";

  return $output;
}

Comments

dschafer’s picture

It would actually be better write the url as protocol neutral.

//www.youtube.com/......