Skip to content

Commit 496cf7b

Browse files
Added subtitles and callback support. Composer.json included
1 parent 4a3523b commit 496cf7b

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "qencode/api-client",
3+
"description": "PHP library for interacting with Qencode API",
4+
"require": {
5+
"php": "^5.4"
6+
}
7+
}

src/Classes/CustomTranscodingParams.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ class CustomTranscodingParams {
1414
* @var Format
1515
*/
1616
public $format;
17+
18+
public $callback_url;
1719
}

src/Classes/TranscodingTask.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function __construct($api, $task_token) {
5454
$this->start_time = null;
5555
$this->duration = null;
5656
$this->output_path_variables = new \stdClass();
57+
$this->subtitles = null;
5758
}
5859

5960
/**
@@ -85,6 +86,9 @@ public function start($transcodingProfiles, $uri, $transferMethod = null, $paylo
8586
if ($this->output_path_variables) {
8687
$params['output_path_variables'] = json_encode($this->output_path_variables);
8788
}
89+
if ($this->subtitles) {
90+
$params['subtitles'] = json_encode($this->subtitles);
91+
}
8892
$response = $this->api->post('start_encode', $params);
8993
$this->statusUrl = $response['status_url'];
9094
return $response;
@@ -139,4 +143,16 @@ public function getStatus() {
139143
public function getLastStatus() {
140144
return $this->lastStatus;
141145
}
146+
147+
private $subtitles;
148+
149+
public function addSubtitles($source, $language) {
150+
if ($this->subtitles == null) {
151+
$this->subtitles = array();
152+
}
153+
$sub = new \stdClass();
154+
$sub->source = $source;
155+
$sub->language = $language;
156+
$this->subtitles[] = $sub;
157+
}
142158
}

0 commit comments

Comments
 (0)