Android :: Need To Use MediaPlayer - Multiple Sound Files
Mar 10, 2010
I need to use MediaPlayer to play some sounds, as they were too large in size for the SoundPool class.
The constructor takes a single sound file. I have, potentially, around 20 files that I want to play, randomly and instantly, like sounds in a game.
Do I have to create a new MediaPlayer object for each sound? i.e...
MediaPlayer mp1 = MediaPlayer.create(context, R.raw.sound1); MediaPlayer mp2 = MediaPlayer.create(context, R.raw.sound2); MediaPlayer mp3 = MediaPlayer.create(context, R.raw.sound3); MediaPlayer mp4 = MediaPlayer.create(context, R.raw.sound4);
That seems expensive...
View 6 Replies
Jul 19, 2010
is there a way to find the 'noise produced' by a currently playing sound (MediaPlayer) -Like in many music editor software you import a song and it does a graphical layout of the song -like a graph with it higher up at louder bits. Hard to explain. But there must be a way to do this on android...
View 1 Replies
View Related
Apr 23, 2009
I have this task: Need to play short (0.3-0.4 sec) sounds all the time. When sound is played, it should start again, etc. User can press button to reset sound - it should stop and lunch.
I did many tests. I tried to create 1 MediaPlayer, then do this: MediaPlayer.OnCompletionListener complListener = new MediaPlayer.OnCompletionListener; code...
It works great on emulator and on device if I have eclipse+debugger on. When I disconnect debugger, I have very strange errors - sound can stop at all (till program restart), sound can start "repeating" (play 0.1-0.2 sec, then restart). Can someone please provide me some info about problem?
View 5 Replies
View Related
Feb 14, 2009
I'm just trying to play a local video that is a resource with the MediaPlayer class in the most simple way possible. I have confirmed that the video works with players that I download from the marketplace, so I'm assuming that's not the issue.
The problem is that I just get a black screen with no video. There is audio from the file playing though, so I know that the file resource is being accessed correctly, it's just not showing anything on the screen in the emulator.
The one other note is that at any time whenever I try to access getVideoWidth() or getVideoHeight() I get this (non-blocking) error:
ERROR/MediaPlayerService(24): getVideoSize returned -1
Any ideas as to what I could be doing wrong?
import android.app.Activity; import android.os.Bundle; import android.view.SurfaceView; import android.view.SurfaceHolder; import android.media.MediaPlayer;
Code...
View 9 Replies
View Related
Jan 6, 2010
Why does my MediaPlayer
MediaPlayer mp = MediaPlayer.create(this, R.raw.somemusic); mp.setLooping(true); mp.start();
stop, wenn I change the layout?
setContentView(R.layout.screenoptions);
and also suddenly in my game, the sound stops. What could be the reason?
And which one is better? MediaPlayer or SoundPool?
View 2 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
Jul 16, 2010
Getting reports that mp3 files <= 0.34 secs in length, are not played (or, at least, inaudible) on the Droid X. Works fine on other devices I've tried (e.g. Nexus One, Hero, G1)
All files longer than 0.34 secs are working fine. I've tested this with about 100 files (mixture of short and long) and the correlation is 100%.
View 4 Replies
View Related
Aug 4, 2010
I am looking for the default sound files from the Incredible. Specifically, I am looking to the "doot" sound when you press the volume slider. Does anyone have this sound file? It is not located with the alarms, notification, or ringtones. Also, as an added bonus, I am looking for the notification sound from SportsTap as well.
View 1 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 26, 2010
So i saw you can enter root files so that you can pick wav files or mp3s as alerts. so i was curious is there a way to set different sounds for different alerts...like sms, email, facebook...etc...all having different sounds for notifications?
View 2 Replies
View Related
Oct 1, 2010
I think I should know this, but my mind has gone blank. I'm making an app that has a few hundred small sound files and I want it to play a certain file dependent on a String I pass to the function. Where I hit the brick wall is getting the resId of the sound file.
View 1 Replies
View Related
Oct 9, 2009
If there are multiple apps using the same jar file, it makes sense NOT to package the jar in EACH app. However since the jar file cannot be pre-installed on the device, what are other alternatives for developer.
View 2 Replies
View Related
Mar 26, 2012
I would like to have multiple property files checked in to my project that each define the same properties but for different environments. For instance, a development one and an operational one that each point to a different server.
Ex. myapp.properties.dev
-> server.host=1.2.3.4
-> server.port=8080
myapp.properties.ops
-> server.host=5.6.7.8
-> server.port=8081
I would like to have some way when building my android project to an apk to specify which property file to include and rename it to just myapp. properties.
View 2 Replies
View Related
Jun 13, 2010
I downloaded AttachFile but it doesnt allow me to attach multiple files to ONE email. Any suggestions?
View 3 Replies
View Related
Jun 23, 2009
Is it possible to store strings values in multiple files? Eg, strings.xml, strings1.xml, strings2.xml etc.
I do not mean localized versions of the same file - those multiple files should contain different string ids in the same language, so in code they would be refered like: R.strings1.my_string_1 R.strings1.my_string_2 R.strings2.my_string_3 etc. So, "strings1", "strings2", "strings3" would be a kind of namespace for them.
Or, another way is to have multiple R classes inside one project, which would deal with different stringsXXX.xml files.
Like, currently we can refer to "my.name.space.R" and to "android.R" at the same time, so is it possible to have: android.R my.name.space1.R my.name.space2.R etc
At the same time inside single project?
View 2 Replies
View Related
Jul 15, 2010
I'm starting out and trying to unzip a zip file back to source. I'm using this code, my source is call "/mint/sdcard/Out.zip" to output "/mnt/sdcard/Out.text" and it seems to work. Now, if I have many files in Out.zip how do I automatically unzip all files individually with the correct filename without creating Out.text and then write onto it?
View 3 Replies
View Related
Mar 28, 2012
What sound files is android allowed to play?
View 2 Replies
View Related
Jul 27, 2010
Need the ability to have multiple notification sounds per contact. For example: if my friend emailed me, I'd hear one customized sound; if she texted me, I'd hear another; and if she called me, she had a 3rd sound. Now, I know the Inc cannot currently do this, so here's my question: is there an app out there for this?
View 1 Replies
View Related
Jun 24, 2010
Is there any way to select multiple music files and share them through bluetooth, as it can be done in case of images and videos(from gallery)
View 1 Replies
View Related
Apr 5, 2010
I recently installed Asphalt 5. Apparently, you have to download some stuff in order to play the game. Anyways, I did download it and my problem is, there are sound files that are showing up on my music player. Ex: (raw_000~raw_174) Oh and the sound files are in ".ogg" format. I did some research and I tried the ".nomedia" method, but that didn't work.
View 1 Replies
View Related
Oct 16, 2010
Hey, I have a problem with android programing when I try to record and then play the file that was just recored. I can both record and play the sound but the quality stinks. Its not just bad is really hard to listen to and sound abit like its a computer generated voice. I use the andriod SDK-emulator. The code that sets up the recording looks like this;
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
And the code playing the file later looks like this;
MediaPlayer mp = new MediaPlayer(); mp.reset();
mp.setDataSource(path); mp.prepare(); mp.start();
I don't know what part that makes the audio file sound really bad or if its just the emulator that makes it bad and that it would work on a real phone.
View 2 Replies
View Related
Oct 14, 2010
What program do you use to play these (MP4, WMV, MOV) files on your Evo? I can't they them to play.
View 3 Replies
View Related
Sep 1, 2010
When i download a wmv file, it plays the sound but not the video. Any suggestions?
View 1 Replies
View Related
Jan 24, 2013
where i find the XML files associated with UI sound like charger_connecting or sound camera
View 1 Replies
View Related
Nov 6, 2010
hi does anyone have sound files from htc evo 4g i need them for my droid x.
View 1 Replies
View Related
Oct 28, 2010
I have an HTC Droid Incredible and record my video in 720p. When I copy the file to my pc Windows Media Player does not play the audio of the .MP4. The video plays fine however. (All playes fine on the phone)
I have a camcorder that also records 720 mp4 files, and it plays audio and video just fine on the same pc.
It is possible that another player might play the file fine such as VLC, but I like Windows Media Player, and prefere not to have 3-4 media players taking up resources on my pc.
View 2 Replies
View Related
Sep 8, 2010
I just had a warranty swap out done on my droid. As soon as I got the new droid, I hooked it up to my computer flashed back to Android 2.0.1, and used Universal AndRoot to root the phone. After that I used Rom Manager to flash ClockworkMod, and then I installed a backup that I did on my previous Droid. Everything workd great. I'm back running CM 6.0 set up just as it was on my old phone.
The problem now is that when I go into settings to change a ring tone or a notification tone all the "stock" sounds are listed twice. I don't know how to remove the duplicate.
I've deleted system/media/audio, rebooted the phone and then I only had one of everything in the menus to choose a tone. This had a negative effect as it also deleted sounds for some other actions as well. So I moved a backup copy of audio back to system/media, and the duplicates are back.
I've searched with Root Explorer for various ringtone files, and have deleted files off my SDcard thinking it was pulling files from it, but that hasn't worked.
View 2 Replies
View Related
Mar 28, 2012
why cant i play wma sound files on my phone? i'm trying to play .wma audiobooks. i dont get it! how can i enable my phone to play wma files? can i install a codex for this?
View 3 Replies
View Related
Dec 8, 2009
I have put a few videos on my phone and when I browse to find them they appear to be two of each one. Does any one know why this is happening. When I look at my storage card via my pc, there is only one of each file
View 2 Replies
View Related
Apr 11, 2010
When I receive sms sound files my htc eros will not play.
View 3 Replies
View Related