Android : Recording Audio on Google Glass

on Saturday, October 25, 2014


I'm trying to record audio using the glass gdk and am finding it quite problematic.


I'm using media recorder and have all the right permissions, but I keep getting media recorder 100 errors. My code looks something like this:



mMediaRecorder = new MediaRecorder();
mMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {
public void onError(MediaRecorder mediarecorder1, int k, int i1) {
Log.e(TAG, String.format("Media Recorder error: k=%d, i1=%d", k, i1));
}
});
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mMediaRecorder.setOutputFile(mAudioFile.getAbsolutePath());

mMediaRecorder.prepare();
mMediaRecorder.start();


This has to be something to do with the Google Glass as I have run the exact same code on an android phone and it recorded audio correctly. I can find very few resources about using media recorder to only record audio on glass, most posts I have seen are people recording video and audio, whilst I am not interested in video.


Any help working out how I can recorder audio on Google Glass would be greatly appreciated!


0 comments:

Post a Comment