test.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4. <meta charset="UTF-8">
  5. <title>FlashWavRecorder demo</title>
  6. <script type="text/javascript" src="a.js"></script>
  7. <script type="text/javascript" src="jquery.min.js"></script>
  8. <script type="text/javascript">
  9. function init() {
  10. Recorder.connect("recorderApp", 0);
  11. Recorder.recorder.configure(8, 100, 0, 1);
  12. }
  13. function upload() {
  14. var fd = new FormData();
  15. var blob = Recorder.getBlob('audio2');
  16. fd.append('file', blob);
  17. $.ajax({
  18. url : 'http://127.0.0.1:20020/x_organization_assemble_authentication/jaxrs/test',
  19. data : fd,
  20. type : 'POST',
  21. contentType : false,
  22. processData : false,
  23. xhrFields : {
  24. 'withCredentials' : true
  25. }
  26. });
  27. }
  28. </script>
  29. </head>
  30. <body>
  31. <object type="application/x-shockwave-flash" id="recorderApp"
  32. name="recorderApp" data="recorder.swf" width="240px" height="240px">
  33. <param name="flashvars" value="upload_image=images/upload.png">
  34. </object>
  35. <button onclick="init()">init</button>
  36. <button onclick="Recorder.record('audio2', 'audio2.wav');">record
  37. </button>
  38. <button onclick="Recorder.stopRecording('audio2');">stop</button>
  39. <button onclick="Recorder.playBack('audio2');">Play</button>
  40. <button onclick="upload();">upload</button>
  41. </body>
  42. </html>