2012-05-04 48 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之內。

現在你很好去:)。