/**
  * Generates and returns the html markup used to represent an audio media work.
  *
  * @access private
  * @return string embed markup
  */
 private function _get_audio_embed_markup()
 {
     $markup = '<audio id="' . $this->media_work->id() . '" preload="metadata" ';
     if ($this->show_controls) {
         $markup .= 'controls="controls" ';
     }
     if ($this->autostart) {
         $markup .= 'autoplay="autoplay" ';
     }
     $markup .= '>';
     $es = new entity_selector();
     $es->add_type(id_of('av_file'));
     $es->add_right_relationship($this->media_work->id(), relationship_id_of('av_to_av_file'));
     $es->set_order('av.mime_type ASC');
     // 'mpeg' comes before 'ogg'
     $this->media_files = $es->run_one();
     $mp3 = false;
     foreach ($this->media_files as $file) {
         $markup .= '<source src="' . $this->_match_protocol($file->get_value('url')) . '" type="' . $file->get_value('mime_type') . '" />' . "\n";
         if ($file->get_value('mime_type') == 'audio/mpeg') {
             $mp3 = $file;
         }
     }
     // Fall back to flash player
     if ($mp3) {
         $avd = new reasonAVDisplay();
         $avd_autoplay = $this->autostart ? 'true' : 'false';
         $avd->set_parameter('flv', 'autostart', $avd_autoplay);
         if (!$this->show_controls) {
             $avd->set_parameter('flv', 'controlbar', '0');
         }
         $mp3->set_value('url', $this->_match_protocol($mp3->get_value('url')));
         $avd_markup = $avd->get_embedding_markup_For_flash_video($mp3);
         $markup .= $avd_markup;
         // return $avd_markup;  // uncomment this if testing the flash player
     }
     $markup .= '</audio>' . "\n";
     return $markup;
 }
 /**
  * Returns the html markup that can embed the media on a page.
  * @return string
  */
 public function get_embed_markup()
 {
     if (!$this->media_work) {
         return '';
     }
     if ($this->current_media_file) {
         $avd = new reasonAVDisplay();
         $height = $this->get_embed_height();
         $width = $this->get_embed_width();
         $avd->set_video_dimensions($width, $height);
         $avd->set_audio_dimensions(0, 0);
         if (!$this->show_controls) {
             $avd->set_parameter('flv', 'controlbar', 'false');
             $avd->set_parameter('qt', 'controller', '0');
             $avd->set_parameter('wmv', 'ShowControls', 'false');
         }
         if (!$this->autostart) {
             $avd->disable_automatic_play_start();
         }
         if ($image_info = reason_get_media_placard_image_info($this->current_media_file)) {
             $avd->set_placard_image($image_info['url']);
             $avd->set_placard_image_dimensions($image_info['width'], $image_info['height']);
         }
         $this->latest_tech_note = $avd->get_tech_note($this->current_media_file);
         $embed_markup = $avd->get_embedding_markup($this->current_media_file);
         return $embed_markup;
     } else {
         return '';
     }
 }