You are here

public function TranscoderAbstractionFactoryZencoder::execute in Video 7.2

Overrides TranscoderFactoryInterface::execute

File

transcoders/TranscoderAbstractionFactoryZencoder.inc, line 244
File containing class TranscoderAbstractionFactoryZencoder

Class

TranscoderAbstractionFactoryZencoder
Class that handles Zencoder transcoding.

Code

public function execute() {
  libraries_load('zencoder');
  $zencoder = new Services_Zencoder();
  try {
    $encoding_job = $zencoder->jobs
      ->create($this->options);
    $output = new stdClass();
    $output->filename = $this->settings['filename'];
    $output->uri = $this->settings['base_url'] . '/' . $this->settings['filename'];
    $output->filesize = 0;
    $output->timestamp = time();
    $output->jobid = intval($encoding_job->id);
    $output->duration = 0;
    return $output;
  } catch (Services_Zencoder_Exception $e) {
    $errors = $e
      ->getErrors();
    $this->errors['execute'] = $errors;
    watchdog('zencoder', 'Zencoder reports errors while converting %file:<br/>!errorlist', array(
      '%file' => $this->settings['filename'],
      '!errorlist' => theme('item_list', array(
        'items' => $errors,
      )),
    ), WATCHDOG_ERROR);
    return FALSE;
  }
}