Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Android


Advertisements:








Android :: Play Continuous Background Music Using Sound Pool


I am trying to play continuous background music using sound pool.

Here is my code:

CODE:...............

when i do playSound() with 1, 2, 3 sound [wav file] with looping false, they play fine. but if i call playSound any of the 4 files with looping true, it does not work. 4th one is an mp3 file which neither plays with looping true nor looping false. can i create another mediaplayer object as a member variable and use it for only background music ?


View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
HTC Incredible :: Music Player Doesn't Sense When There Should Be Continuous Play Between Tracks
Are you using the stock player? I'm not so happy with it. My biggest problem is that it doesn't sense when there should be continuous play between tracks, so you hear the breaks. Has anybody found something better?

View Replies!   View Related
Android :: Plans For Improving The Sound Pool System
I have been finishing off the port of one of my games to Android, with the last two things being music and sound effects. I have implemented the music system now, using a series of MediaPlayer instances, and that all seems to be working fine (I only need to do limited things with music, just playing, pausing and stopping really). I am now trying to finish of the sound effects, but I am struggling.

1. I am targeting Android 1.6+ and therefore do not have access to the setOnLoadCompleteListener function. What is my best way to wait until all sound effects are loaded? I am thinking my best bet is to load all my sounds, then load a dummy (short, silent) sound, and then sit in a loop attempting to play that sound (and then sleeping for 1ms) until the play returns non zero. Does this sound reasonable? Would it be crazy to do this process for every sound effect I load, as the calling code expects the load function to stall as long as it takes for the load to complete - I am not interested in the sound pool trying to do any async stuff for me, all of my background loading is done in a separate thread, and this thread can stall as long as it likes, as long as it actually loads what I am asking it to.

2. Is there anyway I can find out when a sound effect has finished playing? The games I am porting might have code along the lines of 'play sound effect, wait for it to complete, then fade the screen out and load next context' which on other platforms is easy enough to implement. In OpenAL for example, at the end of each frame I check if the OpenAL state for a given SFX is now stopped, in which case I update the game side sound handle to let it know it's now in the stopped state. But I just can't seem to find a way to achieve the same thing on Android. I am beginning to think my only option would be to (somehow) work out the length of the sample, and then when play is called, set a timer to trigger 100ms after the sample time (100ms to account for any delay in the sound starting), and in the timer function set the game side sfx state to be stopped. Does this sound reasonable? Are there any better ways of handling this?

3. Will a sound pool run out of ids? It seems it have been designed so you have one sound pool per 'level' and after each level you release the pool. This doesn't really fit too well with all my code so I am trying to avoid it. But I notice the documentation states a lot of functions will work even after a sound id is no longer valid (it has stopped for example), the functions won't do anything, but they want break anything. This to me says that id's are never recycled. So are there limits? If so what are the limits?

4. Finally, are there any plans for improving the sound pool system? Ideally I'd like to see it work in a similar way to the other main sound APIs. The reason being I target multiple platforms on the engine side, and have 100% generic game code, so I need to establish a base level interface to the API which will work across the board. This is made very difficult by the SoundPool API being set up to work in a specific way, as opposed to just having reasonable low level functions, and allowing the end user to wrap this up how they see fit. I like the fact there are high level classes around to handle this work of work, and I agree these should remain, but I'd like to see something perhaps lower level exposed, which the SoundPool could wrap around perhaps.

View Replies!   View Related
Games : Download - Play Online Pool Pro 2 For A Smartphone?
I was wondering can you download and play the online game Pool Pro Online 2 for a smartphone like an Android device? I have it on my Dare and when I switch to a Android phone, I want to still be able to play it online.

View Replies!   View Related
Android :: Way To Change Background Dynamically As I Play Music?
I am trying to set the background dynamically as I play music. 1) I am able to set the background using the setBackground (Color.GREEN) method. 2) Then I play a MP3 file (audio) using the MediaPlayer. 3) when I call myPlayer().isPlaying(), I would like to keep changing the background color continuously till the music stops.

