Пример #1
0
 /**
  * 
  */
 public function getClip()
 {
     $pn_id = $this->opo_request->getParameter('id', pInteger);
     $va_data = array();
     $t_annotation = new ca_representation_annotations($pn_id);
     if ($t_annotation->getPrimaryKey()) {
         $vs_start = $t_annotation->getPropertyValue('startTimecode');
         $vs_end = $t_annotation->getPropertyValue('endTimecode');
         $va_data['start'] = $vs_start;
         $va_data['end'] = $vs_end;
         $t_rep = new ca_object_representations($t_annotation->get('representation_id'));
         $va_data['file'] = $vs_file = $t_rep->getMediaPath('media', 'original');
         $o_media = new Media();
         if ($o_media->read($vs_file)) {
             $o_media->writeClip($vs_file = tempnam('/tmp', 'meow'), $vs_start, $vs_end);
         }
         header("Content-type: audio/mpeg");
         header("Content-length: " . @filesize($vs_file));
         readfile($vs_file);
         return;
     }
     return $this->makeResponse($va_data, 500, "No such clip");
 }