ScriptCam not working in CodeIgniter

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

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

  2. <!DOCTYPE HTML>
  3. <html>
  4. <head>
  5. <title>Test</title>
  6. <meta charset="UTF-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1">

  8. <meta name="description" content="" >
  9. <meta name="keywords" content="" >
  10. <meta name="robots" content="index, follow" >
  11. <link rel="stylesheet" type="text/css" href="<?php echo site_url();?>css/styles.css" media="screen" >
  12.     <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  13. <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
  14. <script language="JavaScript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
  15. <!-- Please download the JW Player plugin from http://www.longtailvideo.com/jw-player/download -->
  16. <!--<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>-->
  17. <script language="JavaScript" src="<?php echo site_url();?>js/lib/ScriptCam-master/scriptcam.js"></script>
  18. <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  19.   
  20. <script>
  21. $(document).ready(function() {
  22. $("#webcam").scriptcam({ 
  23. fileReady:fileReady,
  24. cornerRadius:20,
  25. cornerColor:'e3e5e2',
  26. onError:onError,
  27. promptWillShow:promptWillShow,
  28. showMicrophoneErrors:false,
  29. onWebcamReady:onWebcamReady,
  30. setVolume:setVolume,
  31. timeLeft:timeLeft,
  32. fileName:'Stella',
  33. connected:showRecord
  34. });
  35. setVolume(0);
  36. $("#slider").slider({ animate: true, min: 0, max: 100 , value: 50, orientation: 'vertical', disabled:true});
  37. $("#slider").bind( "slidechange", function(event, ui) {
  38. $.scriptcam.changeVolume($( "#slider" ).slider( "option", "value" ));
  39. });
  40. });
  41. function showRecord() {
  42. $( "#recordStartButton" ).attr( "disabled", false );
  43. }
  44. function startRecording() {
  45. $( "#recordStartButton" ).attr( "disabled", true );
  46. $( "#recordStopButton" ).attr( "disabled", false );
  47. $( "#recordPauseResumeButton" ).attr( "disabled", false );
  48. $.scriptcam.startRecording();
  49. }
  50. function closeCamera() {
  51. $("#slider").slider( "option", "disabled", true );
  52. $("#recordPauseResumeButton" ).attr( "disabled", true );
  53. $("#recordStopButton" ).attr( "disabled", true );
  54. $.scriptcam.closeCamera();
  55. $('#message').html('Please wait for the file conversion to finish...');
  56. }
  57. function pauseResumeCamera() {
  58. if ($( "#recordPauseResumeButton" ).html() == 'Pause Recording') {
  59. $( "#recordPauseResumeButton" ).html( "Resume Recording" );
  60. $.scriptcam.pauseRecording();
  61. }
  62. else {
  63. $( "#recordPauseResumeButton" ).html( "Pause Recording" );
  64. $.scriptcam.resumeRecording();
  65. }
  66. }
  67. function fileReady(fileName) {
  68. $('#recorder').hide();
  69. $('#message').html('This file is now dowloadable for five minutes over <a href='+fileName+'">here</a>.');
  70. var fileNameNoExtension=fileName.replace(".mp4", "");
  71. jwplayer("mediaplayer").setup({
  72. width:320,
  73. height:240,
  74. file: fileName,
  75. image: fileNameNoExtension+"_0000.jpg"
  76. });
  77. $('#mediaplayer').show();
  78. }
  79. function onError(errorId,errorMsg) {
  80. alert(errorMsg);
  81. }
  82. function onWebcamReady(cameraNames,camera,microphoneNames,microphone,volume) {
  83. $( "#slider" ).slider( "option", "disabled", false );
  84. $( "#slider" ).slider( "option", "value", volume );
  85. $.each(cameraNames, function(index, text) {
  86. $('#cameraNames').append( $('<option></option>').val(index).html(text) )
  87. }); 
  88. $('#cameraNames').val(camera);
  89. $.each(microphoneNames, function(index, text) {
  90. $('#microphoneNames').append( $('<option></option>').val(index).html(text) )
  91. }); 
  92. $('#microphoneNames').val(microphone);
  93. }
  94. function promptWillShow() {
  95. alert('A security dialog will be shown. Please click on ALLOW.');
  96. }
  97. function setVolume(value) {
  98. value=parseInt(32 * value / 100) + 1;
  99. for (var i=1; i < value; i++) {
  100. $('#LedBar' + i).css('visibility','visible');
  101. }
  102. for (i=value; i < 33; i++) {
  103. $('#LedBar' + i).css('visibility','hidden');
  104. }
  105. }
  106. function timeLeft(value) {
  107. $('#timeLeft').val(value);
  108. }
  109. function changeCamera() {
  110. $.scriptcam.changeCamera($('#cameraNames').val());
  111. }
  112. function changeMicrophone() {
  113. $.scriptcam.changeMicrophone($('#microphoneNames').val());
  114. }
  115. </script>


  116. </head>

  117. <body>
  118.  <?php PublicHeader();?>
  119. <section id="wrapper">


  120. <section>
  121.                  <h1>Main Menu</h1>    
  122.                   <div id="message"></div>
  123. <div id="recorder">
  124. <div id="webcam">
  125. </div>
  126. <div id="volumePanel" style="float:left;position:relative;top:10px;">
  127. <div id="volumeMeter" style="position:absolute;top:10px;left:7px;float:left;">
  128. <img id="LedBar32" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  129. <img id="LedBar31" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  130. <img id="LedBar30" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  131. <img id="LedBar29" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  132. <img id="LedBar28" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  133. <img id="LedBar27" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  134. <img id="LedBar26" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  135. <img id="LedBar25" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  136. <img id="LedBar24" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  137. <img id="LedBar23" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  138. <img id="LedBar22" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  139. <img id="LedBar21" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledred.png">
  140. <img id="LedBar20" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  141. <img id="LedBar19" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  142. <img id="LedBar18" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  143. <img id="LedBar17" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  144. <img id="LedBar16" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  145. <img id="LedBar15" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  146. <img id="LedBar14" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  147. <img id="LedBar13" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  148. <img id="LedBar12" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  149. <img id="LedBar11" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  150. <img id="LedBar10" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  151. <img id="LedBar9" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  152. <img id="LedBar8" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  153. <img id="LedBar7" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  154. <img id="LedBar6" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  155. <img id="LedBar5" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  156. <img id="LedBar4" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  157. <img id="LedBar3" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  158. <img id="LedBar2" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  159. <img id="LedBar1" src="<?php echo site_url();?>js/lib/ScriptCam-master/ledgreen.png">
  160. </div>
  161. <div id="slider" style="position:absolute;top:10px;left:30px;">
  162. </div>
  163. </div>
  164. <br clear="both"/>
  165. <div id="setupPanel">
  166. <img src="<?php echo site_url();?>js/lib/ScriptCam-master/webcamlogo.png" style="vertical-align:text-top"/>
  167. <select id="cameraNames" size="1" onChange="changeCamera()" style="width:145px;font-size:10px;height:25px;">
  168. </select>
  169. <img src="<?php echo site_url();?>js/lib/ScriptCam-master/miclogo.png" style="vertical-align:text-top;padding-left:45px;"/>
  170. <select id="microphoneNames" size="1" onChange="changeMicrophone()" style="width:128px;font-size:10px;height:25px;">
  171. </select>
  172. </div>
  173. <br/>
  174. <button id="recordStartButton" class="btn btn-small" onclick="startRecording()" disabled>Start Recording</button>&nbsp;
  175. <span style="padding-left:5px;padding-right:5px;">
  176. Time left:
  177. <input type="text" id="timeLeft" style="width:50px;font-size:10px;">&nbsp;
  178. </span>
  179. <button id="recordPauseResumeButton" class="btn btn-small" onclick="pauseResumeCamera()" disabled>Pause Recording</button>
  180. <button id="recordStopButton" class="btn btn-small" onclick="closeCamera()" disabled>Stop Recording</button>
  181. </div>
  182. <div id="mediaplayer" style="display:none;"></div>





  183. <!-- //////////////////////////////////////////// -->         
  184.            </section>
  185.            </section>

  186. </section>
  187. <?php PublicFooter();?>
  188. </body>

  189. </html>