View Replies!   View Related
Samsung I7500 : Audio Sound Not Clear When Play Music
So i didn't put any unofficial software,in other words,everything is as it came out of the store (except lots of apps ofc. the problem is that i doesn't play any sound when i want to play music,or with some app (without headphones,when i have them then it's normal) but when someone calls me or i set an alarm then it plays perfectly normal so i'm confused...it's obvious that speaker is not broken.

Then today suddenly i can't hear anything when i'm in a call,and the person from the other side also doesn't hear me,i also don't know why is that...i'm not an expert for this kinda things and actually i'm quite knew in this world.

View Replies!   View Related
Android :: Need Continuous Play Video Player
Has anyone found a video player that automatically plays the next video when the first video ends like episodic videos?

View Replies!   View Related
Android :: RTSP Streams Play Only Sound - While Local Does Video And Sound
In my application, RTSP streams play only sound without video, but if i specify the video path as a local file, it plays the video and audio.

How would i get the RTSP streams to show video?

CODE:.................

View Replies!   View Related
Motorola Droid :: Handle Voice Commands Such As Play Music - Party Shuffle - Play (Artist)
I was just wondering if the Droid can handle voice commands such as "Play Music", "Party Shuffle", "Play (Artist)", "Play (Song)", "Play (Album)", "Open Email", "Play (Video)", etc, etc; or if there are plans for this in the future firmware? I personally could make use of this, especially "Play (Artist)". I tried to make it play a song and it called my grandma ):

Also, can anyone tell me the difference between voice search and voice dialer? It seems like when I use voice dialer, I say "Call Home" and a list of options pops up of who to call (one choice being Home) (When I wish it would have just automatically called Home), but if I use voice search it automatically does call Home.

View Replies!   View Related
HTC Incredible :: Trying To Play Music - Says Unable To Play This Type Of Audio
I took out the 8GB SD card from my Blackberry Storm and put it the Incredible.

I had a bunch of music saved on my SD Card that I downloaded from VZW Music Media thing.

When I go to music on the Incredible and go over the song (it shows the picture of the album of the song)

it says "unable to play this type of audio"

View Replies!   View Related
Motorola Droid X :: Music Player - Play Songs In Alphabetical Order - Play All Songs By Artist
Coming from a Iphone to the X the music player is a little lacking. Often I will go into a certain artist and want to play all the songs by that artist, or thumb through all their songs to find a certain one. On the stock music player on the X this seems hard to do (maybe I'm missing something).

if I pull up the music by artist and select a certain artist then it shows me all their albums (The iphone has the option at this point to select all albums and see all the songs of that artist in alphabetical order). The X doesn't give a option to select all albums at this point. If I go to artists and long press on a certain artist I can select play and it will start playing all that artists songs, then I can hit pause and go into the list from that point to see all the songs but they seem to be in a random order making it hard to find a specific song.

I've tried a couple other players and haven't been able to find one that functions like the Iphone, makes it hard to quickly find one song.

View Replies!   View Related
HTC Wildfire :: Music Won't Play In Music Player
I can get my music onto my phone and use them as ringtones, alarm tones and message tones but when i managed to do this they won't play in the music player, it says "no music found" but when i change my music to a different folder to get it to play in the music application. I then cant use them as my ringtones, message tones etc.

View Replies!   View Related
Android :: Music Website - Play Music On Android - Blackberry - Iphone - Symbian
How can I make my simple site, on which the user can choose to play a number of music clips by clicking on little "play" buttons on the page (think of Amazon's "preview" on their product pages for CDs), work on mobile devices?

[I originally created the page thinking only of desktop browsers, so currently it works by using Flash. I know that won't work at least on the iphone.]

Will I have to build a platform-specific app for all major mobile platforms to provide this kind of simple interface? If so, can you recommend a framework that will let me do this in "write once, run everywhere" fashion?

View Replies!   View Related
Android :: Need Sounds To Play Continuously In Background
I am using soundpool to use sounds in my app. One of the sounds i need to play continuously in background. any example how to do this ?

soundPool.play(soundPoolMap.get(sound), streamVolume, streamVolume, 1, 0, 1f).

View Replies!   View Related
Android :: How To Get A Wav Sound To Play On Phone?
Im making an app, and i want it to make a sound when a activity is opened , the sound file is in R.raw.sound_file , if someone could do some example code to make my app play a sound that would be great.

View Replies!   View Related
Android : Way To Play Sound File?
Can we play sound file in phone line (in background)?

View Replies!   View Related
Android :: Apple App Football Pool
Really wish someone would develop an Android App like this one: Football Pool '10. Really handy if you are in a football pool

View Replies!   View Related
Android :: How To Play Video With Screen Off Player In Background?
I love my Eris BUT it is inferior in one critical area (too me) - I like to use my player t"watch" VIDEO podcasts or tivo'd news shows. Much of the time, I do not need to actually see the video (just want to hear it). So is their a video app that will let me play the video and turn the screen off and/or play video while I use the device to do other tasks. Seems like a simple feature but I cant find it anywhere for the Android.

View Replies!   View Related
Android :: Stop Sound Notification - Let It Only Play Once
Since i don't want to have double entries, but would like a fast spreading, here's my post:
http://groups.google.com/group/android-beginners/browse_thread/thread...

View Replies!   View Related
Android :: ListPreference To Play Sound Is Not Working
I'm trying to use a ListPreference to decide which sound to play on a button click.

I have this at the top:

public String greensound;

Here's my OnClick code:................

I also tried removing the default value here it didnt seem to change anything but, should it be removed?

Here's my Settings.java:

package com.my.app;

CODE:...........

And here's my array's if that will help at all:

CODE:............

Here's a logcat that kinda looked possibly related:

CODE:..........

For those that might ask here's my DDMS > File Explorer > Data > Data > packageName > SharedPreferences This is what was in there:

com.my.app_preferences.xml:

CODE:...................

This all really confuses me more because...It looks like greensound does == gsone so.... I don't understand whats wrong its not even playing the default sound. and yes i've tested all this code without the listpreference code and they work great. I'm not sure what's wrong?

View Replies!   View Related
Android :: Play Sound On A Timed Interval
I have an Android app which needs to play a sound resource on a timed interval, say every 120 seconds. I know how to access the sound resources and play them, however it's time timer part I'm not sure of. What's the best approach?

View Replies!   View Related
Android : Way To Play Sound On Active Call?
I am playing one audio file when call arrives so thecaller can receive it at other side but the issue isyet the opposite caller is not able to listen it what could be wrong in it. Can some one tell me what can be the issue in it ?

View Replies!   View Related
Android :: Create Thread In Background For Playing Sound?
how create thread in background for playing sound?

View Replies!   View Related
Android :: Application Play Sound When Certain Area Clicked?
In my class I have an OnTouchEvent and when a certain area is clicked, it will play a sound (Not sure if this is the best way to go about this?). However I have been running into bugs using the MediaPlayer. Sound will double play and then eventually sound will stop completely. I am wondering how to efficiently play 5 sounds. The user will be clicking the screen in different areas and different sounds will be playing. I have the attached code below but it only has the first area. Say I add in another area how would I go about changing the media player to play a different sound.

@Override public boolean onTouchEvent(MotionEvent e) {
x = e.getX(); y = e.getY();
if (x >= 232 && x<=287 && y>=117 && y<=157) {
//PLAY SOUND } return true;

View Replies!   View Related
Android :: Automatic Call Answering / Play Sound Out
Could it be possible now, which we can develop an Android application having the following requirement for its working steps Automatic receive the call, then Play some sound out to the caller, wait for DTMF response, then Record the caller sound (in the case that they permit, by pressing 1 as DTMF response)Callee can play back the recoreded sound later.

View Replies!   View Related
Android :: Unable To Play Short MediaPlayer Sound
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 Replies!   View Related
Android : How To Play A Sound File Under Droid Browser?
Is there any way to play a sound file under Android browser?

View Replies!   View Related
Android : How To Play Native Camera Sound On Phone
I would like to play native camera shutter sound clip on camera preview capture. I'm referring to the sound clip played when takePicture() is called. How could I that? Can someone walk me through the steps?

View Replies!   View Related
HTC EVO 4G :: Video Recorded Will Not Play With Sound On PC
I have had my Evo since launch day. I have recorded some videos for fun and they play back on the phone nicely. But today, I connected the phone to my PC and wanted to play a video. I got video with no sound. I tried several I recorded some at 720fps and some at VGA. Same results. Videos I downloaded from You Tube play fine. Just the ones I recorded on my phone. I have a relatively new HP running Widows 7 and have used Quick Time and Windows Media Player. Neither would play the sound. Anyone have a problem like this?

View Replies!   View Related
Android :: Video Playback - Sound Doesnt Play Correctly
What could be the reason that a mp4 video file without sound doesn't play correctly when using the VideoView class? The video plays just fine in vlc, mplayer and ubuntu media player. It has been created on the device using ffmpeg. It is like 5 seconds long, so nothing especially big. Codec is H263 with AAC-Audio, though the audio signal is just empty. The problem is, that the video plays, but the image doesn't change, or at least doesn't change a lot. It seems more like a still image, though small movements is sometimes visible but not at all what has been encoded. I noticed that the VideoView stops playing but the time continues to step up, so it doesn't stop counting after 5 seconds but just goes on counting.

I'm using the emulator. Can that be related? I see the following messages in logcat:

CODE:......................

View Replies!   View Related
Android : Notification Doesn't Play Sound / Need To Show Lights
In my android application I have the following As far as I am aware, I have followed the steps in the documentation to set it to play a sound from the resources folder, and to flash the lights. However, neither of these happen. It does, however, vibrate, as instructed. Any ideas what I'm doing wrong here? I've looked through the permissions that I can give the app in the AndroidManifest.xml file, but I can't see one for letting it flash the light or make sounds. Code...

View Replies!   View Related
HTC Incredible :: Way To Get Different Sound To Play For Text Messages?
Is there any way to get a different sound to play for text messages than emails? It would be kinda nice to know in the middle of the night whether I need to reach for my phone or not. Shouldn't be an unreasonable request, but I can't see any way to do it on the phone.

View Replies!   View Related
HTC Incredible :: MP4 Files Wont Play Sound On PC
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 Replies!   View Related
Samsung Captivate :: How To Play Movies With 5.1 Sound?
I'm not sure if it's a bug or missing feature but I can't seem to play movies that are encoded in 5.1 sound. The Captivate will play high bitrate video fine and that is awesome, but it would be silly to expect someone to encode a movie in a high bitrate and only use a stereo track.

View Replies!   View Related
HTC Incredible :: Sound To Play With USB Connection On A Computer?
Does anyone know if it is possible to get the sound to play with the USB connection on a computer? I know I could probably get a head phone jack, but it would be much easier to have one cable. (example, I'd like to play the fm radio through PC speakers)

View Replies!   View Related
HTC EVO 4G : Turn Sound Off / Doesn't Play When On Phone
Can I turn off sound so when I turn on the phone the sound doesn't play.

View Replies!   View Related
Samsung Moment :: Way To Set Phone To Play Sound On Slide?
OK, quick question, maybe m just missing the option, but is there a setting to make the moment play a sound when you slide the keyboard out?

View Replies!   View Related
HTC Droid Eris :: Sms Recieved Sound Files Will Not Play
When I receive sms sound files my htc eros will not play.

View Replies!   View Related
Motorola Droid : How Can I Play Sound File On Phone?
I want to play sound file on phone line..Is it possible.If yes then how to do that..which class should i need to refer.

View Replies!   View Related
Android :: Background Music Playing
My question is : on the HTC Desire, is it possible to listen music with the default player, while doing something else like browsing the web? Because when I'm under the music player app, listening to something, and then I click (or long-click) "home" button, the sound stops. Also, while i'm listening to a track, if a phone call comes in, the music is paused, but when the call ends, the track position is lost and it starts from the beginning. Is all this normal?

View Replies!   View Related
HTC Incredible :: Set Phone Calls To Vibrate But Still Play Notification Sound?
I just got the HTC Incredible and one of the things I haven't been able to figure out is how to set incoming phone calls to vibrate, yet play the notification sound. None of the profiles seems to make that combination happen. If I switch it to silent, no sound or vibrations happen for calls or notifications. In the vibrate profile, both calls and notifications only vibrate. In normal mode, I can't get calls to vibrate only. If I slide the call ringer volume all the way down and slide notification volume up, it switches it to silent mode. If I have call ringer volume up one notch from silent, it still plays the ringtone. Is this something I can accomplish or do I have to have silent calls only if I still want notifications played?

View Replies!   View Related
HTC Droid Eris :: Alarm Clock Only Vibrates / Won't Play Any Sound?
Using the default alarm clock, this morning i noticed my alarm was only vibrating and is no longer playing any sound. Has anyone else had this problem? I have the volume on all other applications turned up, not sure why this is suddenly doing this.

View Replies!   View Related
HTC Desire : Troubleshooting - Video File Only Play Sound And No Image
I am having problems getting videos to play on my HTC Desire. I have converted my .avi files into Mpeg4 so as the device could read them ok. I'm using the free programme 'Handbrake' to convert the files. And it does so with no problems. The new mpeg4 files play with sound and image.

The problem occurs when I transfer the images onto the phones SD card. The video files are picked up via the camera folder (where you can play videos as there is no actual video player) as well as on the video player app I downloaded today - 'mVideoPlayer', without any problems but when I click to play the video the screen is black and only the sound works (even though on my pc the file played fine).

Do I need to download a codec or something? I would have thought that as the Desire was compatible with mpeg4 files that it would play them straight off without having to add software.

View Replies!   View Related
Android :: Can Droid Play Music From Aux?
I was wondering if the motorola droid can play music from another media player I.e. an ipod if I connect an auxiliary cord to them both. Maybe an app or something? Like an input from the headphone jack instead of just output.

View Replies!   View Related
Android :: How To Play Music Album?
I have album id, how can I start activity to play album?

View Replies!   View Related
Android :: How To Play Music From AudioTrack
I want to play music from online mp3 link.I am reading the music data into a stream and trying to play it using audio track. But itz giving only noise.No music i could listen.Same buffer I can play in Media Player,But i could not play in audio track.

View Replies!   View Related
Android :: How To Play Music In Droid?
I want to play a number of sound files in raw directory one after another in android.

View Replies!   View Related
Android : Background Visualizations While Playing Music?
So most of us know we can play a slideshow while listening to music, but how about something like Windows can do with visualizations. I'm looking for an app or something possibly "sound activated" that will show a cool background while listening to music (sort of like Windows does). The active wallpaper's are sort of on track, but not exactly what I'm looking for. The closest thing I found so far was the glow stick that changes colors...any other ideads?

View Replies!   View Related
Sprint HTC Hero :: How To Add Ringtones / Play Mp3s As My Sound On My Alarm Clock?
anyone know how to add ringtones or play mp3s as my sound on my alarm clock i only see about 8 tones i can use and i really dont like any of htem

View Replies!   View Related
Motorola CLIQ :: Make Phone Just Beep / Play A Sound Instead Of Vibrating?
New to these forums as I got my cliq 1 week ago.

I normally keep my phones on vibrate in order to be discreet of any incoming calls or notifications at work. However, when I am talking on the phone and I get a text, the phone vibrates. Is there a way to make the phone just beep or play a sound instead of vibrating. I must admit, it can freak you having the phone buzz in your ear.

View Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved