Android :: Playing Sounds In Game Application Using Media Player

Feb 5, 2009

I am using mp3 sound in my game (used wav format also) while playing sound I get problem as "obtainBuffer timeout (is the CPU pegged)" and then sound gets played after some time i.e it is not synchronized with the game play.

Android :: Playing Sounds in Game Application using Media Player


Android :: Media Player Not Playing Sounds On Droid X

Jul 28, 2010

I have some pretty simple Soundboard applications on the Android Market that work flawless on an LG Ally, the Motorola Droid, and the Nexus One, but I recently received an e-mail from a user with the Motorola DroidX claiming that most of the sounds do not work. I've exchanged a few e-mails with him. He claims the Soundboard is the only application running, and he's double checked to make sure that the Media Volume wasn't set to minimum. I really don't have access to one either to play around with. The application isn't doing anything cosmic to play the sounds. Below is a code snippet. Any insights into what might be causing the hang up are greatly appreciated.

public void play(Sample sample) {
Log.v(TAG, "Playing: " + getString(sample.getButtonTextResId()) + " (" + sample.getSoundResId() + ")");
if (mPlayer != null) { mPlayer.stop(); mPlayer.release();
} MediaPlayer player = MediaPlayer.create(this, sample.getSoundResId());
mPlayer = player; if (player != null) { player.setVolume(1.0f, 1.0f);
player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override public void onCompletion(MediaPlayer mp) { mp.release();
mPlayer = null; } } ); player.start(); } }

View 1 Replies View Related

Android :: Playing Media File In Android Media Player Application

Apr 14, 2010

I just started with creating my own media player application by looking at the code samples given in Android SDK. While I am trying to play a local media file (m.3gp), I am getting IOException error :: error(1,-4).

package com.mediaPlayer;
import java.io.IOException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;...........

View 1 Replies View Related

Media :: Media Player Playing Alphabetically Instead Of Track

Jun 7, 2010

The tracks in an album playing alphabetically instead of by the track number?

View 3 Replies View Related

Media :: Game Media Showing Up As Mp3 / Video Player / Way To Fix?

Jul 21, 2010

I recently bought some gameloft games for my droid incredible but i noticed all the sounds of music of the games are showing up on my media players. Is there any fix for this issue?

View 2 Replies View Related

Android :: Media Player Sluggish To Play Sounds

Mar 31, 2009

I have an Activity that plays a brief OGG "pop" sound effect when bubbles pop. To keep it fast and to ensure I can play several pops, I create four MediaPlayer instances. I synchronize access to a pool of instances, so I can play up to four pops at once. Once a sound completes, I call seekTo(0) and return the MediaPlayer instance to my pool.

Here is a rough sketch of the code:
// when the activity resumes... for (int i=0; i<4; i++) {
MediaPlayer mp = MediaPlayer.create(context, R.raw.pop);
mp.setOnCompletionListener(this);
mp.setVolume(1f, 1f); players.add(mp); // put into a pool of available players }

View 4 Replies View Related

Android :: Playing (M3U Files) With Media Player

Jan 8, 2010

I'm trying to play a playlist I get using the MediaStore provider. However, when I try playing a playlist nothing happens. Can a MediaPlayer play a playlist (m3u file) and do I need to set the first track to play? This is my test code in the onCreate() method:

Uri uri = MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI;
if(uri == null) { Log.e("Uri = null");
} String[] projection = new String[] { MediaStore.Audio.Playlists._ID,
MediaStore.Audio.Playlists.NAME, MediaStore.Audio.Playlists.DATA };
Cursor c = managedQuery(uri, projection, null, null, null);
if(c == null) { Toast.makeText(getApplicationContext(),
R.string.alarm_tone_picker_error, Toast.LENGTH_LONG).show();
return; } if(!c.moveToFirst()) { c.close();
Toast.makeText(getApplicationContext(), R.string.alarm_tone_picker_no_music,
Toast.LENGTH_LONG).show(); return; } c.moveToFirst(); try {
MediaPlayer player = new MediaPlayer(); player.setDataSource(c.getString(2));
player.start(); } catch(Exception e) { e.printStackTrace(); }
I have turned on every volume stream.

View 1 Replies View Related

Android :: Playing Recorded Sounds In Application (Target 1.5)

May 1, 2009

I have an application that I developed using the Android 1.1 SDK that I am trying to port to Android 1.5. In my application, I record a sound through the microphone and then do various things with it, including playing it back using a MediaPlayer object. My code works fine when I use the 1.1 target, but when I use a 1.5 target I get this error when setting up the player:

Command PLAYER_SET_DATA_SOURCE completed with an error or info PVMFErrNotSupported error (1, -4) Couldn't setup MediaPlayer java.io.IOException: Prepare failed.: status=0x1 at android.media.MediaPlayer.prepare(Native Method) at org.byu.chum.AudioUtils.AudioRecording.stopRecording (AudioRecording.java:92) at org.byu.chum.SoundRecorder.Recorder$StopListener.onClick (Recorder.java:198)...

