Android 1.5 - How does MediaPlayer know when to start playback?

by Moto » Thu, 30 Apr 2009 00:54:27 GMT


Sponsored Links
 Hi all I need some deep understanding on the MediaPlayer class.

Here are a couple questions:
1. How does the MediaPlayer class know when to start playback when
playing an external file x size ie. "http:\\www.wha.com\file.mp3"  at
what point does it say we got enough data lets start playback?  from
my experience this varies a lot depending on the connection speed of
the phone and also how the phone feels like...

2. How can I know that MediaPlayer is now stuck with internal
buffering and not playing audio anymore?  I would have assumed the
OnInfoListener would let us know something? or maybe when checking
IsPlaying() would return false since it's buffering and no audio is
playing?


would have been nice to have {Idle, Initialized, Prepared, Stopped,
PlaybackCompleted, Error, etc..} and add a state
"InternalBuffering" ?  and have access to this states...

Any other classes that would have access to this information?

-Thanks!
Moto!
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Android hangs on execution init from initramfs with "Kernel panic - not syncing: Attempted to kill init!"

Hello!

I am porting Android on s3c6410 compatible platform. So, using Android sources, 
i created platform's profile, and compiled ramdisk.img, system.img, 
userdata.img.

I use 2.6.31-rc4 kernel, in which i included android specific drivers:

# Android
#
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ANDROID_RAM_CONSOLE=y
CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE=y
CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT=y
CONFIG_ANDROID_RAM_CONSOLE_EARLY_ADDR=0
CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE=0
CONFIG_ANDROID_TIMED_OUTPUT=y
# CONFIG_ANDROID_TIMED_GPIO is not set
CONFIG_ANDROID_LOW_MEMORY_KILLER=y

All my platform's driver compiled into kernel statically.
Also i included ramdisk.img into kernel,because it's small sized - 160kb.
I just unzipped ramdisk.img wit command  gzip -d ramdisk.img and got 
ramdisk.cpio
Here is how i included this ramdisk.cpio to kernel.

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="/1/ramdisk.cpio"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
CONFIG_INITRAMFS_COMPRESSION_NONE=y

Then I compiled kernel and got uImage.

Using U_BOOT i wrote kernle, system.img and userdata.img into nand flash.
Here is my parameters in u-boot environment to kernel:
mtdparts=s3c6400-nand:384k(u-boot),3m(kernel),65m(system),59m(userdata) 
console=ttySAC2,115200
which means
mtdpart0 - u-boot
mtdpart1 - linux kernel
mtdpart2 - system.img (yaffs2)
mtdpart3 - userdata.img (yaffs2)


But it's a pity, at the end of kernel booting i got an error:
Freeing init memory: 348K
s3c6410_setup_sdhci2_cfg_card: CTRL 2=00000100, 3=80808080 clk_ctrl=0008
s3c6410_setup_sdhci2_cfg_card: CTRL 2=00000100, 3=80808080 clk_ctrl=0008
Kernel panic - not syncing: Attempted to kill init!

What can it be the problem with?
How init binary from ramdisk.img knows where i placed system.img and 
userdata.img?

Because in the init.rc i found something like this:
mount yaffs m...@system /system

So isn't it strange?

















-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. EXTRA_OUTPUT problem with video camera - breaks 'retake' and 'delete' buttons

Hi all,

I have a problem with supplying a URI in the EXTRA_OUTPUT to the video
camera. If I supply a URI, the file shoots and saves OK to that URI,
but the 'retake' and 'delete' buttons on the camera both fail to work
- 'retake' does nothing, and 'delete' does a force close.

If I don't supply a URI, then the video camera works fine.

Here's my code:

                                video = new 
File(Environment.getExternalStorageDirectory(),
                                                "my_video.3gp");
                                if (video.exists()) {
                                        Log.d(LOG_TAG, "Video exists, 
deleting");
                                        video.delete();
                                }
                                Intent videoCaptureIntent = new
Intent(MediaStore.ACTION_VIDEO_CAPTURE);
                                Log.d(LOG_TAG, "passing URI to video camera: " +
Uri.fromFile(video).toString());
                                
videoCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(video));
                                startActivityForResult(videoCaptureIntent,1);

I would like to be able to supply the URI, if possible. Any ideas how
I can do this without crashing the camera?

Thanks
Anna

-- 

3. Mulit-Touch Problems

4. Race condition using handler + thread.

5. How to save files?

6. Mapview scroll finished Listener

7. Using GPS in a widget hangs on lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, (float) 0.001, locationListener);