From fa99d11e0f64d54599fc3765179dcb960d6d2539 Mon Sep 17 00:00:00 2001 From: John Phillips Date: Wed, 4 Jan 2023 18:40:02 -0700 Subject: [PATCH] Adds a check for Auto Generated captions --- src/Video/Kaltura.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Video/Kaltura.php b/src/Video/Kaltura.php index 73e24d2..a75fd43 100644 --- a/src/Video/Kaltura.php +++ b/src/Video/Kaltura.php @@ -56,6 +56,23 @@ function captionsLanguage($captions) return empty($captions) ? self::KALTURA_SUCCESS : self::KALTURA_FAIL; } + /** + * Checks to see if a video is using auto-generated caption information in Kaltura + * @param array $captions + * @return int + */ + public function captionsAutoGenerated($captions) + { + // Looks through the captions and checks if any were not auto-generated + foreach ($captions as $captionItem) { + if ($captionItem->version > 1) { + return self::KALTURA_SUCCESS; + } + } + + return empty($captions) ? self::KALTURA_SUCCESS : self::KALTURA_FAIL; + } + /** * Checks to see if the provided link URL is a Kaltura video. If so, it returns * the video code, if not, it returns null.