android-mediaplayer

What is MediaPlayer.OnInfoListener “code 703”?

本小妞迷上赌 提交于 2019-12-08 19:20:51
问题 I am running a stream via MediaPlayer . When buffering starts, the code 701 is thrown. When buffering ends, the code 702 is thrown. All codes are found on this link. However, MediaPlayer.OnInfoListener first throws the code 703, which I cannot find anywhere. Here is the code and debug output. mPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { @Override public boolean onInfo(MediaPlayer mediaPlayer, int i, int i2) { Log.d(TAG, "MediaPlayer.OnInfoListener: " + i); return false; } });

IllegalStateException in MediaPlayer

淺唱寂寞╮ 提交于 2019-12-08 17:45:35
问题 Here is my code if (player != null) { if(player.isPlaying()){ player.pause(); player.stop(); } player.release(); } and here is error FATAL EXCEPTION: main java.lang.IllegalStateException at android.media.MediaPlayer.isPlaying(Native Method) at com.mindefy.sindhipathshala.RecViewAdapter.mediafileRelease(RecViewAdapter.java:234) at com.mindefy.sindhipathshala.SectionFruits.onBackPressed(SectionFruits.java:252) I am a beginner in Android and i am very confused with the lifecycle of a MediaPlayer

How to play InputStream of an audio file that's not within a url or storage?

纵饮孤独 提交于 2019-12-08 17:01:03
问题 Background I've succeeded uploading an audio file (3gp) into Google-Drive. Now I want to be able to play the file within the app. The Google Drive API only allows to get the input stream of the file that's stored there. The problem All MediaPlayer capabilities of inputs aren't available in my case, which is only InputSteam: http://developer.android.com/reference/android/media/MediaPlayer.html#setDataSource(java.io.FileDescriptor) I know I can save the file from the Google-Drive to the cache

Android : how to know if MediaPlayer is paused?

百般思念 提交于 2019-12-08 14:43:38
问题 MediaPlayer.isPlaying() does not allow to know if the MediaPlayer is stopped or paused. How to know if it is paused and not stopped? Thanks ! 回答1: One way to do this is to check if the media player it not playing (paused) and check if it is at a position other than the starting position (1). MediaPlayer mediaPlayer = new MediaPlayer(); Boolean isPaused = !mediaPlayer.isPlaying() && mediaPlayer.getCurrentPosition() > 1; 回答2: There is no API to check if MediaPlayer is paused or not. So please

error -19,0 from using Mediaplayer?

穿精又带淫゛_ 提交于 2019-12-08 14:19:29
E/MediaPlayer(20473): error (-19, 0) I/MyApp (20473): Decoding lala.mp3 I/StagefrightPlayer( 68): setDataSource('mypath') E/AudioFlinger( 68): no more track names available E/AudioTrack( 68): AudioFlinger could not create track, status: -12 E/AudioSink( 68): Unable to create audio track Does any1 know why i'm getting this? This usually happens after playing about 100+ of so audio files using mediaPLayer. I'm playing it like this public RenderResultFormat DoIt() { if(mp!=null){ mp.release(); mp = null; } AudioRenderer mr = new AudioRenderer(); mp = mr.AudioRenderer(filePath);} private class

Android default media player “start” after “stop” error (com.android.music.musicservicecommand)

依然范特西╮ 提交于 2019-12-08 10:46:45
问题 When I send to the default player Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "play"); ACTIVITY.sendBroadcast(i); it starts to play. When I send Intent i = new Intent("com.android.music.musicservicecommand"); i.putExtra("command", "stop"); ACTIVITY.sendBroadcast(i); It stops. But when I try to play again then it doesn't play. It just plays for a second and then stops again. I saw on the log I get two intents. The intent.getBooleanExtra("playing",

How to play an mp3 file between a range of milliseconds using android MediaPlayer?

岁酱吖の 提交于 2019-12-08 10:15:31
问题 I am able to play an mp3 file using android's MediaPlayer object. But I would like to play between a range of milliseconds for example between 30000 ms to 40000 ms ( 10 seconds only ). How can I achieve this? Currently the following code is what I have, private MediaPlayer mPlayer; public void play() { try { mPlayer = MediaPlayer.create(getApplicationContext(), R.raw.mp3_file); if (mPlayer != null) { int currentPosition = mPlayer.getCurrentPosition(); if (currentPosition + 30000 <= mPlayer

How can I save media player state?

假装没事ソ 提交于 2019-12-08 08:19:51
问题 I am working on a music player and everything is fine the play, stop, and pause buttons. My problem is that whenever a song is playing and I press the back button and reopen the app the buttons won't work with the current song. This happens as well when I change the orientation. Is there a way I can save the state of the media player and then obtain the state so that I can stop the song that is being played? 回答1: Well, you could use .getCurrentPosition() to get how many milliseconds into thew

Can't save audio to phone using media player in eclipse

你。 提交于 2019-12-08 08:04:19
问题 I'm trying to make a soundboard where you user can play and stop sound as well as save the sounds to phone. I have set it up fine but the save will not work. I'm not getting any error and not sure whats wrong. I get the box to come up saying to save it, but when clicked does nothing. Using ViewPagerIndicator. Any help? Sorry only a beginner. public class Question1 extends Fragment { private AdView adView; Button button01; Button button02; Button button03; Button button04; Button button05;

error -19,0 from using Mediaplayer?

删除回忆录丶 提交于 2019-12-08 07:35:13
问题 E/MediaPlayer(20473): error (-19, 0) I/MyApp (20473): Decoding lala.mp3 I/StagefrightPlayer( 68): setDataSource('mypath') E/AudioFlinger( 68): no more track names available E/AudioTrack( 68): AudioFlinger could not create track, status: -12 E/AudioSink( 68): Unable to create audio track Does any1 know why i'm getting this? This usually happens after playing about 100+ of so audio files using mediaPLayer. I'm playing it like this public RenderResultFormat DoIt() { if(mp!=null){ mp.release();