02-18-2010 11:12 AM
I have an app that playes audio files. But before playing the file i need to check and make sure that the audio player is not already running/playing another audio file......
Can someone guide me on how i can know whether the audio player is already playing or its closed state?
02-18-2010 01:43 PM
02-18-2010 11:32 PM
Thanks for the reply,
But the getState() method is not a static method. Which means that it will give me the state of a given player instance. But the trouble i am facing is that i dont have any access to the current state of the player that has already started.....
Or can you tell me how i can get the current instance of a player that is already playing?
02-18-2010 11:46 PM - edited 02-18-2010 11:48 PM
If you create a reference to the Player then you can get its state. Try declaring it as a field in the class that you're using it in (unless you're using more than one. Then you'd need to have separate references for each. The other way to do it is to use PlayerListener.
After creating your Player or Player instances, you'd then attach the PlayerListener to it and the PlayerListener would get notified every time the state is changed.
02-19-2010 05:27 AM
Can anyone please tell me how i can get the state of a instance of player that has already started running before i start my app......i need to know this bcoz, i want to make sure that the player is not playing another file before i try to play my own audio files.....