It seems like Android isn't liking the format of my media, but I don't know why, since I just recorded that very format on the Android device. Here's the code that is throwing the error:

player = new MediaPlayer();
try { player.setDataSource(recordFile.toString());
player.prepare(); } catch (IOException e) { Log.e("playRecording", "Couldn't setup MediaPlayer", e); }

View 13 Replies View Related

Android :: Playing Multiple Sounds At Same Time In Application

Apr 13, 2010

I am unable to use the following to code to play multiple sounds/beeps simultaneously. In my onclicklistener I have added
... public void onClick(View v) { mSoundManager.playSound(1);
mSoundManager.playSound(2); } ...
But this plays only one sound at a time, sound with index 1 followed by sound with index 2. How can I play atleast 2 sounds simultaneously using this code whenever there is an onClick() event?

public class SoundManager {
private SoundPool mSoundPool;
private HashMap<Integer, Integer> mSoundPoolMap;
private AudioManager mAudioManager;
private Context mContext;
public SoundManager() {
} public void initSounds(Context theContext) {
mContext = theContext; mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
mSoundPoolMap = new HashMap<Integer, Integer>();
mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
} public void addSound(int Index,int SoundID)
{ mSoundPoolMap.put(1, mSoundPool.load(mContext, SoundID, 1));
} public void playSound(int index) {
int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, 1f);
} public void playLoopedSound(int index) {
int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, -1, 1f);
} }

View 1 Replies View Related

Android :: Playing Multiple Sounds - Application Crashes

Jun 14, 2010

Shown are a few lines of code. If I play a single sound, it runs fine. Adding a second sound causes it to crash.

private SoundManager mSoundManager;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.sos);
mSoundManager = new SoundManager(); mSoundManager.initSounds(getBaseContext());
mSoundManager.addSound(1,R.raw.dit); mSoundManager.addSound(1,R.raw.dah);
Button SoundButton = (Button)findViewById(R.id.SoundButton);
SoundButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) { mSoundManager.playSound(1);
mSoundManager.playSound(2); } } ); }

View 1 Replies View Related

Android :: Media Player Put Itself In The Ongoing Group When Playing

Sep 8, 2009

How does the media player put itself in the "Ongoing" group when playing?

View 3 Replies View Related

Android :: Media Player Minimizes & Still Playing Audio

Jul 5, 2010

I would like to find an media player that plays videos but when I minimize or multitask to another app I want the videos audio to keep playing like pandora does. The reason for this is bcuz I rip videos off of youtube to mainly listen to the music.

View 2 Replies View Related

Android :: Rotation Slows When Media Player Playing

May 17, 2010

I have an application where i play music from media player continuously. I am rotating an ImageView object with RotationAnimation simultaneously while background music is playing. Before music starts playing,the rotation is fine,,but when mediaplayer starts playing music rotation disrupts,and slows down.

View 3 Replies View Related

Android :: Continue Playing After Leaving The Media Player

Apr 28, 2010

I launch the Media Player to play a mp3 file the usual way:

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

Leaving the Media Player using the Back button stops the playback. How can I ensure that the Media Player continues playing.

View 2 Replies View Related

Android :: Getting Media Player Error While Playing File / Fix It

Mar 9, 2009

I am also getting the same error while playing the media file

E/MemoryHeapBase(31): mmap(fd=20, size=233472) failed (Invalid argument) E/VideoMIO( 31): Error creating frame buffer heap.

View 2 Replies View Related

Android :: Having 2 Media Player Objects Playing In Sync

Nov 4, 2010

In my android game I want to have a rhythm Mediaplayer object and a lead Mediaplayer object playing in sync. However at the moment the rhythm is a slight bit behind the playback of the lead Mediaplayer object. Is there a way I can make it so that both are started at the same time, for instance using Runnables etc?!It's quite crucial that they play in sync with each other as you can imagine!

View 1 Replies View Related

Android :: Media File Playing Details In Android Media Player?

Aug 31, 2010

Is there any way to get the details of media files that is executed in android(default) media player?

View 3 Replies View Related

Android :: Getting Current Playing Song Details From Media Player

Sep 1, 2010

Is there any way to get the details of current song played by media player?

View 3 Replies View Related

HTC EVO 4G :: Stop Stock Media Player App From Playing All Tracks?

Jul 30, 2010

I love my Evo, however the music app will play EVERY song it finds, including my ringtones and YouMail messages. Can I make it just play the songs in my songs folder (and sub-folders) on my SD Card? I only want it to search my songs folder, not the whole phone or the whole SD Card.

View 8 Replies View Related

Android :: Audio Native Player - Device Automatically Stops Playing Current Media

Aug 21, 2010

Invoked device native player to play audio file, it opens android native player on top of the application but when selecting to back out or return to the application, device automatically stops playing the current media.

Sample code:

Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"audio/*");
startActivity(intent);

How can I implement so that Device should continue to play audio in the background when selecting to back out or return to the application

View 1 Replies View Related

Media :: Disable Stock Music Player From Playing Songs?

Feb 22, 2010

Is there anyway to stop the stock music player on my HTC Hero from playing songs? I have a bluetooth headset and whenever I use the controls on the headset it activates the stock music player instead of the one I downloaded.

View 2 Replies View Related

Motorola Droid :: Audio - Media Player Starts Playing By Itself

Jan 12, 2010

when I'm listening to audio with my headphones through cherry rplayer and then take the headphones out to use the speaker, I don't get any sound...I have to shut down any audio players functions before I get any sound out of the speaker. Not sure if cherry rplayer is the culprit or not. I have also noticed that my media player starts playing by itself...

View 8 Replies View Related

General :: Video / Media Player That Continues Playing When Minimized

Aug 21, 2012

I am new to using Android. I am wondering if there is any video (MP4) player that would continue playing the video even when I use the home button to switch to other apps (e.g. check my email etc.) I have a few documentaries/discussions to watch and sometimes minimize the video player to check other information on my phone and the video stops.

Any Video players that continue playing when minimized. I know that the Meridian Player continues playing when the screen is switched off, but it stops if you press the home button.

(I use a Galaxy Nexus with Jelly Bean.)

View 2 Replies View Related

General :: How To Block Game Files From Showing Up On Media Player Of Choice

Jan 15, 2013

How do you block Android game files from adding themselves to your media players? For example, if you're using Moboplayer to view the pics and vids you've shot with your camera, and you have a game like Dragon's Lair that has hundreds of mini 3 mB vid clips on your device to play the game, when I try to view my personal videos, I have to filter through the 800 some odd game vid clips just to look at my home videos. To add insult to injury, if you use a backup like Verizon that backs up only your newest movies and pics, it also downloads these hundreds of vid clips as well as photos of the uniforms on a game like Home Run Battle.

View 1 Replies View Related

Media :: Application To Turn Off Notification Sounds

Mar 6, 2010

Is there a way to turn off the notification sounds at a certain time of day? I hate the sound of getting e-mail at 2 in the AM and waking me up. I have a Telus Milestone which runs v2.0.1

View 7 Replies View Related

Android :: Media Player Application - Video Streaming Through RTSP Protocol

Feb 16, 2010

I am writing a media player application in Android when I calling a mp.prepare() it is giving a IllegalStateException. The same RTSP URL working with VLC or quick time Media Player.

View 2 Replies View Related

Android :: Playing Sounds From Assets Folder

Nov 9, 2010

I have 5 mp3 files stored on the assets folder. The files are all 25 KB. I load the files using:
manager = context.getAssets();
this.inputStream = manager.openFd(fileName).createInputStream();
Whenever I try to play the files, the sounds are all messed up like they were mixed or something.
I've zip aligned the app already but with no results.

View 3 Replies View Related

Android :: Playing Simple Sounds On Emulator

Feb 16, 2009

I am working on the Eclipse Emulator and with SDK 1.0 Release 2. What I would like to do is to play a simple C note with with code. Does android provide the necessary interface to produce such note sounds? Is there a sound library and API I can readily use on the device (and emulator)?

View 3 Replies View Related

Android :: Playing Multiple Sounds - Error Shown On Log

May 19, 2010

I'm playing some MediaPlayer instances at the same time (4 or 5) but sometimes when I try to start a new media player it doesn't work and an error is shown on the log:

E/AudioFlinger( 1073): no more track names availlable E/AudioTrack( 1073): AudioFlinger could not create track, status: -12 E/AudioSink( 1073): Unable to create audio track E/VorbisPlayer( 1073): mAudioSink open failed

It also happens when there're only 3 or 2 MediaPlayer playing at the same time. What does it mean this error? How can I workaround with it? Actually checking the isPlaying() after the start() call does not seem very helpful as every call returns true. I've to say that every MediaPlayer is created once via MediaPlayer.create.

View 5 Replies View Related

Sprint HTC Hero :: Adjust Media Volume Without First Playing Media?

Oct 14, 2009

I noticed that you can't adjust media volume without first playing media. Like you have to, for example, press the play button before pressing rocker volume in order to adjust media volume or else you'll just be adjusting ringer volume. This is unfortunate since games also use media volume. So if you wonna start up a quick game in a quiet setting, your in trouble if you were listening music before and never turned down/off the media volume. Unless I'm missing something and there is in fact a way to do it?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved