function display_entity() { $this->start_table(); // Embedded preview $avd = new reasonAVDisplay(); $avd->disable_automatic_play_start(); if ($image_info = reason_get_media_placard_image_info($this->_entity)) { $avd->set_placard_image($image_info['url']); $avd->set_placard_image_dimensions($image_info['width'], $image_info['height']); } $embed_markup = $avd->get_embedding_markup($this->_entity); if (!empty($embed_markup)) { $this->show_item_default('File Preview', $embed_markup); if ($embed_markup == strip_tags($embed_markup, REASON_DEFAULT_ALLOWED_TAGS)) { $this->show_item_default('Embed Code', '<textarea rows="7">' . htmlspecialchars($embed_markup) . '</textarea>'); } else { $this->show_item_default('Embed Code', 'Not available<div class="smallText">(The code used to embed ' . $this->_entity->get_value('media_format') . ' files may not be accepted in a Reason content area.)</div>'); } } $link_url = REASON_HTTP_BASE_PATH . 'displayers/av_display.php?id=' . htmlspecialchars($this->_entity->id()); $this->show_item_default('Link', '<a href="' . $link_url . '" target="_blank">Link to video</a>'); // Everything Else $this->show_all_values($this->_entity->get_values()); $this->end_table(); }
/** * 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 ''; } }
function get_av_info($media_works_id, $width = 400, $height = 300, $crop_style = "fill") { $ret = array(); //the object that gets returned $this->media_works_id = $media_works_id; $this->width = $width; $this->height = $height; $this->crop_style = $crop_style; $media_work = new entity($this->media_works_id); $es = new entity_selector(); $es->add_type(id_of('image')); $es->add_right_relationship($media_works_id, relationship_id_of('av_to_primary_image')); $images = $es->run_one(); $this->img_results = $images; if (count($images) > 0) { $image = current($images); $av_img_url = $this->get_av_img_url($image); $ret['av_img_url'] = $av_img_url; //set the av_image_alt to the image description $ret['av_img_alt'] = $image->get_value('description'); $ret['av_img_id'] = $image->get_value('id'); } else { /** * This is not working */ //get a blank image with a play button blitted into it // set the av_image_alt to "play" $ret['av_img_url'] = $this->get_watermark_relative_path($this->media_works_type); if ($this->use_absolute_urls) { $ret['av_img_url'] = '//' . HTTP_HOST_NAME . $ret['av_img_url']; } $ret['av_img_alt'] = "play"; $ret['av_img_id'] = "none"; } if ($media_work->get_value('integration_library') && $media_work->get_value('integration_library') != 'default') { reason_include_once('classes/media/factory.php'); $displayer_chrome = MediaWorkFactory::displayer_chrome($media_work, 'default'); if ($displayer_chrome) { $displayer_chrome->set_media_work($media_work); $displayer_chrome->set_media_height($height); $displayer_chrome->set_media_width($width); $ret['av_html'] = $displayer_chrome->get_html_markup(); $ret['type'] = $media_work->get_value('av_type'); $ret['format'] = 'HTML5'; } else { // TODO: test this? $ret['av_html'] = '<p>Not available.</p>'; $ret['type'] = $media_work->get_value('av_type'); $ret['format'] = 'HTML5'; } } else { $avd = new reasonAVDisplay(); $es = new entity_selector(); $es->add_type(id_of('av_file')); $es->add_right_relationship($media_works_id, relationship_id_of('av_to_av_file')); $es->set_order('av.media_format ASC, av.av_part_number ASC'); $results = $es->run_one(); $this->avf_results = $results; $avf = null; $taf = array(); $taf = $this->get_type_and_format(); $avf = $this->get_avf($taf['type'], $taf['format']); $ret['type'] = $taf['type']; $ret['format'] = $taf['format']; $this->media_works_type = $taf['type']; $avd->set_video_dimensions($width, $height); $avd->disable_automatic_play_start(); if (!empty($image)) { $avd->set_placard_image($image); // This could be an entity, an ID, or a URL string //get the image with a play button blitted into it } $embed_markup = ""; if ($avf != null) { $embed_markup = $avd->get_embedding_markup($avf); } $ret['av_html'] = $embed_markup; } return $ret; }