Cambios en grabación para que no grabe sonido de iniciar

parent bbe38841
......@@ -16,6 +16,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
......@@ -183,7 +184,7 @@ public class EditPictoActivity extends Activity {
textoTTotal.setText(tiempoTotal == 10 ? "00:00 | 00:" + tiempoTotal : "00:00 | 00:0" + tiempoTotal );
barraReproducir.setMax(tiempoTotal);
botonGrabar.PhidePressedRing();
if(tiempoGrabado > 1) hayGrabacion = true ;
if(tiempoGrabado >= 1) hayGrabacion = true ;
else hayGrabacion = false;
reiniciarGrabacion();
}
......@@ -486,15 +487,15 @@ public class EditPictoActivity extends Activity {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
recordSoundOn.play(MediaActionSound.START_VIDEO_RECORDING);
try { //Para que no capture el sonido del sistema
sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
gifRecord.setBackgroundResource(R.drawable.record_animation);
tareaGrabacion = (RecordTask) new RecordTask().execute(tiempoGrabado);
startRecording();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
gifRecord.setBackgroundResource(R.drawable.record_animation);
tareaGrabacion = (RecordTask) new RecordTask().execute(tiempoGrabado);
startRecording();
}
}, 500); // 0.5s delay
return true;
case MotionEvent.ACTION_UP:
tareaGrabacion.cancel(true);
......@@ -529,11 +530,16 @@ public class EditPictoActivity extends Activity {
public void onClick(View v) {
borrado = true;
if(hayGrabacion){
stopPlaying();
//stopPlaying();
layoutGrabacion.setVisibility(View.VISIBLE);
layoutPreview.setVisibility(View.GONE);
hayGrabacion = false;
}
File file = new File(previewAudioPath);
if(file.exists()){
file.delete();
}
/*previewAudioPath = null;*/
}
});
......@@ -592,6 +598,7 @@ public class EditPictoActivity extends Activity {
}
private void assignFileToPlayer(File audio){
Log.i(DEBUG_MESSAGE,"Asignado: "+audio.getPath().toString());
mPlayer = new MediaPlayer();
try {
mPlayer.setDataSource(new FileInputStream(audio).getFD());
......@@ -607,6 +614,7 @@ public class EditPictoActivity extends Activity {
}
private void startPlaying() {
Log.i(DEBUG_MESSAGE,"reproduciendo..."+previewAudioPath);
try {
mPlayer.start();
}catch (IllegalStateException e){
......@@ -664,21 +672,6 @@ public class EditPictoActivity extends Activity {
textoTTotal.setText("00:00 | 00:"+(tiempoTotal == 10 ? tiempoTotal : "0" + tiempoTotal));
}
/*@Override
public void onStop() {
super.onStop();
if (mRecorder != null) {
mRecorder.release();
mRecorder = null;
}
if (mPlayer!= null) {
mPlayer.release();
mPlayer = null;
}
}*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment