[eluser]AndrewMalachel[/eluser]
I think what "metaltapimenye" tried to say is:
first:
you run your view first without doing the exec():
Code:
$data['error']="Thank you, your video has been .... we have finished converting the file";
$this->load->view('upload/error',$data);
but, also you add AJAX request in the view that call a controller to run the exec()
view:
Code:
<html>
<head></head>
<body>
<?=$error;?>
<img src="ajax_wait.gif" />
<js>
/**
* Do Ajax.request here, call your controller that run the exec()
* exmpl: "ajax/do_exec"
*
* on Ajax.success, do the redirect with javascript
* exmpl: document.location.href = "/convert_success/";
* or maybe: document.location.reload(); //if you want the page to be refreshed...
* wherever your want it to be redirected
**/
// exmpl : goes something like these on jQuery....
ajax_run = $.ajax({
type: 'POST',
url: '<?=base_url();?>ajax/do_exec', // your "ajax-to-do-the-exec" controller
timeout: 999999, // or forever?? hahaha...
data: data_or_parameter_of_the_video_your_exec_want_to_handle,
success: function(response) {
// if success, redirect this page to:
if(response == 'exec_ok') /* see the return on your controller after this */
document.location.href = '<?=base_url();?>video/convert_success';
else /* if something happen during your exec run, redirect to: */
document.location.href = '<?=base_url();?>video/convert_failed'
},
error: function() {
// alse if any error occured, or timeout, redirect this page to:
document.location.href = '<?=base_url();?>video/convert_failed'
}
})
// done!!!
</js>
</body></html>
and your ajax controller would look like these:
Code:
class Ajax extends Controller {
function Ajax() {
parent::Controller();
// ... and all your construction needed...
}
function do_exec() {
// ... do all your stuff for your exec parameters
// and then your exec:
exec("nohup ffmpeg -i ".$s." -ar 22050 -ab 32k -f flv -s 320x240 ".$d);
// after the exec success, return this for your ajax:
echo "exec_ok";
/*
or do something like try..catch so if error occurred,
you can send other message to the ajax something like "exec_KO"
*/
}
}
well, that's it, I suppose...
Oyeah, last but not least, sorry for my lack of english.... :-D :-D :-D