1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
This commit is contained in:
Daniel Neto 2024-01-02 19:42:52 -03:00
parent bcaa41ca15
commit 15a35cfb8c
4 changed files with 12 additions and 10 deletions

View file

@ -922,7 +922,7 @@ class API extends PluginAbstract
$rows[$key]['videos'] = Video::getVideosPaths($value['filename'], true); $rows[$key]['videos'] = Video::getVideosPaths($value['filename'], true);
} else { } else {
$extension = getExtension($rows[$key]['videoLink']); $extension = getExtension($rows[$key]['videoLink']);
$rows[$key]['videoLink'] = AVideoPlugin::modifyURL($rows[$key]['videoLink']); $rows[$key]['videoLink'] = AVideoPlugin::modifyURL($rows[$key]['videoLink'], $rows[$key]['id']);
if ($extension == 'mp4') { if ($extension == 'mp4') {
$rows[$key]['videos'] = array( $rows[$key]['videos'] = array(
'mp4' => array( 'mp4' => array(
@ -1025,7 +1025,7 @@ class API extends PluginAbstract
$rows[$key]['relatedVideos'][$key2]['videos'] = Video::getVideosPaths($value2['filename'], true); $rows[$key]['relatedVideos'][$key2]['videos'] = Video::getVideosPaths($value2['filename'], true);
} }
if(!empty($rows[$key]['relatedVideos'][$key2]['videoLink'])){ if(!empty($rows[$key]['relatedVideos'][$key2]['videoLink'])){
$rows[$key]['relatedVideos'][$key2]['videoLink'] = AVideoPlugin::modifyURL($rows[$key]['relatedVideos'][$key2]['videoLink']); $rows[$key]['relatedVideos'][$key2]['videoLink'] = AVideoPlugin::modifyURL($rows[$key]['relatedVideos'][$key2]['videoLink'], $value2['id']);
} }
} }
} }

View file

@ -2828,18 +2828,20 @@ class AVideoPlugin
] ]
* @return $file * @return $file
*/ */
public static function modifyURL($file) public static function modifyURL($file, $videos_id=0)
{ {
global $global; global $global;
if (empty($global)) { if (empty($global)) {
$global = []; $global = [];
} }
$plugins = Plugin::getAllEnabled(); $plugins = Plugin::getAllEnabled();
$videos_id = 0; if(empty($videos_id)){
if(!empty($file['filename'])){ $videos_id = 0;
$videos_id = getVideos_IdFromFilename($file['filename']); if(!empty($file['filename'])){
}else{ $videos_id = getVideos_IdFromFilename($file['filename']);
$videos_id = getVideos_id(); }else{
$videos_id = getVideos_id();
}
} }
/** /**
* @var array $global * @var array $global

View file

@ -132,7 +132,7 @@ class PlayerSkins extends PluginAbstract
if ($video['type'] == "video") { if ($video['type'] == "video") {
$htmlMediaTag .= "<!-- Video {$video['title']} {$video['filename']} -->" . getSources($video['filename']); $htmlMediaTag .= "<!-- Video {$video['title']} {$video['filename']} -->" . getSources($video['filename']);
} else { // video link } else { // video link
$url = AVideoPlugin::modifyURL($video['videoLink']); $url = AVideoPlugin::modifyURL($video['videoLink'], $video['id']);
//var_dump($video['videoLink'], $url);exit; //var_dump($video['videoLink'], $url);exit;
$htmlMediaTag .= "<!-- Video Link {$video['title']} {$video['filename']} --><source src='{$url}' type='" . ((strpos($video['videoLink'], 'm3u8') !== false) ? "application/x-mpegURL" : "video/mp4") . "' >"; $htmlMediaTag .= "<!-- Video Link {$video['title']} {$video['filename']} --><source src='{$url}' type='" . ((strpos($video['videoLink'], 'm3u8') !== false) ? "application/x-mpegURL" : "video/mp4") . "' >";
$html .= "<script>$(document).ready(function () {\$('time.duration').hide();});</script>"; $html .= "<script>$(document).ready(function () {\$('time.duration').hide();});</script>";

View file

@ -861,7 +861,7 @@ abstract class PluginAbstract {
] ]
* @return $file * @return $file
*/ */
function modifyURL($file) { function modifyURL($file, $videos_id=0) {
return $file; return $file;
} }