[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/video/theme/ -> video-play-html5.tpl.php (source)

   1  <?php
   2  /*
   3   * @file
   4   * Theme file to handle HTML5 output.
   5   *
   6   * Variables passed.
   7   * $video is the video object (see video_helper->video_object())
   8   * $node is the Drupal node object
   9   */
  10  
  11  $width = intval($video->player_width);
  12  $height = intval($video->player_height);
  13  $poster = check_plain($video->thumbnail->url);
  14  $autoplayattr = $video->autoplay ? ' autoplay="autoplay"' : '';
  15  $preload = 'none';
  16  if ($video->autobuffering) {
  17    $preload = 'auto';
  18  }
  19  elseif (variable_get('video_metadata', FALSE)) {
  20    $preload = 'metadata';
  21  }
  22  
  23  $codecs = array(
  24      'video/mp4' => 'avc1.42E01E, mp4a.40.2',
  25      'video/webm' => 'vp8, vorbis',
  26      'video/ogg' => 'theora, vorbis',
  27      'application/ogg' => 'theora, vorbis',
  28      'video/ogv' => 'theora, vorbis',
  29      'video/quicktime' => 'avc1.42E01E, mp4a.40.2',
  30  );
  31  
  32  $flashtype = null;
  33  ?>
  34  <video width="<?php echo $width; ?>" height="<?php echo $height; ?>" preload="<?php echo $preload; ?>" controls="controls" poster="<?php echo $poster; ?>"<?php echo $autoplayattr; ?>>
  35  <?php
  36  foreach ($video->files as $filetype => $file) {
  37    $filepath = check_plain($file->url);
  38    $mimetype = file_get_mimetype($file->filepath);
  39  
  40    if ($mimetype == 'video/quicktime') {
  41      $mimetype = 'video/mp4';
  42    }
  43  
  44    if (!isset($codecs[$mimetype])) {
  45      continue;
  46    }
  47    
  48    // Find the right flash fallback, prefer flv over mp4
  49    if ($filetype != 'flv' && ($mimetype == 'video/mp4' || $mimetype == 'video/flv')) {
  50      $flashtype = $filetype;
  51    }
  52  ?>
  53    <source src="<?php echo $filepath; ?>" type="<?php echo $mimetype; ?>; codecs=&quot;<?php echo $codecs[$mimetype]; ?>&quot;" />
  54  <?php
  55  }
  56  
  57  if ($flashtype != null) {
  58    $video->player = 'flv';
  59    $video->flash_player = variable_get('video_extension_'. $video->player .'_flash_player', '');
  60  
  61    if ($flashtype != 'flv') {
  62      $video->files->flv->url = $video->files->{$flashtype}->url;
  63    }
  64  
  65    echo theme('video_flv', $video, $node);
  66  }
  67  ?>
  68  </video>


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7