I've created a patch from the current dev release that refactors the HTML output into a template file, which should make maintenance simpler. I've also removed the added layer of Internet Explorer Quicktime playback, to keep it closer to the original implementation, and because it seemed that if we're going to rely on a plugin to play the video it may as well be consistently Flash. That case can be restored, of course!

CommentFileSizeAuthor
1_refactored_html_output.patch4.93 KBmichaek

Comments

michaek’s picture

Ah, I see now that an older version of VfE had a Quicktime fallback. Well, I think Kroc Camen made the right call on that one! Old version: http://camendesign.com/code/video_for_everybody/test_qt.html

heylookalive’s picture

Assigned: Unassigned » heylookalive

Hi,

Thanks for the patch, I'll take a look at Kroc's updates and get this stuff through. I'm kind of split as to whether or not we'd need to break out the theme function to a file as really it shouldn't be modified too much otherwise it'd defeat the point in using a set approach - and future updates to the v4e approach I will be on top of with a module release.

Also it is possible to override the theming function via phptemplate_.

Thanks,
Alli.

Anonymous’s picture

Hi !

I've update Kroc's update today : here is the -rought - code with some development comment ! Maybe it can help you.

/**
 *  Main theming function
 */
function theme_video_for_everybody_video($node, $settings = array()) {
  // define the settings vars and file urls
  if (empty($settings)) {
    $settings['width'] = variable_get('video_for_everybody_default_player_width', 640);
    $settings['height'] = variable_get('video_for_everybody_default_player_height', 360);
  
    $settings['show_download_links'] = variable_get('video_for_everybody_show_download_links', 0);
  }

  $mp4_url = file_create_url($node->field_video_for_everybody_mp4[0]['filepath']);
  $ogv_url = file_create_url($node->field_video_for_everybody_ogv[0]['filepath']);
  $poster_url = '';
  
  if (isset($node->field_video_for_everybody_poster[0]['filepath']) && $node->field_video_for_everybody_poster[0]['filepath'] != '') {
    $poster_url = file_create_url($node->field_video_for_everybody_poster[0]['filepath']);
  }
  
  $flash_player_url = theme('video_for_everybody_get_flash_player_url', $mp4_url, $ogv_url, $settings, $poster_url);
  
  $width  = $settings['width'];
  $height = $settings['height'];
  
  $alt   = "__Title of video__"; // TBD
  $title = "No video playback capabilities, please download the video below"; // Translation
 
  if ($settings['show_download_links'] == 1) {
    $download_links = t(
     '<p>Download Video: <a href="@mp4_url">High Quality &quot;MP4&quot;</a> | <a href="@ogv_url">Low Quality &quot;OGG&quot;</a></p>',
     array('@mp4_url' => $mp4_url, '@ogv_url' => $ogv_url)
    ) ."\n";
  }
  //<video width="$width" height="$height" poster="$poster_url" controls>
$output = <<<HTML
  <div class="video-for-everybody">   
    <video width="$width" height="$height" controls autoplay>
    	<source src="$mp4_url" type="video/mp4" />
    	<source src="$ogv_url" type="video/ogg" />
    	

    	<!-- fallback to Flash -->
    	<object width="$width" height="$height" type="application/x-shockwave-flash" data="$flash_player_url">
			<param name="movie" value="$flash_player_url" />
			<param name="flashvars" value="autostart=true&amp;controlbar=over&amp;file=$mp4_url" />
    	</object>
    </video>
    $download_links
  </div>
HTML;

  return $output;
}
michaek’s picture

My main reason to use a template file was legibility, not theming. I don't think there's much call for themers to modify the VfE implementation.