@@ -86,7 +86,6 @@ public function start($transcodingProfiles, $uri = null, $transferMethod = null,
8686 'task_token ' => $ this ->taskToken ,
8787 'profiles ' => is_array ($ transcodingProfiles ) ? implode (', ' , $ transcodingProfiles ) : $ transcodingProfiles
8888 );
89- //echo 'stitchVideoItems: '.print_r($this->stitchVideoItems, true);
9089 $ arrays = null ;
9190 if (is_array ($ this ->stitchVideoItems )) {
9291 $ arrays = array ('stitch ' => $ this ->stitchVideoItems );
@@ -141,7 +140,6 @@ public function startCustom($task_params, $payload = null) {
141140 }
142141
143142 $ query_json = preg_replace ('/,\s*"[^"]+":null|"[^"]+":null,?/ ' , '' , $ query_json );
144- // echo $query_json."\n\n";
145143 $ params = array (
146144 'task_token ' => $ this ->taskToken ,
147145 'query ' => $ query_json
@@ -161,9 +159,16 @@ public function startCustom($task_params, $payload = null) {
161159 */
162160 public function getStatus () {
163161 $ params = array ('task_tokens[] ' => $ this ->taskToken );
164- //TODO: fallback to /v1/status
165- $ response = $ this ->api ->post ($ this ->statusUrl , $ params );
166- $ this ->lastStatus = $ response ['statuses ' ][$ this ->taskToken ];
162+
163+ try {
164+ $ response = $ this ->api ->post ($ this ->statusUrl , $ params );
165+ } catch (Exception $ e ) {
166+ // If the post request fails, fallback to the default URL
167+ $ this ->statusUrl = 'https://api.qencode.com/v1/status ' ;
168+ $ response = $ this ->api ->post ($ this ->statusUrl , $ params );
169+ }
170+
171+ $ this ->lastxStatus = $ response ['statuses ' ][$ this ->taskToken ];
167172 if ($ this ->lastStatus == null ) {
168173 throw new QencodeClientException ('Task ' . $ this ->taskToken . ' not found! ' );
169174 }
0 commit comments