2014-02-16 37 views
0

我只是將ScriptCam插件複製到我的服務器上,並且在codeigniter「應用程序」文件夾外工作正常。我將「demo2.htm」的內容複製到.php文件中,並將其放置在CI應用程序的views文件夾中,但它不起作用。ScriptCam不能在CodeIgniter中工作

任何幫助是值得歡迎的, 邁克

<?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> 
+0

經過幾個小時的試圖找出這個問題,我注意到它的作品,如果我有demo.2文件設置爲默認路線。任何意識? –

回答

0

我找到了解決辦法。

我不得不在jQuery的加入這一行:

 $("#webcam").scriptcam({ 

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

我有一個Scriptcam非常令人失望的經歷。該軟件在10%的時間內工作,並且失敗了大約90%。它沒有將錄製的視頻上傳到我的FTP,並且「處理」時間耗盡了。我買了一個商業許可證,認爲我可以得到支持。支持從來沒有..請小心花費時間和精力用這個軟件..

+0

感謝您的諮詢!我注意到,他們也沒有支持。我現在正在使用其他軟件。 –

+0

你能告訴你現在使用哪種軟件嗎? 其實scriptcam工作正常,我也購買了許可證,但是當我的網站上線時,它突然停止工作。我現在對這個插件非常失望。 –