dongqi4085 2012-08-27 20:52 采纳率: 0%
浏览 44
已采纳

如何使用Javascript / PHP录制用户的声音? [关闭]

I am currently trying to make a test site that allows users to record voice-notes and save it to their account. What is the best way to do this using either PHP or JavaScript?

The steps that I am looking to have for this process are:

1) User clicking the record button. 2) Initiation of the recording sequence. 3) Stopping the sequence. 4) Naming of the file and sending it over to the server.

My main query is focused on the 2nd step, where I'd need some mechanism that would interact with the user's mic to record the voice. I am still new to web dev per se and I do not know how I can invoke voice recording using JavaScript.

Upon searching in Google, I found some links in StackOverflow which addressed similar issues but the answers were not helpful. A lot of solutions pointed to Flash but I would like to avoid that as much as possible. So my question does boil down to "Is it possible to record voice using JavaScript? If yes, how?"

Thanks in advance.

  • 写回答

3条回答 默认 最新

  • dongxi1943 2012-08-29 13:13
    关注

    The HTML5 Audio API is not widely supported in browsers, I think it works in Chrome and Firefox has had it recently added to its nightlies... Browser prefixes are required at this stage but the general API is...

    navigator.getUserMedia({audio: true}, function(stream) { /* do stuff */ });
    

    So that would be webkitGetUserMedia for Chrome and mozGetUserMedia for Firefox.

    Your more consistent options right now are via browser plugins such as Flash or Java or to create a desktop client that the user would need to install.

    Resources of interest regarding getUserMedia:

    The following question may assist you further:

    tutorial on using flash or java servlet to upload microphone data from browser to server?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型