How to save files in my server with ScriptCam plugin

偶尔善良 提交于 2019-12-04 05:31:48

问题


I want the users of my website to stream video in the website and preview it. then they can click save and the file is saved in the website's server. I found this plugin

It seem to work fine, but the problem is that after it makes the file conversion it gives me a link to download the file whis supposedely is kept in ScriptCam's own server. I also noticed that their server URL is pre appended to the "fileName" variable. i don't know where it's coming from.

Any help is welcome, Mike


回答1:


Actually You can save the video file in your server. In that case you have to go to the code from where the link is generated. Then send the video url to a php page via ajax $.post method.Then in the php page write a php "copy" function. See the code below :-

First go to the fileReady() in the index.php page to get the video url:-

function fileReady(fileName) {
    $('#recorder').hide();              
    $('#message').html('This file is now dowloadable for five minutes over 
                <a href='+fileName+'>here</a>.');
    var x=fileName;

    if (x != null){
    $.post('ack.php', {x: x}, function(){
        //successful ajax request
    }).error(function(){
        alert('error... ohh no!');
    });

}

var fileNameNoExtension=fileName.replace(".mp4", "");
    jwplayer("mediaplayer").setup({
        width:320,
        height:240,
        file: fileName,
        image: fileNameNoExtension+"_0000.jpg"
    });

    $('#mediaplayer').show();
}

the create a php page as I have created as ack.php. then write the following code:- ack.php

$val=$_POST['x'];

$file = $val; 
$newfile = 'video/output.mp4'; 

if (!copy($file, $newfile)) { 
    echo "failed to copy $file...\n"; 
} 

This works fine but the problem is that the video quality is not very good. If anyone can give me solution that how can I increase the video quality in scriptcam then that will be very helpful for me.




回答2:


Sorry, I found out I had to register and set up the ftp options and also allow incoming connections on my server.



来源:https://stackoverflow.com/questions/21791850/how-to-save-files-in-my-server-with-scriptcam-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!