0

My development continues and I have moved forward much to my surprise in Flash and JS/HTML.

I have a question for those that have more experience.

I have a web application that consists of members and I want them to be able to send a voice recording to one another. I developed a flash voice recorder that lets the user record a message, play it back, then attach it to the message form much like a email you can attach a file and it will be in the memory until the user hits 'send'. The adding of a voice recording to the message is optional.

My question is, I have the html form and in the lower corner of the form lies my flash recorder. What would be the best strategy so that I can:

Once the user presses send, the recorder checks to see if there was any recording.

If there was no recording, send the message via AJAX normally.

If there WAS a recording, send the message like before and also have flash attach the data with it.

I have been searching and I find online many flash uploaders, flash forms etc..

I guess what I want is that the message be HTML for those users that don't want to send a recording or cannot for some reason use flash. In otherwords the message would be a combination of data from an HTML form and data (if any) from the flash in one shot, or the best way.

But if the recorder is active then have it attached to the POST along with the message in a smooth way.

I imagine that this involves some logic and sending JS calls to the Flash then back but I am not sure of how would be the best approach to this. Can someone guide me or if you know of any good tutorials.

4

1 回答 1

0

我认为从 SWF 中提取数据并将其作为同一个 POST 的一部分发送并不容易。最好的办法是在提交时遵循以下逻辑:

  1. 对 SWF 进行 JS 调用以查看它是否有录音。如果没有,请发送仅包含文本的普通 AJAX(或同步)帖子。
  2. 如果 SWF 有录音,请对其进行 JS 调用,要求其上传录音。此调用应包括将与录音一起发送的唯一消息密钥。SWF 将文件异步上传到一个特殊的 URI。
  3. 通过 AJAX 或同步 POST 发送文本以及唯一的消息密钥,并使用标志或特定 POST URI 指示它具有关联的记录。
  4. 在服务器端,当您收到录音或带有相关录音的文本时,请等到您收到两半信息后再将其发送给收件人。

该逻辑不包括错误处理或有关从 Flash 上传数据的详细信息,但您似乎可以控制这些部分。

于 2013-01-24T16:27:00.893 回答