package com.demo.android.test;
import java.io.File;
import android.app.Activity;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.util.Log;
public class Test extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
File file = new File("/storage/test.mp4");
try
{
if(!file.exists())
{
if(file.createNewFile())
{
Log.e("debug","create empty file successful.");
}
else
{
Log.e("debug","create empty file failure.");
}
}
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile("/storage/test.mp4");
recorder.prepare();
Log.e("debug","recorder start ....");
recorder.start(); // Recording is now started
Thread.sleep(60000);
Log.e("debug","reorder stop....");
recorder.stop();
}
catch(Exception ex)
{
Log.e("debug",ex.toString());
}
}
}
2011年6月30日 星期四
錄製mp4檔案
Labels:
Android
在文字的世界裡尋找心靈的共鳴,遠山藍以溫柔的筆觸分享書籍的力量與生活的智慧。無論是細膩的書評、深刻的人生感悟,還是技術與創新的新奇發現,每篇文章都是一次內心的療癒旅程。希望透過閱讀,帶領讀者在忙碌的生活中找到一片寧靜與啟發。讓我們一起,在書香中遇見更好的自己!
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言