Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Android AudioPlayer, intermittent playback, streaming MP3.

My app, built for iPhone and Android, is supposed to play back MP3 files that are being served by a custom PHP script. iPhone all works as expected, after a second of "buffering" the MP3 plays. On Android, some MP3's play and others don't. If I browse to the PHP script URL in any browser it works. If I open the URL in my Android browser (outside my Titanium app) it downloads and plays. Is there something crippled about AudioPlayer on Android? Any help is appreciated.

— asked October 9th 2010 by Ben Hornedo
  • android
  • audio
  • audioplayer
  • error
  • stream
0 Comments

2 Answers

  • Nothing specific. You might seem some hints in the Trace level log to see what the failure is.

    — answered October 12th 2010 by Don Thorp
    permalink
    1 Comment
    • Can you kindly help me out in streaming audio from url and playing it using createAudioPlayer ??

      — commented March 22nd 2011 by Primoris online
  • Found the issue. Apparently, it wasn't so much an issue with Titanium as the content-type being sent by the web server was wrong or not compatible with AudioPlayer on Android (although on iPhone it worked fine). It was set up to send audio as audio/mp3, when I switched it to audio/mpeg, everything worked. Hope that helps someone else.

    — answered October 12th 2010 by Ben Hornedo
    permalink
    2 Comments
    • Hi Ben,
      I am new to titanium, I also want to play mp3 files from xml.

      Can u plz help me with this?

      — commented December 8th 2011 by neha mishra
    • Hi Ben,

      When I am playing a audio mp3 file from FTP Server it is working using Audioplayer. But when I am trying to play an url with Progressive Download it is not working. I assume you are doing the same thing. Can you please share the code or guid me in this

      I am getting the following when I am trying to play

      @0 I/NuCachedSource2( 34): ERROR_END_OF_STREAM E/MediaPlayer( 565): error (1, -2147483648) W/TiSound ( 565): (KrollRuntimeThread) [11016,108952] Issue while initializing : W/TiSound ( 565): java.io.IOException: Prepare failed.: status=0x1 W/TiSound ( 565): at android.media.MediaPlayer.prepare(Native Method) W/TiSound ( 565): at ti.modules.titanium.media.TiSound.initialize(TiSound. java:124) W/TiSound ( 565): at ti.modules.titanium.media.TiSound.play(TiSound.java:1 81) W/TiSound ( 565): at ti.modules.titanium.media.AudioPlayerProxy.play(Audio PlayerProxy.java:124) W/TiSound ( 565): at ti.modules.titanium.media.AudioPlayerProxy.start(Audi oPlayerProxy.java:117) W/TiSound ( 565): at org.appcelerator.kroll.runtime.v8.V8Object.nativeFire Event(Native Method) W/TiSound ( 565): at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent( V8Object.java:58) W/TiSound ( 565): at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollPr oxy.java:694) W/TiSound ( 565): at org.appcelerator.kroll.KrollProxy.handleMessage(Kroll Proxy.java:918) W/TiSound ( 565): at org.appcelerator.titanium.proxy.TiViewProxy.handleMes sage(TiViewProxy.java:310) W/TiSound ( 565): at android.os.Handler.dispatchMessage(Handler.java:95) W/TiSound ( 565): at android.os.Looper.loop(Looper.java:130) W/TiSound ( 565): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThrea d.run(KrollRuntime.java:112) I/TiAPI ( 565): State: starting (4) I/TiAPI ( 565): State: stopped (5) D/dalvikvm( 136): GC_CONCURRENT freed 426K, 49% free 3109K/6023K, external 716K /1038K, paused 35ms+6ms D/SntpClient( 62): request time failed: java.net.SocketException: Address fami ly not supported by protocol I/EventLogService( 225): Aggregate from 1371118569290 (log), 1371118569290 (dat a) D/dalvikvm( 225): GC_EXPLICIT freed 63K, 50% free 2999K/5895K, external 716K/10 38K, paused 102ms D/SntpClient( 62): request time failed: java.net.SocketException: Address fami ly not supported by protocol D/SntpClient( 62): request time failed: java.net.SocketException: Address fami ly not supported by protocol D/SntpClient( 62): request time failed: java.net.SocketException: Address fami ly not supported by protocol

      — commented June 13th 2013 by ankur kulkarni
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.