private function submitCaption(KalturaFacebookDistributionProfile $distributionProfile, KalturaCaptionDistributionInfo $captionInfo, $remoteId) { if (!$captionInfo->label && !$captionInfo->language) { throw new Exception("No label/language were configured for this caption aborting"); } if ($captionInfo->language) { $locale = KalturaFacebookLanguageMatch::getFacebookCodeForKalturaLanguage($captionInfo->language); } if (!$locale && $captionInfo->label) { $locale = $captionInfo->label; } if (!$locale) { throw new Exception("Failed to find matching language for language " . $captionInfo->language . " and there was no label available"); } $status = FacebookGraphSdkUtils::uploadCaptions($this->appId, $this->appSecret, $distributionProfile->pageAccessToken, $remoteId, $captionInfo->filePath, $locale, $this->tempDirectory); return $status; }