Android: How to integrate a decoder to multimedia framework

In Android SF framework, the codecs are registered through media_codecs.xml. In standard android distribution, an example media_codecs.xml can be found here. All audio-visual components are registered as OMX components. 1. Codec Registration To register your video decoder, you would have to add a new entry under <Decoders> list. To ensure that your codec is always … Read more

Streaming Audio from A URL in Android using MediaPlayer?

simple Media Player with streaming example.For xml part you need one button with id button1 and two images in your drawable folder with name button_pause and button_play and please don’t forget to add the internet permission in your manifest. public class MainActivity extends Activity { private Button btn; /** * help to toggle between play … Read more

How to play multiple video files simultaneously in one layout side by side in different view in Android

You are not giving an awful lot of specifics on what exactly you have tried and what the problematic areas are, so I just made a small test to see if I could reproduce any of what you’re describing. I do not have any conclusive findings, but can at least confirm that my Galaxy Nexus … Read more

Android MediaPlayer Problems :”Error (-38 , 0) ” and “stop called in state 1”

Before prepare(), you need first to call setDataSource(..). The Media framework is a very strict state machine, and it’s really cumbersome to handle all the different states. I’ve used this little wrapper that makes the coding/debugging a bit easier. You can give it a try. Regarding emulator – note that not all file formats are … Read more

Android MediaPlayer/VideoView error (1, -2147483648)

As it turns out, error -2147483648 indicates an unknown error. This could have something to do with the video encoding, but it’s also worth checking that the file path exists and that the VideoView has permission to read it. My issue was that I was writing my files with Context.MODE_PRIVATE (the default). openFileOutput(filename, Context.MODE_PRIVATE); This … Read more

MediaPlayer error (1, -1004) aka MEDIA_ERROR_IO trying to stream music on Samsung S3

The answer to this question turned out to be an issue on Android firmware installed on Samsung S III devices running Android 4.1.2. It seemed to have been something relating to the source of the stream, because some sources eventually played on the device, but the one we needed, never played. If you can get … Read more

Android – play sound on button click – Null pointer exception

Thanks you for your answers! Appreciate it! Here’s how I finally managed to get it work: button[i].setOnClickListener(new OnClickListener() { public void onClick(View view) { mp = MediaPlayer.create(Test.this, R.raw.mysound); mp.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub mp.release(); } }); mp.start(); } });