bandara1988 Posted July 2, 2010 Share Posted July 2, 2010 im currently using clipbucket script for one of my site and im trying to make a code to load the flv from another server. Need some php help to make it work. here is some codes i have modified THIS IS THE ARIGINAL FUNCTION /** * Function used to get all video files * @param Vdetails * @param $count_only * @param $with_path */ function get_all_video_files($vdetails,$count_only=false,$with_path=false) { $details = get_video_file($vdetails,true,$with_path,true,$count_only); if($count_only) return count($details); return $details; } function get_all_video_files_smarty($params) { $vdetails = $params['vdetails']; $count_only = $params['count_only']; $with_path = $params['with_path']; return get_all_video_files($vdetails,$count_only,$with_path); } /** * Function use to get video files */ function get_video_file($vdetails,$return_default=true,$with_path=true,$multi=false,$count_only=false,$hq=false) { global $Cbucket; # checking if there is any other functions # available if(is_array($Cbucket->custom_video_file_funcs)) foreach($Cbucket->custom_video_file_funcs as $func) if(function_exists($func)) return $func($vdetails, $hq); #Now there is no function so lets continue as $vid_files = glob(VIDEOS_DIR."/".$vdetails['file_name']."*"); #replace Dir with URL if(is_array($vid_files)) foreach($vid_files as $file) { $files_part = explode('/',$file); $video_file = $files_part[count($files_part)-1]; if($with_path) $files[] = VIDEOS_URL.'/'.$video_file; else $files[] = $video_file; } if(count($files)==0 && !$multi && !$count_only) { if($return_default) { if($with_path) return VIDEOS_URL.'/no_video.flv'; else return 'no_video.flv'; }else{ return false; } }else{ if($multi) return $files; if($count_only) return count($files); foreach($files as $file) { if($hq) { if(getext($file)=='mp4') { return $file; break; } }else{ return $file; break; } } return $files[0]; } } THIS IS WHAT I HAVE DONE /** * Function used to get all video files * @param Vdetails * @param $count_only * @param $with_path */ function get_all_video_files($vdetails,$count_only=false,$with_path=false) { $details = get_video_file($vdetails,true,$with_path,true,$count_only); if($count_only) return count($details); return $details; } function get_all_video_files_smarty($params) { $vdetails = $params['vdetails']; $count_only = $params['count_only']; $with_path = $params['with_path']; return get_all_video_files($vdetails,$count_only,$with_path); } /** * Function use to get video files */ function get_video_file($vdetails,$return_default=true,$with_path=true,$multi=false,$count_only=false,$hq=false) { global $Cbucket; # checking if there is any other functions # available if(is_array($Cbucket->custom_video_file_funcs)) foreach($Cbucket->custom_video_file_funcs as $func) if(function_exists($func)) return $func($vdetails, $hq); #Now there is no function so lets continue as $vid_files = glob(VIDEOS_DIR."/".$vdetails['file_name']."*"); #replace Dir with URL foreach($vid_files as $file) { $files_part = explode('/',$file); $video_file = $files_part[count($files_part)]; if($with_path) $files[] = 'http//'.$vdetails['video_server'].'/'.$video_file; else $files[] = $video_file; } } (need to stop glob() function because there are no files on the site server and need to change explode('/',$file); because the $file array is emty du to the glob() command.) i made a new coloum call "video_server" on the video table on mysql and this is how the player loads the flv file with the path (url) <videoPath value="<?php if($hd=='yes') echo get_hq_video_file($v); else echo get_video_file($v,true,true); ?>"/> can some one please help me Thank you Link to comment https://forums.phpfreaks.com/topic/206487-help-to-write-a-multi-server-function/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.