Wami Recorder 是如何实现的? [英] How is the Wami Recorder actually implemented?
问题描述
我对 Wami Recorder 非常陌生,而且我从来没有使用过 Flash,所以这实际上可能是一个愚蠢的问题.
基本上,如何实施 Wami Recorder?我在网站上看到过它,它在那里工作得很好,但是当我下载它并尝试在本地主机中使用它作为 Xampp 的一部分时,它不起作用.
如果有人能写一个 Wami Recorder for Dummies 答案,那就太棒了.
如果有人特别了解如何在该框架中使用它,我将在 CakePHP 2.0 中使用它.
基本上我要做的就是录制音频,将文件保存到目录,并获得 POST 信息以便能够将文件的某些详细信息保存到数据库中.
是的,文档不是很清楚.我昨天整个下午都在弄明白.这是一个适用于我的本地机器的简单实现.以下文件存储在我的Apache文档根目录/temp/wami/test"下,因此URL为http://localhost/temp/wami/test/":
index.html
recorder.js
save_file.php
Wami.swf
index.html
<头><script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script><script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script></script><script src="recorder.js"></script>头部><身体><div id="录音机"><button id="record">Record</button><button id="play">播放</button>
<div id="flash"></div><脚本>//初始化瓦米Wami.setup({id: 'flash'//放置 flash 对象的位置});//初始化一些全局变量var 录音 = '';var recordUrl = '';var playBackUrl = '';//获取按钮元素var record = $('#record');var play = $('#play');//定义函数功能开始录音(){录音 = 'temp.wav';RecordingUrl = 'http://localhost/temp/wami/test/save_file.php?filename='+录音;Wami.startRecording(recordingUrl);//更新按钮属性记录.html('停止').unbind().click(函数(){停止录音();});}功能停止录音(){Wami.stopRecording();//获取要播放的录音playBackUrl = 'http://localhost/temp/wami/test/' + 录音;//更新按钮属性记录.html('记录').unbind().click(函数(){开始录音();});}函数开始播放(){Wami.startPlaying(playBackUrl);//更新按钮属性玩.html('停止').unbind().click(函数(){别玩了();});}功能停止播放(){Wami.stopPlaying();//更新按钮属性玩.html('播放').unbind().click(函数(){开始播放();});}//添加初始点击功能记录.点击(功能(){开始录音();});播放.点击(功能(){开始播放();});