2 linzhuohao213 linzhuohao213 于 2014.10.29 20:35 提问

flashwavrecorder Demo 问题

我今天找到了一个可以再web页面上使用JS+FLASH来录音的开源代码——flashwavrecordr
但是我从github下载的Demo,却不能正确运行,后来我发现主要是Recorder 中的 recorder为空

后来我查了一下代码,recorder 这个属性是从一个事件里面进行处理的
[code=javascript]
window.fwr_event_handler = function fwr_event_handler() {
$('#status').text("Last recorder event: " + arguments[0]);
var name, $controls;
switch (arguments[0]) {
case "ready":
var width = parseInt(arguments[1]);
var height = parseInt(arguments[2]);
FWRecorder.uploadFormId = "#uploadForm";
FWRecorder.uploadFieldName = "upload_file[filename]";
FWRecorder.connect("recorderApp", 0);
FWRecorder.recorderOriginalWidth = width;
FWRecorder.recorderOriginalHeight = height;
$('.save_button').css({'width': width, 'height': height});
break;

  case "no_microphone_found":
    break;

  case "microphone_user_request":
    recorderEl().addClass("floating");
    FWRecorder.showPermissionWindow();
    break;

  case "microphone_connected":
    FWRecorder.isReady = true;
    $uploadStatus.css({'color': '#000'});
    break;

  case "permission_panel_closed":
    FWRecorder.defaultSize();
    recorderEl().removeClass("floating");
    break;

  case "microphone_activity":
    $('#activity_level').text(arguments[1]);
    break;

  case "recording":
    name = arguments[1];
    $controls = controlsEl(name);
    FWRecorder.hide();
    setControlsClass($controls, CLASS_RECORDING);
    break;

  case "recording_stopped":
    name = arguments[1];
    $controls = controlsEl(name);
    var duration = arguments[2];
    FWRecorder.show();
    setControlsClass($controls, CLASS_PLAYBACK_READY);
    $('#duration').text(duration.toFixed(4) + " seconds");
    break;

  case "microphone_level":
    $level.css({width: arguments[1] * 50 + '%'});
    break;

  case "observing_level":
    $showLevelButton.hide();
    $hideLevelButton.show();
    break;

  case "observing_level_stopped":
    $showLevelButton.show();
    $hideLevelButton.hide();
    $level.css({width: 0});
    break;

  case "playing":
    name = arguments[1];
    $controls = controlsEl(name);
    setControlsClass($controls, CLASS_PLAYING);
    break;

  case "playback_started":
    name = arguments[1];
    var latency = arguments[2];
    break;

  case "stopped":
    name = arguments[1];
    $controls = controlsEl(name);
    setControlsClass($controls, CLASS_PLAYBACK_READY);
    break;

  case "playing_paused":
    name = arguments[1];
    $controls = controlsEl(name);
    setControlsClass($controls, CLASS_PLAYBACK_PAUSED);
    break;

  case "save_pressed":
    FWRecorder.updateForm();
    break;

  case "saving":
    name = arguments[1];
    break;

  case "saved":
    name = arguments[1];
    var data = $.parseJSON(arguments[2]);
    if (data.saved) {
      $('#upload_status').css({'color': '#0F0'}).text(name + " was saved");
    } else {
      $('#upload_status').css({'color': '#F00'}).text(name + " was not saved");
    }
    break;

  case "save_failed":
    name = arguments[1];
    var errorMessage = arguments[2];
    $uploadStatus.css({'color': '#F00'}).text(name + " failed: " + errorMessage);
    break;

  case "save_progress":
    name = arguments[1];
    var bytesLoaded = arguments[2];
    var bytesTotal = arguments[3];
    $uploadStatus.css({'color': '#000'}).text(name + " progress: " + bytesLoaded + " / " + bytesTotal);
    break;
}

};
[/code]
我也添加了断点调试过,证明我操作的时候没有运行过这个代码。
请问有谁用过这个东西的,能给我解答一下

3个回答

showbo
showbo   Ds   Rxr 2014.11.18 16:21

发布网站通过http访问试试,js要控制flash或者调用flash里面的方法要发布后才能执行,否则报错

你也可以用开发工具如chrome的开发人员工具,或者firebug看看提示什么错误

alfrag
alfrag   2017.06.25 18:53

是swf文件地址的问题,在mian.js里面修改

qq_29713531
qq_29713531 请问如果我改变了Recorder.as如何编译重新生成recorder.swf
11 个月之前 回复
qq_35859392
qq_35859392   2018.04.28 14:07

放在本地服务器可以使用,但是ie浏览器没有用....

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!