Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1967] iOS: createAudioPlayer not playing MP3 from URL

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-04-28T20:46:15.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelsapi
Reporterjohnmcknight (at yahoo)
AssigneeIngo Muschenetz
Created2011-04-15T03:06:48.000+0000
Updated2017-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.

Comments

  1. eddiemonge 2011-04-15

    I think its a problem with your audio file. I threw the link into my working music player and it gave me the error.

  2. johnmcknight (at yahoo) 2011-04-15

    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.

  3. johnmcknight (at yahoo) 2011-04-15

    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.

        NSString *ext = [[[url path] lastPathComponent] pathExtension];
       

    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.

       NSString *ext = @"mp3";
       

    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...

  4. johnmcknight (at yahoo) 2011-04-15

    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.

            //
               // Attempt to guess the file type from the URL. Reading the MIME type
               // from the CFReadStream would be a better approach since lots of
               // URL's don't have the right extension.
               //
               // If you have a fixed file-type, you may want to hardcode this.
               //
       

    This is similar to my comment above about being able to tell the media object what file type it is trying to stream.

  5. Stephen Tramer 2012-07-26

    Confirmed against SDK 2.2.0.014b86f. Probably due to URL mangling; a URL without special characters works fine.
  6. Lee Morris 2017-04-28

    Resolving ticket as invalid due to the above comments and the lack of activity.

JSON Source