Android :: How To Stop Any Currently Played Audio
Jul 2, 2009
I'm developing an application which plays some music files. I want to stop any other audio playback when my application starts playing the music. I've looked at the source code of the Music application and figured out how to to pause the Music application using the intent "com.android.music.musicservicecommand"
But there can be many other applications which can play the music too, creating their own MediaPlayer objects. Is there a way to pause or stop all the msic currently being played?
View 2 Replies
Nov 9, 2010
Is it possible to be notified in Android when the Audio system starts playing audio? it looks like i should wire up a BroadcastReceiver, but it's not clear what i would listen for. I could listen for the MediaPlayer intent, but that would only capture when that particular application was playing audio, not when a third party application played audio, etc.
View 2 Replies
View Related
Oct 23, 2010
My desire is to be able to listen, on my Android, anything that is output on my PC soundcard (running Linux).
I've been reading about pulseaudio and I'm able to stream specific things, like mp3 files. But I wanted to let Android get everything that is output to pulseaudio. Like YouTube videos, desktop sound effects, music.
View 9 Replies
View Related
Jul 3, 2010
I would like to know if it's possible to have the audio played through the usb port and into my car stereo. I have a usb port on my after market stereo and it's obviously not natively supported from the stereo, but is there a setting to play audio through usb?Sent from my HTC Incredible
View 2 Replies
View Related
Jan 12, 2010
I upload video and when I go to watch it, it has no sound. I use windows media and vlc none of them play it.
View 2 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
Sep 29, 2012
As an individual that likes to keep my phone audio turned on with notification alerts....
How can I stop those alerts during phone calls?
I don't need to hear whistles or "you've got mail" coming through my calls.
It's most bothersome for the fact that I have a bluetooth handshake to my home handset and all the phone audio pushes through.
Is there a setting that turns off phone audio when in phone calls and then turns it back on after you hang up?
View 1 Replies
View Related
Nov 14, 2010
I need to run six animations simultaneously (each animation simulates a roll of dice, each dice is a custom text view) and at the end of those animations, I need to get back the number of each roll. As each animation changes the number of each dice five times (to simulate the roll), I want to wait that each animation has ended to calculate the sum of each roll. I tried to regroup in one the six animations (so that with an animation listener, I would have been able to wait the end of the animation) but I didn't manage it.
View 6 Replies
View Related
Sep 8, 2009
I've searched the list and the documentation but have not found anything that tells you how to tell how many times a song has played. Is there something in the OS that provides that information or would it need to be done in the individual application?
View 2 Replies
View Related
May 9, 2010
I have an application that will record and play audio files. Some of the audio files are downloaded using simple standard http downloads using httpclient. It worked like a charm for a long time. Now all of a sudden I cannot play the files I download. It fails with this stack. I store the files on the SD Card and I experience the problem both on a handset and a USB connected device. I have checked that the downloaded file is cool on the server, and I can play it without any issues. These are the code snippets I use ( I know that recordingFile is a valid path for the file).
// inside the activity class
private void playRecording() throws IOException{
File recordingFile = new File(recordingFileName);
FileInputStream recordingInputStream = new FileInputStream(recordingFile);
audioMediaPlayer.playAudio(recordingInputStream);
}
Here is the media player code:
// inside my media player class which handles the recordings
public void playAudio(FileInputStream audioInputStream) throws IOException {
mediaPlayer.reset();
mediaPlayer.setDataSource(audioInputStream.getFD());
mediaPlayer.prepare(); mediaPlayer.start();
}
Here is the exception:
E/MediaPlayerService( 555): offset error
E/MediaPlayer( 786): Unable to to create media player
W/System.err( 786): java.io.IOException: setDataSourceFD failed.: status=0x80000000
W/System.err( 786): at android.media.MediaPlayer.setDataSource(Native Method)
W/System.err( 786): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:632)
W/System.err( 786): at net.xxx.xxx.AudioMediaPlayer.playAudio(AudioMediaPlayer.java:69)
W/System.err( 786): at net.xxx.xxx.Downloads.playRecording(Downloads.java:299)
W/System.err( 786): at net.xxx.xxx.Downloads.access$0(Downloads.java:294)
W/System.err( 786): at net.xxx.xxx.Downloads$1.onClick(Downloads.java:135)
I have tried seeking some answer of the offset error, but not really clear what this issue might be. I download the file with this code:
public FileOutputStream executeHttpGet(FileOutputStream fileOutputStream) throws ClientProtocolException, IOException{
try { // Execute HTTP Post Request
httpResponse = httpClient.execute(httpPost, localContext);
int status = httpResponse.getStatusLine().getStatusCode();
// we assume that the response body contains the error message
if (status != HttpStatus.SC_OK) {
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
httpResponse.getEntity().writeTo(ostream); fileOutputStream = null;
} else { InputStream content = httpResponse.getEntity().getContent();
byte[] buffer = new byte[1024]; int len = 0;
while ( (len = content.read(buffer)) > 0 ) {
fileOutputStream.write(buffer,0, len);
} fileOutputStream.close();
content.close(); // this will also close the connection }
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block e1.printStackTrace();
fileOutputStream = null; } catch (IOException e2) {
// TODO Auto-generated catch block e2.printStackTrace();
fileOutputStream = null;
} return fileOutputStream;
}
View 2 Replies
View Related
Aug 19, 2010
1.how do we build our own video player in android,it will be helpful if ull can give me some code related to it.
View 1 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
Sep 22, 2010
Is there an Android equivalent to the iOS Core Audio / Audio File Stream Services? I need to be able to read audio bytes from a network and feed them to the audio system under my control, so I can do my own timeouts / reconnects / range requests / etc. without interrupting the audio playback (since the system audio thread would be playing audio already enqueued). It seems that MediaPlayer doesn't give me this level of control. Is there a lower-level framework that does, either in the SDK or NDK?
View 2 Replies
View Related
Nov 14, 2010
Does anybody know, how i can create an intent that opens some videos in youtube app for being played as / in a playlist?
View 1 Replies
View Related
Aug 25, 2010
I recently (last Friday) got my EVO and am loving it, however I've noticed that when I try to play a video through youtube, or click on a video in facebook, I get the error that says the video cannot be played.This even happens with videos that I uploaded to youtube with my EVO.Has anyone else seen this or know if there is a fix?
View 11 Replies
View Related
Oct 2, 2010
I want combine two audio files. (A audio file + B audio file = AB audio file)So, my search result is:
1. useing an AudioTrack.
2. decode PCM from audio file.
3. combine PCM.
This is currect? It there another way?
View 1 Replies
View Related
Oct 17, 2010
I want to record a sample from the microphone, then I want to play the recorded file maximizing the volume and apply some audio effect, like modifing sample rate or addind an echo.Waht is the best way? is there an example?
View 1 Replies
View Related
Jun 2, 2009
Could you please let me know how to do the audio record in android emulator and play the same recorded audio. Could you please help me in proceeding in development.I tried with MediaPlayer API's also.Its not working.
View 5 Replies
View Related
May 8, 2010
Is there a way to determine the audio format of an audio file in Android? On normal java I do it like this:
File file= new File(...);
AudioInputStream stream = AudioSystem.getAudioInputStream(file);
AudioFormat format= stream.getFormat();
View 2 Replies
View Related
Mar 4, 2010
I have encoded several videos to mp4. All of these videos played fine on on my phone until yesterday. Now none of them will play correctly. The default video player says "The video could not be played" and Act 1 says "Video is falling behind audio. It may be too much data for your phone to process, or may not be supported by Android" What gives? They play correctly on my wife's droid. I haven't downloaded any new apps since they played correctly. I have killed all apps to make sure I have enough memory. What could have changed? I have followed the instructions given on the forums to encode video to a T.
View 2 Replies
View Related
Jun 18, 2010
I found a work around but requires you to have wi-fi connection first.
Step 1. Be sure to connect your phone to wi-fi first. Load the game and log in to multiplayer. Stop at the screen where you choose either Create or Join.
Step 2. Press your home button on your actual phone, and shut off wi-fi.
Step 3. Go back to the game again (It should reload and log you off) and log back in again.
Step 4. Now you can play multiplayer online via 3G/4G.
Simply keep the game loaded (Do not fully close out or end task) and you should be able to play the game over and over again via 3G/4G. I bought the game NOVA by Game loft on my Palm Pre. I played multiplayer online over 3G just fine. This morning I bought NOVA for the Android (You have to buy it directly from the site) and to my surprise when I try to play online it says you need to over wi-fi. I understand why they probably would do this as 3G is not the best for online gaming, however on my Palm Pre over 3G, it played just fine.
View 8 Replies
View Related
Aug 10, 2010
ever since i put the leaked .3 version youtube has gone downhill. when i click on a video it seems like its loading but then a pop up comes on saying "video cannnot be played" even with the .6 update i did with the leaked ruu its the same. just tested it and it only does it when i have HQ enabled
View 4 Replies
View Related
Jan 23, 2010
I have noticed that I cannot play WAV files on my Droid Eris. Is there some kind of work around for this? It is very frustrating.
View 8 Replies
View Related
Aug 11, 2010
I have a Image button which doubles as a play and stop button. I need the image in the button to change when the user click on it the first time, so that it now looks like a stop button. But this won't happen till the thread completes playing the song.
CODE:..............
SetBackground wont reflect on the view as the invalidation does not occur. Where and how should I invalidate this?
View 1 Replies
View Related
Jan 5, 2010
In my application i have several activities and i want to start background music whenever my *Application* is launched and stop music whenever *Application* is paused or stopped.
View 4 Replies
View Related
Apr 19, 2010
So whenever I try to play a video from the internet on my Eris it makes me wait about a minute and then pops up and says sorry video cannot be played. (This happens on the internet on multiple websites including Youtube and also on the Youtube app).
View 4 Replies
View Related
Jul 22, 2010
Why does my app say this video can not be played? Whats the point of having the app?
View 7 Replies
View Related
Jun 2, 2010
If I load all my music on my SD card can I just put it in my Droid and it will play?
View 2 Replies
View Related
May 21, 2010
when I am on YouTube I always get, sorry this video cnnot be played.and its realy annoying me, are there any fixes?
View 3 Replies
View Related
Jul 17, 2010
Can't seem to find the answer im looking for. I took a few videos at the zoo and they have sound when i play them back on my phone. But when i upload them to my computer, there is no sound.
View 8 Replies
View Related