KorsaR-ZN / wami-recorder

Automatically exported from code.google.com/p/wami-recorder
0 stars 0 forks source link

not sure I understand crossdomain.xml #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.record a file - wav saves succesfully on php server
2.attemp to playback
3.get security error "security error while playing 2048"

What is the expected output? What do you see instead?
ummm... sound?

What version of the WAMI recorder are you using? What version of Flash are
you using?  In what browser?  On what operating system?

FF 10.0, Mac OSX Lion, WAMI ? (clones on Jan 31, 2012), Flash 11.1

Describe your server-side set-up if it is relevant to this issue.

php:
parse_str($_SERVER['QUERY_STRING'], $params);
$name = isset($params['name']) ? $params['name'] : 'output.wav';
$content = file_get_contents('php://input');
$fh = fopen($name, 'w') or die("can't open file");
fwrite($fh, $content);
fclose($fh);

running in XAMPP - right now the php is located in a folder writeable by 
everyone.

So - where do I put crossdomain.xml? What are the settings inside? Any other 
thoughts?

Please provide any additional information below.

Original issue reported on code.google.com by b...@smartots.com on 4 Feb 2012 at 1:42

GoogleCodeExporter commented 9 years ago
What is the URL you put in startRecording?  Suppose it's 
http://www.awesomesite.com/wami/record.php.  You would need to make sure to 
have http://www.awesomesite.com/crossdomain.xml.  Notice it's at the root, not 
in the "wami" directory.

Original comment by mcgrawian@gmail.com on 4 Feb 2012 at 1:55

GoogleCodeExporter commented 9 years ago
Woah, that mock example site actually had a crossdomain.xml, which was totally 
wrong for what you need... just take a look at the one we have checked in here 
for the insides:

https://code.google.com/p/wami-recorder/source/browse/example/server/app-engine/
crossdomain.xml

Original comment by mcgrawian@gmail.com on 4 Feb 2012 at 1:59

GoogleCodeExporter commented 9 years ago
Hmmm... nope doesn't seem to do it. Crossdomain.xml is indeed in the root. 
Here's my js console. The last "httpStatusHandler" comes through when I try to 
play and see the security warning. tried in safari and chrome and both also 
showing this error. any ideas?:

FLASH: External.addCallback: startListening
FLASH: External.addCallback: stopListening
FLASH: External.addCallback: startRecording
FLASH: External.addCallback: stopRecording
FLASH: External.addCallback: getRecordingLevel
FLASH: External.addCallback: startPlaying
FLASH: External.addCallback: stopPlaying
FLASH: External.addCallback: getPlayingLevel
FLASH: External.addCallback: showSecurity
FLASH: Listening...
FLASH: Recording at rate: 22050
FLASH: POST 81332 bytes of type audio/x-wav
FLASH: Expected Samples: 41013 Actual Samples: 37888
FLASH: POST openHandler: [Event type="open" bubbles=false cancelable=false 
eventPhase=2]
2FLASH: POST progressHandler loaded:3796 total: 0
2FLASH: POST progressHandler loaded:36564 total: 0
2FLASH: POST progressHandler loaded:81260 total: 0
FLASH: POST progressHandler loaded:81338 total: 0
FLASH: POST: completeHandler
FLASH: httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false 
cancelable=false eventPhase=2 status=0 responseURL=null]
FLASH: Unlistening.

Original comment by b...@smartots.com on 4 Feb 2012 at 3:46

GoogleCodeExporter commented 9 years ago
Incidentally - here's my call to record:

        Wami.startRecording('http://localhost/wamiserver/audioreceiver.php?name=test.wav', "onRecordStart", "onRecordFinish", "onError");    }

Original comment by b...@smartots.com on 4 Feb 2012 at 3:47

GoogleCodeExporter commented 9 years ago
One other thought - haven't dug into the flash yet but I don't know where the 
play comes from. Is the buffer stored in memory and then played? Or is it 
reading the file again? Maybe a security issue? Anything I can do in Flash to 
show more in-depth logging to find where exactly this issue is cropping up?

Original comment by b...@smartots.com on 4 Feb 2012 at 3:48

GoogleCodeExporter commented 9 years ago
No, it's played back from the server, because we want to demonstrate the whole 
loop of audio to server and back.   

What is the URL you put in startPlaying?  I imagine it would be something like 
http://localhost/wamiserver/test.wav, if that is indeed where you saved the wav 
file in the PHP code.  You just need to make sure it's accessible via URL.  If 
the SWF is also served from localhost, then you shouldn't need 
http://localhost/crossdomain.xml at all.

Original comment by mcgrawian@gmail.com on 4 Feb 2012 at 5:25

GoogleCodeExporter commented 9 years ago
Yep that was it - now I feel dumb. I didn't change the playback server call - 
thanks!

Original comment by thebill...@gmail.com on 7 Feb 2012 at 2:09

GoogleCodeExporter commented 9 years ago
Actually one other question. Is there a way for the SWF to pass via javascript 
data returned by the server AFTER the file has been successfully saved?

Original comment by thebill...@gmail.com on 7 Feb 2012 at 2:09

GoogleCodeExporter commented 9 years ago
I haven't tried it myself, but my guess is that you could just write data to 
the response of the POST from the server, and read it in actionscript:

 var loader:URLLoader = URLLoader(event.target);
// loader.data will be the response data

Original comment by mcgrawian@gmail.com on 7 Feb 2012 at 4:28

GoogleCodeExporter commented 9 years ago
Alright I got grabbed the URLLoader data after sending the file to server in 
the SinglePost class (sent it to External.debug console). Now I just need to 
figure out how to instead of sending that to debug console, send it as data 
back to javascript.

Looking into the code it looks like it's going to be a bit complicated - anyone 
have any ideas?

Original comment by thebill...@gmail.com on 7 Feb 2012 at 11:06

GoogleCodeExporter commented 9 years ago
actually i should create a new issue on this

Original comment by thebill...@gmail.com on 7 Feb 2012 at 11:06

GoogleCodeExporter commented 9 years ago

Original comment by mcgrawian@gmail.com on 8 Feb 2012 at 4:25