protected function waitTillFinished($videoId, $thumbnail)
{
$finished = false;
// initial delay
$video = Asset::getById($videoId);
$thumb = $video->getThumbnail($thumbnail);
if ($thumb["status"] != "finished") {
sleep(20);
}
while (!$finished) {
\Pimcore::collectGarbage();
$video = Asset::getById($videoId);
$thumb = $video->getThumbnail($thumbnail);
if ($thumb["status"] == "finished") {
$finished = true;
Logger::debug("video [" . $video->getId() . "] FINISHED");
} elseif ($thumb["status"] == "inprogress") {
Logger::debug("video [" . $video->getId() . "] in progress ...");
sleep(5);
} else {
// error
Logger::debug("video [" . $video->getId() . "] has status: '" . $thumb["status"] . "' -> skipping");
break;
}
}
}