ScriptCam在CodeIgniter中不起作用

时间:2014-02-16 20:42:15

标签: codeigniter jquery-plugins

我只是将ScriptCam插件复制到我的服务器并在codeigniter“application”文件夹之外,它可以正常工作。我将“demo2.htm”的内容复制到.php文件中,并将其放在CI应用程序的views文件夹文件夹中,但它不起作用。

欢迎任何帮助, 麦克

<?php require_once('inc.php');?>

                <!DOCTYPE HTML>
                <html>
                <head>
                 <title>Test</title>
                 <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1">

                 <meta name="description" content="" >
                 <meta name="keywords" content="" >
                 <meta name="robots" content="index, follow" >
                 <link rel="stylesheet" type="text/css" href="<?php echo site_url();?>css/styles.css" media="screen" >
                    <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
                 <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
                 <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
                 <!-- Please download the JW Player plugin from http://www.longtailvideo.com/jw-player/download -->
                 <!--<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>-->
                 <script language="JavaScript" src="<?php echo site_url();?>js/lib/ScriptCam-master/scriptcam.js"></script>
                 <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

                 <script>
                 $(document).ready(function() {
                 $("#webcam").scriptcam({ 
                 fileReady:fileReady,
                 cornerRadius:20,
                 cornerColor:'e3e5e2',
                 onError:onError,
                 promptWillShow:promptWillShow,
                 showMicrophoneErrors:false,
                 onWebcamReady:onWebcamReady,
                 setVolume:setVolume,
                 timeLeft:timeLeft,
                 fileName:'Stella',
                 connected:showRecord
                 });
                 setVolume(0);
                 $("#slider").slider({ animate: true, min: 0, max: 100 , value: 50, orientation: 'vertical', disabled:true});
                 $("#slider").bind( "slidechange", function(event, ui) {
                 $.scriptcam.changeVolume($( "#slider" ).slider( "option", "value" ));
                 });
                 });
                 function showRecord() {
                 $( "#recordStartButton" ).attr( "disabled", false );
                 }
                 function startRecording() {
                 $( "#recordStartButton" ).attr( "disabled", true );
                 $( "#recordStopButton" ).attr( "disabled", false );
                 $( "#recordPauseResumeButton" ).attr( "disabled", false );
                 $.scriptcam.startRecording();
                 }
                 function closeCamera() {
                 $("#slider").slider( "option", "disabled", true );
                 $("#recordPauseResumeButton" ).attr( "disabled", true );
                 $("#recordStopButton" ).attr( "disabled", true );
                 $.scriptcam.closeCamera();
                 $('#message').html('Please wait for the file conversion to finish...');
                 }
                 function pauseResumeCamera() {
                 if ($( "#recordPauseResumeButton" ).html() == 'Pause Recording') {
                 $( "#recordPauseResumeButton" ).html( "Resume Recording" );
                 $.scriptcam.pauseRecording();
                 }
                 else {
                 $( "#recordPauseResumeButton" ).html( "Pause Recording" );
                 $.scriptcam.resumeRecording();
                 }
                 }
                 function fileReady(fileName) {
                 $('#recorder').hide();
                 $('#message').html('This file is now dowloadable for five minutes over <a href='+fileName+'">here</a>.');
                 var fileNameNoExtension=fileName.replace(".mp4", "");
                 jwplayer("mediaplayer").setup({
                 width:320,
                 height:240,
                 file: fileName,
                 image: fileNameNoExtension+"_0000.jpg"
                 });
                 $('#mediaplayer').show();
                 }
                 function onError(errorId,errorMsg) {
                 alert(errorMsg);
                 }
                 function onWebcamReady(cameraNames,camera,microphoneNames,microphone,volume) {
                 $( "#slider" ).slider( "option", "disabled", false );
                 $( "#slider" ).slider( "option", "value", volume );
                 $.each(cameraNames, function(index, text) {
                 $('#cameraNames').append( $('<option></option>').val(index).html(text) )
                 }); 
                 $('#cameraNames').val(camera);
                 $.each(microphoneNames, function(index, text) {
                 $('#microphoneNames').append( $('<option></option>').val(index).html(text) )
                 }); 
                 $('#microphoneNames').val(microphone);
                 }
                 function promptWillShow() {
                 alert('A security dialog will be shown. Please click on ALLOW.');
                 }
                 function setVolume(value) {
                 value=parseInt(32 * value / 100) + 1;
                 for (var i=1; i < value; i++) {
                 $('#LedBar' + i).css('visibility','visible');
                 }
                 for (i=value; i < 33; i++) {
                 $('#LedBar' + i).css('visibility','hidden');
                 }
                 }
                 function timeLeft(value) {
                 $('#timeLeft').val(value);
                 }
                 function changeCamera() {
                 $.scriptcam.changeCamera($('#cameraNames').val());
                 }
                 function changeMicrophone() {
                 $.scriptcam.changeMicrophone($('#microphoneNames').val());
                 }
                 </script>


                </head>

                <body>
                 <?php PublicHeader();?>
                <section id="wrapper">


                 <section>
                                 <h1>Main Menu</h1>    
                                  <div id="message"></div>
                 <div id="recorder">
                 <div id="webcam">
                 </div>
                 <div id="volumePanel" style="float:left;position:relative;top:10px;">
                 <div id="volumeMeter" style="position:absolute;top:10px;left:7px;float:left;">
                 <img id="LedBar32" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar31" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar30" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar29" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar28" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar27" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar26" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar25" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar24" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar23" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar22" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar21" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
                 <img id="LedBar20" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar19" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar18" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar17" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar16" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar15" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar14" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar13" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar12" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar11" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar10" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar9" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar8" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar7" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar6" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar5" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar4" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar3" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar2" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 <img id="LedBar1" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
                 </div>
                 <div id="slider" style="position:absolute;top:10px;left:30px;">
                 </div>
                 </div>
                 <br clear="both"/>
                 <div id="setupPanel">
                 <img src="<?php echo site_url();?>js/lib/ScriptCam-master/webcamlogo.png" style="vertical-align:text-top"/>
                 <select id="cameraNames" size="1" onChange="changeCamera()" style="width:145px;font-size:10px;height:25px;">
                 </select>
                 <img src="<?php echo site_url();?>js/lib/ScriptCam-master/miclogo.png" style="vertical-align:text-top;padding-left:45px;"/>
                 <select id="microphoneNames" size="1" onChange="changeMicrophone()" style="width:128px;font-size:10px;height:25px;">
                 </select>
                 </div>
                 <br/>
                 <button id="recordStartButton" class="btn btn-small" onclick="startRecording()" disabled>Start Recording</button>&nbsp;
                 <span style="padding-left:5px;padding-right:5px;">
                 Time left:
                 <input type="text" id="timeLeft" style="width:50px;font-size:10px;">&nbsp;
                 </span>
                 <button id="recordPauseResumeButton" class="btn btn-small" onclick="pauseResumeCamera()" disabled>Pause Recording</button>
                 <button id="recordStopButton" class="btn btn-small" onclick="closeCamera()" disabled>Stop Recording</button>
                 </div>
                 <div id="mediaplayer" style="display:none;"></div>





                <!-- //////////////////////////////////////////// -->         
                           </section>
                           </section>

                </section>
                <?php PublicFooter();?>
                </body>

                </html>

2 个答案:

答案 0 :(得分:1)

我对Scriptcam的体验非常令人失望。该软件有10%的时间工作,失败率约为90%。它没有将录制的视频上传到我的FTP,“处理”时间耗尽了。我买了一张商业执照,以为我可以获得支持。支持从未到来..请注意花时间和精力使用此软件..

答案 1 :(得分:0)

我找到了解决方案。

我不得不在jquery中添加这一行:

       $("#webcam").scriptcam({

            path: '<?php echo $this->config->base_url(); ?>',
          ...