views:

41

answers:

1

Hi,

I have a mp3 that is retrieved from the server via "somepage.php?id=100". When I load this into spark VideoPlayer it doesn't work. But when I copy that URL and put it into the browser URL I get a dialog that asks if I want to download "sound.mp3".

please help

+1  A: 

Check that the PHP script is returning the right media type:

header('Content-Type: audio/mpeg');

If it isn't, a player should indeed refuse to play it.

If it is OK, and Spark is just being stupid and guessing filetype from the file extension instead of the proper media type, you might try to work around it by hacking the URL, eg. somepage.php/something.mp3?id=100 or maybe somepage.php?id=100&ignore=/something.mp3.

bobince
The server was not returning the mp3 content type. The hack worked! Here is what was being returned:Content-Disposition attachment; filename=noooooo.mp3;Content-Length 214922Content-Transfer-Encoding binaryContent-Type application/octet-stream
1.21 gigawatts
The hack does not seem to be working. It looks like I need the content type set.
1.21 gigawatts
Answer with OSMF:
1.21 gigawatts
var audioElement:AudioElement = new AudioElement();audioElement.resource = new URLResource("http://stage.domain.com/api/get_file_content.php?id=100");audioElement.resource.mimeType = "audio/mpeg"; // this works and...//audioElement.resource.mediaType = MediaType.AUDIO; // ...this works toovideo1.source = audioElement.resource;
1.21 gigawatts