Created
April 13, 2016 07:38
-
-
Save andhikanugraha/b3a761754fa167a3bedf2c170e890de7 to your computer and use it in GitHub Desktop.
Azure Media Services SDK for PHP: Task progress & error details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// When creating a Task... | |
$task = new Task(...); | |
$task = $task->setName('[TASK NAME]'); | |
// Submit the job | |
$job = $mediaServicesRestProxy->createJob($job, array($asset), array($task)); | |
// To get progress... | |
// Fetch all task statuses from Azure Media Services API | |
$tasks = $mediaServicesRestProxy->getTaskList(); | |
foreach ($tasks) { | |
// Find which task we're looking for | |
if ($tasks->getName() === '[TASK NAME]') { | |
// Get the progress | |
$progress = $task->getProgress(); // returns percentage | |
} | |
} | |
// To get error details... | |
// Fetch all task statuses from Azure Media Services API | |
$tasks = $mediaServicesRestProxy->getTaskList(); | |
foreach ($tasks) { | |
// Find which task we're looking for | |
if ($tasks->getName() === '[TASK NAME]') { | |
// Get the error details | |
$errorDetails = $task->getErrorDetails(); // returns array of errordetails | |
foreach ($errorDetails as $error) { | |
$code = $error->getCode(); | |
$message = $error->getMessage(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment