modified : issues fixed

This commit is contained in:
Fahad Abbas 2017-03-22 13:11:00 +05:00
parent 691e73bb27
commit 6d94fe9ecf
7 changed files with 111 additions and 20 deletions

View file

@ -153,8 +153,7 @@
}
logData($ffmpeg->video_files,'video_files');
/*$sprite_count = $ffmpeg->sprite_count;*/
$video_files = json_encode($ffmpeg->video_files);
$db->update(tbl('video'), array("video_files"), array($video_files), " file_name = '{$outputFileName}'");

View file

@ -5,4 +5,5 @@ INSERT INTO `{tbl_prefix}config`(`name`, `value`) VALUES ('popup_video','yes');
-- These fields are being partially used in this version.
ALTER TABLE `{tbl_prefix}video` ADD `re_conv_status` text(33) NOT NULL;
ALTER TABLE `{tbl_prefix}video` ADD `conv_progress` int(33) NOT NULL;
ALTER TABLE `{tbl_prefix}video` ADD `conv_progress` int(33) NOT NULL;
ALTER TABLE `{tbl_prefix}video` ADD `sprite_count` INT(11) NOT NULL DEFAULT '0' AFTER `conv_progress`;

View file

@ -789,6 +789,31 @@
}
}
public function generate_sprites(){
$this->log->writeLine("Genrating Video Sprite","Starting" );
try{
$interval = $this->inputDetails['duration'] / 10 ;
mkdir(SPRITES_DIR . '/' . $this->fileDirectory, 0777, true);
$this->sprite_output = SPRITES_DIR.'/'.$this->outputDirectory.'/'.$this->fileName."%d.png";
$command = $this->ffmpegPath." -i ".$this->input_file." -f image2 -s 168x105 -bt 20M -vf fps=1/".$interval." ".$this->sprite_output;
$this->TemplogData .= "\r\nSprite Command : ".$command."\r\n";
$this->TemplogData .= "\r\nOutput : ".$this->sprite_output."\r\n";
$this->exec($command);
$this->TemplogData .= "\r\n File : ".$this->sprite_file."\r\n";
}catch(Exception $e){
$this->TemplogData .= "\r\n Errot Occured : ".$e->getMessage()."\r\n";
}
$this->TemplogData .= "\r\n ====== End : Sprite Generation ======= \r\n";
$this->log->writeLine("End Sprite", $this->TemplogData , true );
}
/**
* This is where all begins and video conversion is initiated.
* This function then takes care of everything like setting resoloutions,
@ -868,6 +893,8 @@
} catch(Exception $e) {
$this->TemplogData .= "\r\n Errot Occured : ".$e->getMessage()."\r\n";
}
//Genrating sprite for the video
$this->generate_sprites();
$this->TemplogData .= "\r\n ====== End : Thumbs Generation ======= \r\n";

View file

@ -46,6 +46,7 @@ class FFMpeg{
public $big_thumb_dim = "";
public $cb_combo_res = "";
public $res_configurations = "";
public $sprite_count = 0;
public $thumbs_res_settings = array(
"original" => "original",
'105' => array('168','105'),
@ -947,7 +948,8 @@ class FFMpeg{
}
$this->TemplogData .= "\r\n ====== End : Thumbs Generation ======= \r\n";
$this->log->writeLine("Thumbs Files", $this->TemplogData , true );
$hr = $this->configs['high_res'];
$this->configs['video_width'] = $res[$nr][0];
$this->configs['format'] = 'mp4';

View file

@ -322,6 +322,7 @@
define('FILES_DIR',BASEDIR.'/files');
define('VIDEOS_DIR',FILES_DIR.'/videos');
define('THUMBS_DIR',FILES_DIR.'/thumbs');
define('SPRITES_DIR',FILES_DIR.'/sprites');
define('ORIGINAL_DIR',FILES_DIR.'/original');
define('TEMP_DIR',FILES_DIR.'/temp');
define('CON_DIR',FILES_DIR.'/conversion_queue');
@ -339,6 +340,7 @@
define('FILES_URL',BASEURL.'/files');
define('VIDEOS_URL',FILES_URL.'/videos');
define('THUMBS_URL',FILES_URL.'/thumbs');
define('SPRITES_URL',FILES_URL.'/sprites');
define('ORIGINAL_URL',FILES_URL.'/original');
define('TEMP_URL',FILES_URL.'/temp');
define("PLAYER_DIR",BASEDIR.'/player');

View file

@ -2210,3 +2210,57 @@
return $qual;
}
}
/**
* Used to get Sprite file against video
* @since : 21 March, 2017
*/
function get_video_sprite($video) {
try {
$filename = $video['file_name'];
$videoid = $video['videoid'];
$file_directory = $video['file_directory'];
$file = SPRITES_DIR.'/'.$file_directory.'/'.$filename.'-sprite.png';
if (file_exists($file)){
$file = SPRITES_URL.'/'.$file_directory.'/'.$filename.'-sprite.png';
$response['file'] = $file;
}else{
$response['file'] = false;
}
$sprite_count = get_video_sprite_count($videoid);
$response['count'] = $sprite_count;
return $response;
}catch(Exception $e){
echo "Caught Exception". $e->getMessage();
}
}
/**
* Used to get Sprite count against video
* @since : 21 March, 2017
*/
function get_video_sprite_count($videoid){
try{
$videoid = (int)$videoid;
if ($videoid){
$query = " SELECT sprite_count FROM ".tbl("video");
$query .= " WHERE videoid='".$videoid."' ";
$sprite_count = db_select($query);
if (is_array($sprite_count)){
$sprite_count = $sprite_count[0]['sprite_count'];
}else{
$sprite_count = 0;
}
return $sprite_count;
}
}catch(Exception $e){
echo "Caught Exception". $e->getMessage();
}
}

View file

@ -49,6 +49,8 @@
<link href="{$cb_vjs_player_url}/css/videojs.ads.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs.ima.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/cb_vjs_resolution.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs-chromecast.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs.thumbnails.css" rel="stylesheet">
{if $development_mode}
<script src="{$cb_vjs_player_url}/js/video-js.js"></script>
@ -75,6 +77,9 @@
<script src="{$cb_vjs_player_url}/js/cb_ultimate_ads.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs.relatedCarousel.js"></script>
<script src="{$cb_vjs_player_url}/js/iphone-inline-video.browser.js"></script>
<script src="http://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs-chromecast.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs.thumbnails.js"></script>
{$default_quality = get_cbvjs_quality_type($video_files)}
@ -164,8 +169,23 @@
dynamicLabel : false
}
cb_vjs.videoJsResolutionSwitcher(res_options);
var stateCheck = setInterval(function(){
if (document.readyState === 'complete') {
clearInterval(stateCheck);
var cbVjsMenuBtn = document.querySelector('.vjs-resolution-button');
if (cbVjsMenuBtn){
var cbVjsMenu = cbVjsMenuBtn.children[0];
var cbVjsMenuContent = cbVjsMenu.children[0];
var cbVjsMenuContentRes = cbVjsMenuContent.children;
for (var i = 0; i < cbVjsMenuContentRes.length; i++ ){
cbVjsMenuContent.insertBefore(cbVjsMenuContentRes[i],cbVjsMenuContent.firstChild);
}
}
}
},100);
//Calling Resolution switcher plugin
//Calling Ima Ads plugin
if (play_ad){
var ad_options = {
ad_id: ad_id,
@ -224,21 +244,7 @@
cb_vjs.interactiveAds(i_instances_settings);
}
var stateCheck = setInterval(function(){
if (document.readyState === 'complete') {
clearInterval(stateCheck);
var cbVjsMenuBtn = document.querySelector('.vjs-resolution-button');
if (cbVjsMenuBtn){
var cbVjsMenu = cbVjsMenuBtn.children[0];
var cbVjsMenuContent = cbVjsMenu.children[0];
var cbVjsMenuContentRes = cbVjsMenuContent.children;
for (var i = 0; i < cbVjsMenuContentRes.length; i++ ){
cbVjsMenuContent.insertBefore(cbVjsMenuContentRes[i],cbVjsMenuContent.firstChild);
}
}
}
},100);
}
//Initializing