2012-05-04 45 views
0

用java api使用wami录音机需要wich文件。我有它与Flash版本包含 index.html作为跟随用java java wami recoreder

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html> 
<head> 
<!-- swfobject is a commonly used library to embed Flash content --> 
<script type="text/javascript" 
    src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> 

<!-- Setup the recorder interface --> 
<script type="text/javascript" src="recorder.js"></script> 

<script> 
    function setup() { 
      Wami.setup("wami"); 
    } 

    function record() { 
      status("Recording..."); 
      Wami.startRecording('http://localhost/audiorecording/test.php?name=demo.mp3'); 

    } 

    function play() { 

      Wami.startPlaying("http://localhost/audiorecording/demo.mp3"); 
      alert("It's start playing"); 
    } 

    function stop() { 
      status(""); 
      Wami.stopRecording(); 
      alert("stop"); 
      Wami.stopPlaying(); 
    } 

    function status(msg) { 
      document.getElementById('status').innerHTML = msg; 
    } 
    </script> 
    </head> 

      <body onload="setup()"> 
      <input type="button" value="Record" onclick="record()"></input> 
       <input type="button" value="Stop" onclick="stop()"></input> 
       <input type="button" value="Play" onclick="play()"></input> 
       <div id="status"></div> 
       <div id="wami"></div> 
       </body> 
       </html> 

和一个PHP文件作为

<?php 
parse_str($_SERVER['QUERY_STRING'], $params); 
    $name = isset($params['name']) ? $params['name'] : 'output.wav'; 
    $content = file_get_contents('php://input'); 
    $fh = fopen($name, 'w') or die("can't open file"); 
    fwrite($fh, $content); 
    fclose($fh); 
     ?> 

swfobject.js可在网上 ,另一个recoder.js和GUI。 JS可在网上

https://wami-recorder.googlecode.com/hg/example/client/index.html

上面的东西是通过使用闪存做,但它不干活g在所有电脑上点击按钮我有错误,因为各自的功能不可用,并且 未定义Wami Wami.setup(“wami”); plz帮我走出去,或者我看到了wami的官方网站,他们在那里指定2008年的Java发布版本,但是我无法找到如何使用它,如果你有任何关于它的想法,那么PLZ回复.... ...

+0

为什么标记jQuery? – 2012-05-04 05:15:56

+0

recorder.js仅包含jquery –

+0

http://code.google.com/p/wami-recorder/source/browse/example/client/recorder.js?r=d7925a46e24dd594ab07cb7c3f7364b2d8fd9acd - 没有看到任何对jQuery的引用 –

回答

0

让我先纠正一个几件事情:

  • 的JavaScript,而不是Java。 Javascript是浏览器中使用的脚本语言,Java是一种C语言,主要用于(硬件)平台的兼容性。
  • 它确实不是依赖于jQuery。
  • 如果你想测试本地主机,确保有一个服务器用PHP解释器(IIS/Apache等)进行侦听。

现在回答你的 “问题”:

https://wami-recorder.googlecode.com/hg/example/client/index.html此页面涵盖了所有的基本知识。

  • 包含的SWFObject的
  • 附上recorder.js
  • 附上gui.js(!)你缺少这一个

它现在将找到WAMI.setup函数,它位于gui.js之内。

现在你很好去:)。