How to play MP3 with no file extension in Flex 4 Spark Video Player
I have a mp开发者_开发知识库3 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".
UPDATE!!!
// in the creation complete handler var audioElement:AudioElement = new AudioElement(); audioElement.resource = new URLResource(path); audioElement.resource.mediaType = MediaType.AUDIO; videoPlayer.source = audioElement.resource;
// and in the video player you must set autoDisplayFirstFrame to FALSE
It seems the audio is cued up in order when added to the creation complete meaning that if one audio file is loading another will not start until after the first has completed.
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
.
精彩评论