android-mediaplayer

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

自古美人都是妖i 提交于 2019-12-17 06:14:40
问题 It's no sound from my device even the emulator. Actually, at the line "mMediaPlayer.create(this, musicIds[0]); " , eclipse suggests me two choices : "Change access to static using 'MediaPlayer'(declaring type)" or "Add @SuppressWarnings 'static-access' to on Create()" . By the way, I take eclipse's suggestions........but still don't work. P.S. I called a package from other project (pager). public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string

Simple mediaplayer play mp3 from file path?

╄→尐↘猪︶ㄣ 提交于 2019-12-17 06:12:25
问题 I have a very simple mediaplayer that play background. It calls file from the apk, but I want it to play from any directory like as music or sdcard. Here are my codes: private MediaPlayer mpintro; . . mpintro = MediaPlayer.create(this, R.raw.intro); mpintro.setLooping(true); mpintro.start(); 回答1: It works like this: mpintro = MediaPlayer.create(this, Uri.parse(Environment.getExternalStorageDirectory().getPath()+ "/Music/intro.mp3")); mpintro.setLooping(true); mpintro.start(); It did not work

Simple mediaplayer play mp3 from file path?

痴心易碎 提交于 2019-12-17 06:12:02
问题 I have a very simple mediaplayer that play background. It calls file from the apk, but I want it to play from any directory like as music or sdcard. Here are my codes: private MediaPlayer mpintro; . . mpintro = MediaPlayer.create(this, R.raw.intro); mpintro.setLooping(true); mpintro.start(); 回答1: It works like this: mpintro = MediaPlayer.create(this, Uri.parse(Environment.getExternalStorageDirectory().getPath()+ "/Music/intro.mp3")); mpintro.setLooping(true); mpintro.start(); It did not work

Getting access to media player cache

余生长醉 提交于 2019-12-17 03:03:44
问题 I want to move a progressively streamed mp3 file to sd card once it is completely loaded. Is there any way of achieving that. I've seen that the MediaPlayer completely downloads the whole file while progressive streaming and then we can seek to any part of file. I want to move a fully streamed file to external storage so that future playback do not waste data and battery. 回答1: The comment on the original post points you in the right direction, but I thought it may be helpful to expound a bit.

Getting access to media player cache

谁都会走 提交于 2019-12-17 03:03:42
问题 I want to move a progressively streamed mp3 file to sd card once it is completely loaded. Is there any way of achieving that. I've seen that the MediaPlayer completely downloads the whole file while progressive streaming and then we can seek to any part of file. I want to move a fully streamed file to external storage so that future playback do not waste data and battery. 回答1: The comment on the original post points you in the right direction, but I thought it may be helpful to expound a bit.

Android: MediaPlayer Play, Pause, Resume audio file like WhatsApp

做~自己de王妃 提交于 2019-12-14 03:36:54
问题 I'm working on one project, I tried to play audio files like WhatsApp. suppose three files in a row sent by the user, ** I want to play/pause/resume audio file exactly like WhatsApp** - what I want to do: if I clicked on the first audio file (play button) it should start playing if I clicked on pause it should stop and if I clicked on play again it should start playing from exactly where we paused(resume audio file). other scenarios would be if the first file is playing and I clicked on the

error the application stopped when press mobile logout button

坚强是说给别人听的谎言 提交于 2019-12-14 03:03:57
问题 I have Android app which play sound and when I want to log off from the app as when press on mobile logout button i have the error message " the application stopped ... " . @Override protected void onStop() { super.onStop(); if(mp.isPlaying()) mp.stop(); mp.release(); finish(); } @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); if(mp!=null) { if(mp.isPlaying()) mp.stop(); mp.release(); } finish(); } 06-30 00:09:48.403: I/Choreographer(678):

Samsung SGH device with 4.4.4 version.failed to play audio using media player

南楼画角 提交于 2019-12-14 02:35:53
问题 This code is working fine in Samsung GT-I93001 while giving below error in Samsung SGH-M919 device.Both have same 4.4.4 version.Can someone point me in right direction.Is this device specific error?What is the reason? private final String AUDIO_URL = " http://techslides.com/demos/samples/sample.mp3 "; this is the issue only in one device. public void playAudio() { mediaPlayer = new MediaPlayer(); try { mediaPlayer.reset(); mediaPlayer.setDataSource(AUDIO_URL); mediaPlayer.setAudioStreamType

Streaming AAC audio in an Android application

允我心安 提交于 2019-12-13 18:23:15
问题 I am trying to program a simple Android app that will stream an internet radio station (I have the url), but the stream is aac audio. I am aware of COREaac, but there isn't alot of documentation about it. Is there a separate decoding library I need to get this app to work? Any suggestions would be helpful or if anyone has had a similar issue and resolved it. Thanks 回答1: All what you need is here: AACPlayer - android 来源: https://stackoverflow.com/questions/9009204/streaming-aac-audio-in-an

mediaplayer reverb is not working

空扰寡人 提交于 2019-12-13 16:39:00
问题 I am trying to apply reverb effect to mediaplayer by creating a reverb on the output mix (audio session "0" ) , and I use this code public void reverb1(View v){ PresetReverb mReverb = new PresetReverb(0,0);//<<<<<<<<<<<<< mReverb.setPreset(PresetReverb.PRESET_LARGEROOM); mReverb.setEnabled(true); mp1.attachAuxEffect(mReverb.getId()); mp1.setAuxEffectSendLevel(1.0f); } However when I start the song and apply the effect nothing happens, song continues and reverb effect is not applied. I also