diff --git a/src/Service/Serializer/AssetTypeSerializationHandler/VideoSerializationHandler.php b/src/Service/Serializer/AssetTypeSerializationHandler/VideoSerializationHandler.php index b5f12a47..1aa18085 100644 --- a/src/Service/Serializer/AssetTypeSerializationHandler/VideoSerializationHandler.php +++ b/src/Service/Serializer/AssetTypeSerializationHandler/VideoSerializationHandler.php @@ -26,6 +26,11 @@ class VideoSerializationHandler extends AbstractHandler { use LoggerAwareTrait; + private const ERROR_SEPARATOR = ' error '; + + /** + * @throws Exception + */ public function getAdditionalSystemFields(Asset $asset): array { if (!$asset instanceof Video) { @@ -56,7 +61,52 @@ private function getImageThumbnail(Video $video): ?string } catch (Throwable $e) { $this->logger->error('Thumbnail generation failed for video asset: ' . $video->getId() . - ' error ' . + self::ERROR_SEPARATOR . + $e->getMessage() + ); + } + + return null; + } + + private function getDuration(Video $asset): ?int + { + try { + return $asset->getDuration(); + } catch (Exception $e) { + $this->logger->error('Failed getting duration for video asset: ' . + $asset->getId() . + self::ERROR_SEPARATOR . + $e->getMessage() + ); + } + + return null; + } + + private function getWidth(Video $asset): ?int + { + try { + return $asset->getWidth(); + } catch (Exception $e) { + $this->logger->error('Failed getting width for video asset: ' . + $asset->getId() . + self::ERROR_SEPARATOR . + $e->getMessage() + ); + } + + return null; + } + + private function getHeight(Video $asset): ?int + { + try { + return $asset->getHeight(); + } catch (Exception $e) { + $this->logger->error('Failed getting height for video asset: ' . + $asset->getId() . + self::ERROR_SEPARATOR . $e->getMessage() ); }