Android :: How To Implement An Audio Player - Using MediaPlayer And MediaController
Feb 8, 2010
I want to create an Android application that is a client for an Internet radio station. And I want it look native to Android? But im confused with Android API logic and documentation. What i've got is that I need MediaPlayer and MediaController classes. Am I right, and is there any good example of AUDIO player for Android?
Especially, I'm very interested how to use MediaPlayer and MediaController classes together.
UPD:
Finally I've got the code, that does exactly what I want:
CODE:..............
View 1 Replies
Oct 11, 2010
The seek bar of Mediacontroller is not been updating according to de audio player. Only when the trackball is shifted, or the play/pause button is clicked, the seek bar tracks the audio player. Could anybody give me any clue?
View 3 Replies
View Related
Jun 4, 2010
I am using MediaPlayer to build a Video player for playing local video files. However, I don't know how to enable MediaController for my player. I want the media control buttons that pop up when you touch the video surface.
View 6 Replies
View Related
Jun 2, 2010
I want media controls such as play/pause for streaming audio that I am playing in my app. I am using MediaPlayer to stream and play the audio. how to use MediaController with MediaPlayer?
View 3 Replies
View Related
Jan 11, 2010
Is there a way to customize the MediaController? I need to change the style of buttons, SeekBar etc.
View 1 Replies
View Related
Dec 27, 2009
I've been trying to stream mp3's over http using Android's built in MediaPlayer class. The documentation would suggest to me that this should be as easy as :
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(URL_OF_FILE);
mp.prepare();
mp.start();
However I am getting the following repeatedly. I have tried different URLs as well. Please don't tell me that streaming doesn't work on mp3's.
E/PlayerDriver( 31): Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported
W/PlayerDriver( 31): PVMFInfoErrorHandlingComplete
E/MediaPlayer( 198): error (1, -4)
E/MediaPlayer( 198): start called in state 0
E/MediaPlayer( 198): error (-38, 0)
E/MediaPlayer( 198): Error (1,-4)
E/MediaPlayer( 198): Error (-38,0)
View 8 Replies
View Related
Apr 27, 2010
Does anyone know the filepath for an Archos? I'm trying to get some media/audio to play, and it just won't find it...
public void onClick(View v1) {
final MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource("ARCHOS5:/Music/manowar.mp3");
mp.start();
Toast.makeText(Textbox.this, "Working", Toast.LENGTH_LONG).show();
mp.setLooping(true);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();............................
View 1 Replies
View Related
Nov 27, 2009
I am trying to make a very simple radio player for Android and I cannot get the audio streaming to work. In my latest attempt it plays for about 1 second and stops for some streams and it doesnt work at all for some other streams. Logcat doesn't give much useful information to me. I am testing on HTC Hero (Android 1.5).
If I hook the completion and buffer events I see the audio gets a complete event but it keeps buffering. Is there anything wrong with the code below? Should I be able to stream the the audio streams below? Is there a complete example somewhere of a working radio streaming?................
View 5 Replies
View Related
Nov 8, 2010
In my music app, i would like to play live streaming like radio broadcasting with mediaplayer as Mediaplayer mp = new Mediaplayer(); mp.setDataSource(LiveStreamingURL); mp.prepare(); mp.start(); but after playing for few seconds it is stopped. I dont know how to overcome it. Give me your suggestions for this.
View 3 Replies
View Related
Aug 21, 2010
I'm trying to create a way to adjust volume settings for each of the different streams (media, notification, ringtone, etc) and have a way to preview the output sound level of each stream. I believe I have the correct implementation, but when I set the output stream type, there is no sound that plays.
Here is the code that correctly plays the user's selected alarm sound:
CODE:.................
That commented out line is what is causing me problems. I would like to hear the alarm sound at the volume levels of the different audio streams, but when I include that line for STREAM_ALARM or any other audio stream, no sound at all plays.
View 1 Replies
View Related
Apr 8, 2009
Some audio files return 0 from MediaPlayer.getDuration(), even though they're perfectly valid files that play ok and that players on Windows can find the duration of. There seem to be two different cases here: certain file types such as .wma and .wav always return 0 duration, and others only do so sometimes. I haven't been able to find any pattern in the latter case, but it does seem consistent per file. The music player displays 0:00 duration for these, so it's not just my code.
View 3 Replies
View Related
May 27, 2010
I am having the following problem: I am using Android's MediaPlayer to play an mp3 through an HTTP connection. The audio is played correctly, but the MediaPlayer returns an incorrect duration (calling mediaPlayer.getDuration() ). Depending on the mp3 the duration is either shorter or longer. The code that plays the audio is the following:
mediaPlayer = new MediaPlayer(); mediaPlayer.setOnCompletionListener(this); mediaPlayer.setOnErrorListener(this); mediaPlayer.setOnPreparedListener(this); mediaPlayer.setOnBufferingUpdateListener(this); mediaPlayer.setDataSource("a valid URL"); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.prepareAsync();............................
View 2 Replies
View Related
Oct 13, 2009
Is it now possible mit sdk1.6 the audio decoder to access/use without using MediaPlayer ?
I saw : New version of OpenCore
Android 1.6 includes the updated OpenCore 2 media engine, which has:
* Support for OpenMAX encoders* Support for additional audio codecs in AuthorEngine* Improved buffering model supports shared buffers allocated in the decoder. but dont know how!
View 3 Replies
View Related
May 23, 2010
Does anyone know if there is a way for either meridian or the regular android player to recognize audio tags on lossless audio files?
View 1 Replies
View Related
Jun 16, 2009
I have the following native source code that is supposed to display video. It plays 3gp file ok and I can hear the audio, but the video is not shown.
CODE:..............
View 4 Replies
View Related
Nov 18, 2009
I have a activity which is called from another activity as an intent... This activity loads and starts playing a audio file. All is good - that much works. The activity also has a "stop" button and that stops the audio from playing - that is also fine.
But how do I stop the file from playing if the user uses the back button to leave the activity without clicking on the "Stop" button?
View 3 Replies
View Related
Aug 11, 2009
I've implemented "Audio Capture Setup and Start" example (http:// developer.android.com/guide/topics/media/index.html) with small modification - the output format is MPEG_4 not THREE_GPP.
The result - records with extremely poor audio quality.
Could you help me to understand where is error and how is possible to do really good audio records with Android?
I've done an experiment with Camcorder - standard Android application. Sound quality of the video is same poor. The audio signal is extremely low (quite).
Is it "by design" or may be some hardware problem (T-Mobile G1)?
I've found description similar problem here - http://osdir.com/ml/AndroidDevelopers/2009-06/msg00752.html - "Microphone audio capture with emulator is of very poor quality". In my case this problem reproduces on the real device. Unfortunately I have not found answer. I read about some "custom" encoders.. but have not found any example how implement them.
View 2 Replies
View Related
Nov 12, 2010
I am working on a application that would allow users to play remote files. My question is how do I open those remote files to be played in the default android player?but this does not give me control of what is happening!
View 2 Replies
View Related
Apr 27, 2009
I have a requirement to play several sounds many times in my game so instead of creating the MediaPlayer again and again I have called mp.seekTo(0) in onCompletion(mp) so that it will restart. Sometimes the sound is not audible from the device when I call mp.start () after setting mp.seekTo(0); but the player calls onCompletion() without playing any sound, this is observed randomly on most of the sounds
My sounds are of short duration mostly less than a second.
I am using a separate MediaPlayer for each sound (as I need this) -
There are almost 28 sounds in my game so i will be creating 28 MediaPlayers.
Below is the attached code for player
Also If I try to play many sounds one after the other in a short period of time i get an error saying "no more track names available". can u tell Why this is happening...?
check the below code:
CODE:........
View 9 Replies
View Related
May 19, 2010
Every time someone leaves me a voicemail on my home phone number, VOIP home phone voice mail box sends me the voicemail as a .wav file attachment. When I try to play this .wav file the phone refuses, saying "Sorry, the player does not support this type of audio file".
So, I take it the .wav files cannot be played on Android phones. Has anyone found a workable and simple workaround to this yet?
View 7 Replies
View Related
Jul 18, 2010
I am looking for an Android Audio Player that is based on a "now playing" playlist, like Amarok, Winamp or WMP. In relation with that playlist, I want buttons to add a song as the next song, or to add the song to the end of the playlist. Like the Rockbox firmware does it. Is there any app out there that works like this? I don't need any advanced features like lyrics, covers, etc, I just want to listen to music. In case there's nothing around, I'll even consider developing my own. Who needs synched lyrics if there's not even an "add next" option?
View 4 Replies
View Related
Jun 5, 2010
I'm using Meridian to listen to audio books, but I would sure love to find a player that let's me choose when to start listening. Meridian remembers where I left off in a book, but one slight bump and it goes back to zero. Sure would be nice to have it start at "minute 210" or wherever.
View 6 Replies
View Related
Nov 1, 2010
this is my layout for audio player the problem is when resolution is high there is balck space vacant under the play and delete button which located at the bottom of the ui. what i do?
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="840dp"
android:background="#333134"
>
<LinearLayout
android:layout_marginTop="20dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content".................
View 1 Replies
View Related
Jul 27, 2010
I am writing a music player for esoteric music formats, and have defined mime types for them in my Manifest.
However, the standard music player is always started even though it can't handle the format. Looking at logcat I see;
: D/MediaScannerService( 688): IMediaScannerService.scanFile: / sdcard/download/Cybernoid.sid mimeType: audio/prs.sid : I/ActivityManager( 578): Stopping service: com.android.providers.media/.MediaScannerService : I/ActivityManager( 578): Starting activity: Intent { action=android.intent.action.VIEW data=file:///sdcard/download/ Cybernoid.sid type=audio/prs.sid flags=0x4000000 comp={com.android.music/com.android.music.MediaPlaybackActivity} }
.. so it seems the component is explicitly set to the music player ? Is there any way around this ?
View 3 Replies
View Related
Jul 5, 2010
I would like to find an media player that plays videos but when I minimize or multitask to another app I want the videos audio to keep playing like pandora does. The reason for this is bcuz I rip videos off of youtube to mainly listen to the music.
View 2 Replies
View Related
Feb 16, 2009
I tried to play a piec of 16-bit .wav audio file, no sound came out from my earphone, but .mp3 file would be OK. Do any one else have this kind of experience? This is the code: player = MediaPlayer.create(this, R.raw.test); // I put test.wav in /res/raw player.start();
View 4 Replies
View Related
Mar 21, 2010
The dev guide suggests this
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(this, Uri.parse("http://wamu-1.streamguys.com:80"));
mp.prepare(); mp.start();
I can't seem to get it working though.
I'm getting "java.io.IOException: Prepare failed.: status=0x1"
View 6 Replies
View Related
Jul 21, 2010
I am currently new to android development I been working on the examples in the Dev Guide in the android website. I want to get a stream from a server I have to play in the emulator when I insert the url it doesn't seam to want to play. My question is there a way to get the emulator to play audio or is it all enabled also does MediaPlayer require a special kind of format like mp3 or ogg? his is the code i am running on my 'onCreate()' method.
MediaPlayer mp - new MediaPlayer();
mp.setDataSource(MY_URL_);
mp.prepare();
mp.start()
View 1 Replies
View Related
Jul 16, 2010
When the stock Android media player is playing a song, if you tap the album art box, you will discover that the Droid X has a visualizer for your viewing pleasure.
View 18 Replies
View Related
Feb 16, 2009
As mentioned audio stops after some random number of times when played from either Music/Video player. After some debugging, I found that the problem is:
In "android_audio_output.cpp"->audout_thread_func() there is a call to wait(iAudioThreadSem->Wait()) just before the while(1) and it is waiting indefinitely for something.
Can anybody tell me what is it waiting for and why is it not able to come out? From what I can understand, it is waiting for a signal (semaphore) but where is it expecting a signal from?
View 2 Replies
View Related