Note that there are some explanatory texts on larger screens.

plurals
  1. POMedia Player on Android stops sounds all together
    primarykey
    data
    text
    <p>I have seen alot of posts about it stopping sound early. This is not my problem. My problem is this... I have these 25 sounds up and working. When the phone is shaked it speaks, displays the text, and has an animation so the person looks like he is talking. It works just fine at first. The only way I was able to reproduce the problem that my client has found is by shaking it numerous times, then clicking back. Shaking back into it and shaking numerous times, then clicking back again. When I shake back into it again for a few times it works then suddenly all sound cuts out. Occasionally one will work but if back again and back in it usually stops making sound all together. Everything else functions as it should. Anyone encountered this before? Any help would be appreciated.</p> <pre><code>public class Ask extends Activity{ private SensorManager mSensorManager; private ShakeEventListener mSensorListener; String[] answer; int possibleAnswers, randomAnswer, talkRun=0, last=-1; int shake0; long lastClick; private MediaPlayer mp, sound0; Context context; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ask); Intent type = getIntent(); lastClick = type.getLongExtra("lastClick", 0); context=this; final Random generator = new Random(); possibleAnswers = 1; answer = new String[possibleAnswers]; answer[0]="***Coughing***"; //Sounds setVolumeControlStream(AudioManager.STREAM_MUSIC); mp = MediaPlayer.create(this, R.raw.askbud); mp.start(); mSensorListener = new ShakeEventListener(); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI); final TextView tv = (TextView)findViewById(R.id.answer); mSensorListener.setOnShakeListener(new ShakeEventListener.OnShakeListener() { public void onShake() { if (System.currentTimeMillis() - lastClick &gt; 900) { lastClick = System.currentTimeMillis(); randomAnswer = generator.nextInt(possibleAnswers); if(last==randomAnswer) randomAnswer = generator.nextInt(possibleAnswers); animation(); if(randomAnswer==0){ if(shake0&gt;=1){ sound0.reset(); } shake0++; sound0 = MediaPlayer.create(context, R.raw.coughing); try { sound0.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } sound0.start(); } }); } @Override protected void onResume() { super.onResume(); mSensorManager.registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI); } @Override protected void onStop() { mSensorManager.unregisterListener(mSensorListener); super.onStop(); } </code></pre> <p>}</p> <p>Just a slight addition to the problem. After I get the no sound to occur it continues to occur even after the app is closed and reopened. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload