/**
  * Generates and returns the html markup used to represent a video media work.  Uses html5 video
  * tags with a flash player fallback.
  *
  * @access private
  * @return string embed markup
  */
 private function _get_video_embed_markup()
 {
     // change preload to "none" to allow poster support in IE9...
     $markup = '<video id="' . $this->media_work->id() . '" preload="metadata" ';
     if ($this->show_controls) {
         $markup .= 'controls="controls" ';
     }
     if ($this->autostart) {
         $markup .= 'autoplay="autoplay" ';
     }
     $embed_width = $this->get_embed_width();
     $embed_height = $this->get_embed_height();
     // $markup .= 'width="'.intval($embed_width).'" ';
     // $markup .= 'height="'.intval($embed_height).'" ';
     $markup .= 'width="100%" ';
     // for responsiveness, fill the iframe the video is in.
     $markup .= 'height="100%" ';
     if ($poster_url = $this->_get_poster_image_url()) {
         $markup .= 'poster="' . $poster_url . '" ';
     }
     $markup .= '>' . "\n";
     $this->media_files = $this->_get_suitable_flavors($embed_width, $embed_height);
     $mp4 = null;
     foreach ($this->media_files as $media_file) {
         // Grab the largest available mp4 media file to use in the flash fallback
         if ($mp4 == null && $media_file->get_value('mime_type') == 'video/mp4') {
             $mp4 = $media_file;
         }
         $markup .= $this->_get_video_source_tag($media_file, $media_file->get_value('mime_type'));
     }
     if ($mp4 != null) {
         // Flash Video Fallback markup
         $avd = new reasonAVDisplay();
         $avd->set_video_dimensions($embed_width, $embed_height);
         $avd_autoplay = $this->autostart ? 'true' : 'false';
         $avd->set_parameter('flv', 'autostart', $avd_autoplay);
         $avd->set_parameter('flv', 'controlbar', 'over');
         if ($poster_url) {
             $avd->set_placard_image($poster_url);
         }
         if (!$this->show_controls) {
             $avd->set_parameter('flv', 'controlbar', '0');
         }
         //$mp4->set_value('media_format', 'Flash Video');
         $mp4->set_value('url', $this->_match_protocol($mp4->get_value('url')));
         $avd_markup = $avd->get_embedding_markup_for_flash_video($mp4);
         // return $avd_markup; // uncomment this if testing the flash player
         $markup .= $avd_markup;
     }
     $markup .= '</video>' . "\n";
     return $markup;
 }
 /**
  * Generates and returns the html markup used to represent a video media work.  Uses html5 video
  * tags with a flash player fallback.
  *
  * @access private
  * @return string embed markup
  */
 private function _get_video_embed_markup()
 {
     // change preload to "none" to allow poster support in IE9...
     $markup = '<video id="' . $this->media_work->id() . '" preload="metadata" ';
     if ($this->show_controls) {
         $markup .= 'controls="controls" ';
     }
     if ($this->autostart) {
         $markup .= 'autoplay="autoplay" ';
     }
     // specify width and height attributes explicitly in the video tag every time
     // this is needed 1) so the browswer doesn't have to figure it out(?), 2) so the placard image
     // works nicely, and 3) so the flash video player is properly scaled because it doesn't automatically scale itself.
     $embed_width = $this->get_embed_width();
     $embed_height = $this->get_embed_height();
     $markup .= 'width="' . intval($embed_width) . '" ';
     $markup .= 'height="' . intval($embed_height) . '" ';
     if ($poster_url = $this->_get_poster_image_url()) {
         $markup .= 'poster="' . $poster_url . '" ';
     }
     $markup .= '>' . "\n";
     $this->media_files = $this->_get_suitable_flavors($embed_width, $embed_height);
     $mp4 = null;
     foreach ($this->media_files as $media_file) {
         // Grab the largest available mp4 media file to use in the flash fallback
         if ($mp4 == null && $media_file->get_value('mime_type') == 'video/mp4') {
             $mp4 = $media_file;
         }
         $markup .= $this->_get_video_source_tag($media_file, $media_file->get_value('mime_type'));
     }
     if ($mp4 != null) {
         // Flash Video Fallback markup
         $avd = new reasonAVDisplay();
         $avd->set_video_dimensions($embed_width, $embed_height);
         $avd_autoplay = $this->autostart ? 'true' : 'false';
         $avd->set_parameter('flv', 'autostart', $avd_autoplay);
         $avd->set_parameter('flv', 'controlbar', 'over');
         if ($poster_url) {
             $avd->set_placard_image($poster_url);
         }
         if (!$this->show_controls) {
             $avd->set_parameter('flv', 'controlbar', '0');
         }
         //$mp4->set_value('media_format', 'Flash Video');
         $mp4->set_value('url', $this->_match_protocol($mp4->get_value('url') . '/a.mp4'));
         $avd_markup = $avd->get_embedding_markup_for_flash_video($mp4);
         //return $avd_markup; // uncomment this if testing the flash player
         $markup .= $avd_markup;
     }
     $markup .= '</video>' . "\n";
     return $markup;
 }