-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
callback_finished_sending event fired before URL request completes #2
Comments
Good point, I shall update the code based on your comment, thanks |
I spotted the same issue, I hope some one will fix that. |
This fork https://github.com/gabceb/jRecorder contains a fix for this, PR #6, #7 and support for playback before the audio is sent to the server. |
Are you sure the swf file is updated ?
|
Did you try the swf file on my branch? Maybe @harrisonmgordon can give you more details since he is the Flash gooru |
Thanks, I just tried it... but with that one the flash object doesn't event load properly. swf_path : 'js/jRecorder.swf' and it worked... (same thing with the jRecorder.swf file found in /html ) |
The branch was just updated with the latest .swf files - try using "/html/jRecorder.swf" and let us know if it's working. Make sure to refresh your flash cache - we've had troubles on our end updating due to that before. |
The finished_sending callback is ok, but there's a problem with data writing. $fp = fopen($fullWavPath, "wb") or die ("cant open wav file"); $fcontent = file_get_contents('php://input'); fwrite($fp, $fcontent) or die ("cant write to wav file"); And I get "cant write to wav file" If I print out the content of $fcontent, I get an empty string. It's not a problem of writing rights on the directory. When I switch back to the older version of the swf, it works. |
Precision : that's really strange because when I look into the Chrome console I can see in the "Request Payload" : If I use the working one (which auto-previews the wav file), the content of Request Payload is directly : (no Content-stuff data) Hope it helps. |
Got the solution : |
At this time, callback_finished_sending is firing before the HTTP response is received from the audio stream upload. As shown in the current implementation of Main.as, private function finalize_recording():void below, ExternalInterface.call() is invoked right after new URLLoader(req).
The issue is that new URLLoader(req) invokes an HTTP request, but does not block until the response is returned. Thus the JavaScript callback_finished_sending is invoked before the HTTP request completes. As I don't have a Flash IDE to build this project, and limited Flash knowledge, the only thing that I can do is suggest a fix similar to the following, based on the Adobe API reference at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html:
function postAudio_urlLoader_complete(evt:Event):void {
ExternalInterface.call("$.jRecorder.callback_finished_sending");
}
It would be great if someone or the author of this component integrate this change and validate that callback_finished_sending is invoked after urlLoader_complete() returns.
Thanks
Shan
The text was updated successfully, but these errors were encountered: