[TIMOB-1967] iOS: createAudioPlayer not playing MP3 from URL
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-04-28T20:46:15.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | api |
Reporter | johnmcknight (at yahoo) |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:06:48.000+0000 |
Updated | 2017-05-31T22:42:20.000+0000 |
Description
When I create an AudioPlayer object and set a URL to an MP3 file I get an error that says 'No audio data found' even though I can verify a correct MP3 file is present and can be played through iTunes and can be downloaded.
Here is the code that I am using
var player = Titanium.Media.createAudioPlayer({url: audio_uri});
player.start();
audio_uri is http://serverdemo.voicebox.com/VBTGetTTSAudio.aspx?TTS=79458.mp3">http://serverdemo.voicebox.com/VBTGetTTSAudio.aspx?TTS=79458.mp3
This happens on an iPad/iPhone project with versions 1.4.1 and 1.4.2 continuous.
I think its a problem with your audio file. I threw the link into my working music player and it gave me the error.
It's not the file, I am able to fetch it using createHTTPClient and then play that file locally. If I just send the URL, it says there is no audio data.
I have found the problem for my URL while attempting to use createSound to play the same URL.
TiMediaSoundProxy.m around line 43 of the 1.5.0 nightly build.
For my URL, which is a fairly common thing to encounter, the value of ext becomes aspx because that is the file extension of the file that is being called to return the MP3. Using the same logic, a URL that is not using any file to return audio would have an invalid extension as well. An example would be a streaming audio URL that is something like http://www.somestream.com/astream/">http://www.somestream.com/astream/ would fail because the ext variable would not specify the type of file that is present.
My sloppy test was changing that line to this and it would play my file.
I assume the preferred way to deal with this would be some sort of media type detection and setting the temp ext according to it but an easier would might be to allow developers to specify the type of media we are attempting to play and make the ext variable based on it. Just my opinion...
When calling createAudioPlayer with the same URL, I have a similar problem.
Around line 543 of AudioStreamer.m there is another place that looks like it attempts to guess file type by extension which wouldn't work correctly for my URL. The comment directly above that line says.
This is similar to my comment above about being able to tell the media object what file type it is trying to stream.
Confirmed against SDK 2.2.0.014b86f. Probably due to URL mangling; a URL without special characters works fine.
Resolving ticket as invalid due to the above comments and the lack of activity.