• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

jrecorder插件问题

php 搞代码 4年前 (2022-01-25) 29次浏览 已收录 0个评论
文章目录[隐藏]

问题是这样的:前几天我在网上下了一个插件jrecorder,这是一个不需要任何flash编程技术就可以实现在线录音的jquery插件,但问题出现了,我在http://www.sajithmr.me/jrecorder/exam… 上下了插件,也按照提示把插件装在本地服务器上,但是老是出错:Uncaught TypeError: Object # has no method ‘jStartRecording’ ;jStartRecording函数在jrecorder.js中:

//function call to start a recording	$.jRecorder.record = function(max_time){		//change z-index to make it top	$(  '#' + jRecorderSettings['recorderlayout_id'] ).css('z-index', 1000);    getFlashMovie(jRecorderSettings['recorder_name']).jStartRecording(max_time);} 

本地测试时使用的代码:

<meta name="author" content="Sajith Amma" /><script src="../js/jquery.min.js"> </script><script src="../js/jRecorder-1.0-old.js"> </script><title>jRecorder Example</title>  <body> <div id="locationforrecorder" style="border:1px solid grey"></div>  <script>$.jRecorder(         {      host : 'http://localhost/nahan/recorder/acceptfile.php?filename=hello.wav' ,             callback_started_recording:     function(){callback_started(); },     callback_stopped_recording:     function(){callback_stopped(); },     callback_activityLevel:  function(level){callback_activityLevel(level); },     callback_activityTime:     function(time){callback_activityTime(time); },     callback_finished_sending:     function(time){ callback_finished_sending() },     swf_path : 'jRecorder.swf',    }    , $('#locationforrecorder')    );</script>  <div style="background-color: #eeeeee;border:1px solid #cccccc">      Time: <span id="time">00:00</span>    </div>  <div>    Level: <span id="level"></span>  </div>    <div id="levelbase" style="width:200px;height:20px;background-color:#ffff00">     <div id="levelbar" style="height:19px;width:2px;background-color:red"></div>    </div>  <div>    Status: <span id="status">  </div>   <div>              </div>  <script type="text/javascript">                    $('#record').click(function(){      $.jRecorder.record(30);                       })                      $('#stop').click(function(){                                           $.jRecorder.stop();                                        })                     function callback_finished()    {            $('#status').html('Recording is finished');                       }                     function callback_started()    {             $('#status').html('Recording is started');    }      function callback_error(code)      {         $('#status').html('Error, code:' + code);      }   function callback_stopped()    {      $('#status').html('Stop request is accepted');    }   function callback_finished_recording()    {                          $('#status').html('Recording event is finished');                                           }   function callback_finished_sending()    {                         $('#status').html('File has been sent to server mentioned as host parameter');    }   function callback_activityLevel(level)    {                         $('#level').html(level);                            if(level == -1)         {            $('#levelbar').css("width",  "2px");         }         else         {            $('#levelbar').css("width", (level * 2)+ "px");         }                                            }    function callback_activityTime(time)     {                          //$('.flrecorder').css("width", "1px");        //$('.flrecorder').css("height", "1px");        $('#time').html(time);                         }     </script>

我查看了网上那个示例的源代码,发现和我本地上的代码没有区别,所以真的很郁闷,到底哪里出错了?

回复内容:

问题是这样的:前几天我在网上下了一个插件jrecorder,这是一个不需要任何flash编程技术就可以实现在线录音的jquery插件,但问题出现了,我在http://www.sajithmr.me/jrecorder/exam… 上下了插件,也按照提示把插件装在本地服务器上,但是老是出错:Uncaught TypeError: Object # has no method ‘jStartRecording’ ;jStartRecording函数在jrecorder.js中:

//function call to start a recording	$.jRecorder.record = function(max_time){		//change z-index to make it top	$(  '#' + jRecorderSettings['recorderlayout_id'] ).css('z-index', 1000);    getFlashMovie(jRecorderSettings['recorder_name']).jStartRecording(max_time);} 

本地测试时使用的代码:

<meta name="author" content="Sajith Amma" /><script src="../js/jquery.min.js"> </script><script src="../js/jRecorder-1.0-old.js"> </script><title>jRecorder Example</title>  <body> <div id="locationforrecorder" style="border:1px solid grey"></div>  <script>$.jRecorder(         {      host : 'http://localhost/nahan/recorder/acceptfile.php?filename=hello.wav' ,             callback_started_recording:     function(){callback_started(); },     callback_stopped_recording:     function(){callback_stopped(); },     callback_activityLevel:  function(level){callback_activityLevel(level); },     callback_activityTime:     function(time){callback_activityTime(time); },     callback_finished_sending:     function(time){ callback_finished_sending() },     swf_path : 'jRecorder.swf',    }    , $('#locationforrecorder')    );</script>  <div style="background-color: #eeeeee;border:1px solid #cccccc">      Time: <span id="time">00:00</span>    </div>  <div>    Level: <span id="level"></span>  </div>    <div id="levelbase" style="width:200px;height:20px;background-color:#ffff00">     <div id="levelbar" style="height:19px;width:2px;background-color:red"></div>    </div>  <div>    Status: <span id="status">  </div>   <div>              </div>  <script type="text/javascript">                    $('#record').click(function(){      $.jRecorder.record(30);                       })                      $('#stop').click(function(){                                           $.jRecorder.stop();                                        })                     function callback_finished()    {            $('#status').html('Recording is finished');                       }                     function callback_started()    {             $('#status').html('Recording is started');    }      function callback_error(code)      {         $('#status').html('Error, code:' + code);      }   function callback_stopped()    {      $('#status').html('Stop request is accepted');    }   function callback_finished_recording()    {                          $('#status').html('Recording event is finished');                                           }   function callback_finished_sending()    {   <i style="color:transparent">本#文来源gaodai$ma#com搞$$代**码网$</i><button>搞代gaodaima码</button>                      $('#status').html('File has been sent to server mentioned as host parameter');    }   function callback_activityLevel(level)    {                         $('#level').html(level);                            if(level == -1)         {            $('#levelbar').css("width",  "2px");         }         else         {            $('#levelbar').css("width", (level * 2)+ "px");         }                                            }    function callback_activityTime(time)     {                          //$('.flrecorder').css("width", "1px");        //$('.flrecorder').css("height", "1px");        $('#time').html(time);                         }     </script>

我查看了网上那个示例的源代码,发现和我本地上的代码没有区别,所以真的很郁闷,到底哪里出错了?

把所有JS代码放到$(function() { ~~~~~~~~放置jRecorder代码~~~~~~~~~~~ })

解决了没有?


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:jrecorder插件问题

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址