/**
  * Adds the embed code field to the page.
  * @param $entity
  * @param $displayer
  */
 private function _add_embed_code($entity)
 {
     reason_include_once('classes/media/kaltura/media_work_displayer.php');
     $displayer = new KalturaMediaWorkDisplayer();
     $displayer->set_media_work($entity);
     if ($entity->get_value('av_type') == 'Video') {
         $displayer->set_height('small');
         $embed_markup_small = $displayer->get_display_markup();
         $displayer->set_height('medium');
         $embed_markup_medium = $displayer->get_display_markup();
         $displayer->set_height('large');
         $embed_markup_large = $displayer->get_display_markup();
         if (!empty($embed_markup_small)) {
             $this->_show_embed_item('Small Embedding Code', $embed_markup_small);
             $this->_show_embed_item('Medium Embedding Code', $embed_markup_medium);
             $this->_show_embed_item('Large Embedding Code', $embed_markup_large);
         }
     } else {
         $displayer->set_height('small');
         $embed_markup_small = $displayer->get_display_markup();
         if (!empty($embed_markup_small)) {
             $this->_show_embed_item('Audio Embedding Code', $embed_markup_small);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Gets the url for the requested media file. Used by the podcast media_files.php script.
  * @param $item
  * @param $media_work
  * @return string 
  */
 public function get_media_file_url($item, $media_work)
 {
     reason_include_once('classes/media/kaltura/media_work_displayer.php');
     $displayer = new KalturaMediaWorkDisplayer();
     $displayer->set_media_work($media_work);
     switch ($item->get_value('mime_type')) {
         case 'video/mp4':
             return 'http://' . HTTP_HOST_NAME . REASON_HTTP_BASE_PATH . 'scripts/media/validate_requested_podcast.mp4?media_file_id=' . $item->id() . '&media_work_id=' . $item->get_value('work_id') . '&hash=' . $displayer->get_hash();
         case 'audio/mpeg':
             return 'http://' . HTTP_HOST_NAME . REASON_HTTP_BASE_PATH . 'scripts/media/validate_requested_podcast.mp3?media_file_id=' . $item->id() . '&media_work_id=' . $item->get_value('work_id') . '&hash=' . $displayer->get_hash();
     }
     return false;
 }
 /**
  * @access public
  * @param $media_work entity
  */
 public function set_media_work($media_work)
 {
     if ($media_work->get_value('integration_library') == 'kaltura') {
         $this->media_work = $media_work;
         self::$ratios = array();
         // make sure to reset the ratios array
     } else {
         trigger_error('The Media Work Displayer may only use kaltura-integrated media works.');
     }
 }
 /**
  * Adds some fields containing copy-paste-able embedding code.
  */
 function _add_embed_code()
 {
     if ($this->manager->get_value('transcoding_status') == 'ready') {
         reason_include_once('classes/media/kaltura/media_work_displayer.php');
         $displayer = new KalturaMediaWorkDisplayer();
         $entity = new entity($this->manager->get_value('id'));
         $displayer->set_media_work($entity);
         if ($this->manager->get_value('av_type') == 'Video') {
             $displayer->set_height('small');
             $embed_markup_small = $displayer->get_display_markup();
             $displayer->set_height('medium');
             $embed_markup_medium = $displayer->get_display_markup();
             $displayer->set_height('large');
             $embed_markup_large = $displayer->get_display_markup();
             if (!empty($embed_markup_small)) {
                 $this->manager->add_element('embed_small', 'text', array('maxlength' => 99999));
                 $this->manager->set_value('embed_small', $embed_markup_small);
                 $this->manager->set_display_name('embed_small', 'Small Embed Code');
                 $this->manager->add_element('embed_medium', 'text', array('maxlength' => 99999));
                 $this->manager->set_value('embed_medium', $embed_markup_medium);
                 $this->manager->set_display_name('embed_medium', 'Medium Embed Code');
                 $this->manager->add_element('embed_large', 'text', array('maxlength' => 99999));
                 $this->manager->set_value('embed_large', $embed_markup_large);
                 $this->manager->set_display_name('embed_large', 'Large Embed Code');
             }
         } else {
             $embed_markup_small = $displayer->get_display_markup();
             if (!empty($embed_markup_small)) {
                 $this->manager->add_element('embed_small', 'text');
                 $this->manager->set_value('embed_small', $embed_markup_small);
                 $this->manager->set_display_name('embed_small', 'Audio Embedding Code');
             }
         }
     }
 }