问题是这样的:前几天我在网上下了一个插件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);
}
本地测试时使用的代码:
<html>
<head>
<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>
</head>
<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"></status>
</div>
<div>
<input type="button" id="record" value="Record" style="color:red">
<input type="button" id="stop" value="Stop">
</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>
</body>
</html>
我查看了网上那个示例的源代码,发现和我本地上的代码没有区别,所以真的很郁闷,到底哪里出错了?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。