ScriptCam not working in CodeIgniter
I just copy the ScriptCam plugin to my server and outside the codeigniter "application" folder it works fine. I copyed the contents of the "demo2.htm" into a .php file and place it in the views folder
folder in the CI application and it doesn't work.
Any help is welcome,
Mike
- <?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>
- <span style="padding-left:5px;padding-right:5px;">
- Time left:
- <input type="text" id="timeLeft" style="width:50px;font-size:10px;">
- </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>