Skip to content

Commit

Permalink
Add video and subtitle on the API
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel authored and daniel committed Feb 6, 2019
1 parent 21b6cf2 commit 7116a96
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
$video = Video::getVideoFromFileName(str_replace(array('_Low', '_SD', '_HD'), array('', '', ''), $filename));
$canUseCDN = canUseCDN($video['id']);
//error_log(json_encode(array('$filename'=>$filename, '$advancedCustom->videosCDN'=>$advancedCustom->videosCDN,'canUseCDN($video[id])'=>canUseCDN($video['id']),'$video[id]'=>$video['id'])));
if (!empty($advancedCustom->videosCDN) && canUseCDN($video['id'])) {
if (!empty($advancedCustom->videosCDN) && $canUseCDN) {
$advancedCustom->videosCDN = rtrim($advancedCustom->videosCDN, '/') . '/';
$source['url'] = "{$advancedCustom->videosCDN}videos/{$filename}{$type}{$token}";
} else {
Expand Down Expand Up @@ -1827,6 +1827,25 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
//ObjectYPT::setCache($name, $source);
return $source;
}

static function getVideosPaths($filename, $includeS3 = false) {
$types = array('', '_Low', '_SD', '_HD');
$videos = array();
foreach ($types as $value) {
$source = self::getSourceFile($filename, $value.".mp4", $includeS3);
if(!empty($source['url'])){
$videos['mp4'][str_replace("_", "", $value)] = $source['url'];
}
}

foreach ($types as $value) {
$source = self::getSourceFile($filename, $value.".webm", $includeS3);
if(!empty($source['url'])){
$videos['webm'][str_replace("_", "", $value)] = $source['url'];
}
}
return $videos;
}

static function getStoragePath() {
global $global;
Expand Down

0 comments on commit 7116a96

Please sign in to comment.