Questions tagged [android-mediaplayer]

MediaPlayer class can be used to control playback of audio/video files and streams in Android devices

MediaPlayer class can be used to control playback of audio/video files and streams.

4792 questions
1
vote
0 answers

Android capture played sound

I wrote a simple Android app that plays two to wav files at once mixed. My solution is similar to Android: Mixing multiple AudioTrack instances?, I simply play the two files in two different threads using the AudioTrack class. Now I would like also…
Panciz
  • 2,183
  • 2
  • 30
  • 54
1
vote
1 answer

Prepare Failed on Mediaplayer when trying to stream

I am trying to stream an MP3-file with the following code in Android 2.3.3: player = new MediaPlayer(); String uri = "http://192.168.2.102:8080/sound/test.mp3"; player.setDataSource(uri); player.prepare(); for some reason every time I call…
bvanvelsen - ACA Group
  • 1,741
  • 1
  • 14
  • 25
1
vote
0 answers

IO Exception in Audio Media Player

I want to play audio through streaming in Media Player. I used the sample project source code from http://blog.pocketjourney.com/2009/12/27/android-streaming-mediaplayer-tutorial-updated-to-v1-5-cupcake/, but I'm getting a IO exception for media…
pratibha
  • 113
  • 4
  • 10
1
vote
0 answers

android progressive streaming for locally recorded audio

I am recording certain audio files using the builtin media recording API , here is the relevant code for recording mRecorder = new…
Vaibhav Mishra
  • 11,384
  • 12
  • 45
  • 58
1
vote
1 answer

Application crashes when button is clicked

I wrote this code in order to make a soundboard like app public class ButtonSoundActivity extends Activity implements OnClickListener { private Button buttons[]; private MediaPlayer mediaPlayers[]; @Override public void…
Ovidiu Birgu
  • 439
  • 2
  • 6
  • 24
1
vote
0 answers

To set Audio Format using AudioRecorder

I am Running Android SDK, 2.2 and set Samsung Galaxy Tab as target, using following code to create Audio Recorder Object, private static final int AUDIO_BUFFER_SAMPLEREAD_SIZE = 8000; public int channelConfiguration =…
1
vote
1 answer

how to add music library in my android application like facebook and twitter

I want to add or play mp3 files from music library in my application... I am able to fetch all mp3 files in a listview but I want features of the music gallery which lists out the songs accroding to the albums,playlist,artist. This is my code for…
Kutbi
  • 1,154
  • 2
  • 18
  • 32
1
vote
1 answer

How to keep specific time delay between the looping of an audio file in MediaPlayer in Android?

I want to build an application for composing music. I have setup buttons that plays sounds but what i need here is to control the time delay after which the sound has to repeat. I have tried setLooping but it loops without any time delay.
LangDON
  • 11
  • 1
1
vote
3 answers

Android ANR when trying to release and stop MediaPlayer

I have the following method which simply request a .mp3 file from a URL, loads a MediaPlayer and shows or hide the play button depending if the URL was loaded or not: public class PlayMusicFragment extends Fragment { private MediaPlayer…
1
vote
1 answer

mediaplayer not decreasing volume or stopping

I'm trying to create a method that crossfades between two mediaplayers. One should fade in while the other fades out, as I've done in both of the threads. void startAudio(String path) throws IOException { ready = false; …
1
vote
2 answers

How to change the state of song from stop to start?

I have make one application in android in which i take three buttons in xml and in java i set the onclick event, when play button is clicked song is prepared and play, when stop button is clicked song is stopped, when pause button is clicked song…
Jayesh
  • 3,661
  • 10
  • 46
  • 76
1
vote
1 answer

Android `MediaPlayer`'s `prepare` method crashes only in release mode AND on physical devices when used in `MAUI` application

I have the following wrapper for a media player: public class AndroidAudioPlayer { private readonly MediaPlayer player; private readonly MemoryStream stream; internal AndroidAudioPlayer(Stream audioStream) { this.player =…
Julien Debache
  • 319
  • 5
  • 13
1
vote
3 answers

play an mp3 with MediaPlayer class on Android issues

What is wrong with my code? I have a toggle button and i would like to play/stop an mp3. I guess that the code should be as follows: package com.android.iFocus; import android.app.Activity; import android.media.MediaPlayer; import…
Pabluez
  • 2,653
  • 3
  • 19
  • 29
1
vote
1 answer

I'm trying to playmusic using service but it's not working

from here i started the service Intent intent=new Intent(getActivity(),MyService.class); s=sn; u=ur; intent.putExtra("uri",u); ServiceConnection serviceConnection=new ServiceConnection() { …
1
vote
0 answers

Xamarin Android media app showing 2 instances in Android Auto console

I am working on a Xamarin Android media app and trying to add support for Android Auto. I have followed the Android Auto guidelines and best practices and have properly configured my app for Android Auto. However, when I test my app on the Android…