private function getValidVideoPath(KalturaDistributionJobData $distributionJobData)
 {
     $flavorAssets = array();
     $videoAssetFilePath = null;
     $isValidVideo = false;
     if (count($distributionJobData->entryDistribution->flavorAssetIds)) {
         $flavorAssets = assetPeer::retrieveByIds(explode(',', $distributionJobData->entryDistribution->flavorAssetIds));
     } else {
         $flavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($distributionJobData->entryDistribution->entryId);
     }
     foreach ($flavorAssets as $flavorAsset) {
         $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         if (kFileSyncUtils::fileSync_exists($syncKey)) {
             $videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
             $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($flavorAsset->getId());
             if ($mediaInfo) {
                 try {
                     FacebookGraphSdkUtils::validateVideoAttributes($videoAssetFilePath, $mediaInfo->getFileSize(), $mediaInfo->getVideoDuration());
                     $isValidVideo = true;
                 } catch (Exception $e) {
                     KalturaLog::debug('Asset [' . $flavorAsset->getId() . '] not valid for distribution: ' . $e->getMessage());
                 }
             }
             if ($isValidVideo) {
                 break;
             }
         }
     }
     return $videoAssetFilePath;
 }
Ejemplo n.º 2
0
 private function validateVideo(flavorAsset $flavorAsset)
 {
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     if (kFileSyncUtils::fileSync_exists($syncKey)) {
         $videoAssetFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
         $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($flavorAsset->getId());
         if (!$mediaInfo) {
             return false;
         }
         try {
             FacebookGraphSdkUtils::validateVideoAttributes($videoAssetFilePath, $mediaInfo->getFileSize(), $mediaInfo->getVideoDuration());
             return true;
         } catch (Exception $e) {
             KalturaLog::debug('Asset [' . $flavorAsset->getId() . '] not valid for distribution: ' . $e->getMessage());
         }
     }
     return false;
 }