Stream a very large mp3?

by g1bb » Thu, 12 Mar 2009 09:00:14 GMT


Sponsored Links
 Hello,

Is it possible to stream a very large mp3 using MediaPlayer? The mp3 I
am interested in is over 270 mb.

Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~



Stream a very large mp3?

by g1bb » Thu, 12 Mar 2009 09:25:29 GMT


 For the record, here is the code:

 MediaPlayer player = new MediaPlayer();

            player.setAudioStreamType(AudioManager.STREAM_MUSIC);

            try {

                player.setDataSource(" http://mybigmp3.mp3 ");
                        } catch (IllegalArgumentException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        } catch (IllegalStateException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        } catch (IOException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        }
            try {
                                player.prepare();
                        } catch (IllegalStateException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                        } catch (IOException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                        }
            player.start();


And the logcat:
03-12 01:22:10.996: WARN/System.err(324): java.io.IOException: Prepare
failed.: status=0xFFFFFFF6
03-12 01:22:10.996: WARN/System.err(324):     at
android.media.MediaPlayer.prepare(Native Method)
03-12 01:22:10.996: WARN/System.err(324):     at
com.myapp.app.Main.onCreate(Main.java:35)
03-12 01:22:10.996: WARN/System.err(324):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
03-12 01:22:10.996: WARN/System.err(324):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2104)
03-12 01:22:10.996: WARN/System.err(324):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2157)
03-12 01:22:10.996: WARN/System.err(324):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
03-12 01:22:10.996: WARN/System.err(324):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
03-12 01:22:10.996: WARN/System.err(324):     at
android.os.Handler.dispatchMessage(Handler.java:88)
03-12 01:22:10.996: WARN/System.err(324):     at android.os.Looper.loop
(Looper.java:123)
03-12 01:22:11.006: WARN/System.err(324):     at
android.app.ActivityThread.main(ActivityThread.java:3739)
03-12 01:22:11.006: WARN/System.err(324):     at
java.lang.reflect.Method.invokeNative(Native Method)
03-12 01:22:11.006: WARN/System.err(324):     at
java.lang.reflect.Method.invoke(Method.java:515)
03-12 01:22:11.006: WARN/System.err(324):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
03-12 01:22:11.006: WARN/System.err(324):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
03-12 01:22:11.006: WARN/System.err(324):     at
dalvik.system.NativeStart.main(Native Method)
03-12 01:22:11.006: ERROR/MediaPlayer(324): start called in state 0
03-12 01:22:11.026: ERROR/MediaPlayer(324): Error (-38,0)




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Stream a very large mp3?

by Dave Sparks » Thu, 12 Mar 2009 10:44:29 GMT


 've never tried an MP3 that big - it's quite possible that it won't
work. I think the largest file we ever tested was a one hour MP3 mix
file. I think it was about 70 MB.

On Mar 11, 6:25 pm, g1bb <corymgibb...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Create a tmp file

Hello

in my application to download file I create a tmp file. Before sdk 0.9
used :

File temp = File.createTempFile("spherencyfile", "");

now in sdk 0.9 this line caght an exception and I have this line in
logcat
08-29 18:43:49.018: ERROR/FileDownload(7040): error: Cannot create: /
sdcard/spherencyfile49726
08-29 18:43:49.018: ERROR/FileDownload(7040): java.io.IOException:
Cannot create: /data/local/tmp/spherencyfile49726
08-29 18:43:49.018: ERROR/FileDownload(7040):     at
java.io.File.createNewFile(File.java:1133)
08-29 18:43:49.018: ERROR/FileDownload(7040):     at
java.io.File.createTempFile(File.java:1189)
08-29 18:43:49.018: ERROR/FileDownload(7040):     at
com.spherency.filetransfer.FileDownload.run(FileDownload.java:54)

I don't understand why he writes in sdcard. Before he writes in tmp
dir.

I have try another prototype of createTempFile to specify a base
directory, but i have same problem

Do you have an idea?



--~--~---------~--~----~------------~-------~--~----~

2. SharedPreferences not stored betweed 2 emulator launch

Hi,

I have the following unexpected behaviour :
-> 1 start my application
-> I define a preference, thanks to the new mechanism (preferences
inflated from XML)
-> I stop my application

OPTION 1 :
-> I start my application for a second time, I check the preferences,
value is OK

OPTION 2 :
-> I close the emulator
-> I restart the emulator
-> I start my application, I check the preferences, value is NOT ok
(as not defined).

I was thinking the preferences are saved between two emulator
sessions.

Do I miss a point ?

Here is my preferences.xml file :
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
        xmlns:android="http://schemas.android.com/apk/res/android">

    <PreferenceCategory android:title="Filter algorithm">

        <ListPreference
                android:key="units.returned"
                android:title="Displayed units"
                android:summary="Number of unit to be displayed on the
map screen"
                android:entries="@array/values_unit"
                android:entryValues="@array/values_unit"
                android:persistent="true"
                android:dialogTitle="Set the displayed units  number"/
</PreferenceScreen>

Thanks for your help.


--~--~---------~--~----~------------~-------~--~----~

3. API Call Management: Issues 54 and 675

4. I2C Devices

5. Send SMS from one emulator instance to another

6. StackOverflowError when clearing and refocusing a ghosted text view

7. Story about Android