如何使用ScriptCam插件将文件保存在服务器中 [英] How to save files in my server with ScriptCam plugin

查看:108
本文介绍了如何使用ScriptCam插件将文件保存在服务器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望网站的用户在网站中流式传输视频并对其进行预览. 然后他们可以单击保存"并将文件保存在网站的服务器中.我发现了这个插件

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

它似乎可以正常工作,但是问题是,在完成文件转换后,它为我提供了一个下载文件的链接,据说该文件保存在ScriptCam自己的服务器中.我还注意到,他们的服务器URL已预先附加到"fileName"变量中.我不知道它从哪里来.

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.

欢迎任何帮助, 迈克

推荐答案

实际上,您可以将视频文件保存在服务器中.在这种情况下,您必须转到生成链接的代码.然后通过ajax $.post方法将视频网址发送到php页面.然后在php页面中编写一个php复制"功能.参见下面的代码:-

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 :-

首先转到index.php页面中的fileReady()以获取视频网址:-

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();
}

创建一个我创建为ack.php的php页面.然后编写以下代码:- ack.php

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"; 
} 

这很好,但是问题是视频质量不是很好.如果有人可以为我提供如何提高scriptcam视频质量的解决方案,那对我将非常有帮助.

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.

这篇关于如何使用ScriptCam插件将文件保存在服务器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