最近我遇到了这个问题,但不知道。我想使用“mediarecorder”录制 720P 视频流并实时发送到服务器。这是我的代码:
try{
soc = new Socket(InetAddress.getByName(hostname), port);
} catch (UnknownHostException e){
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
CamcorderProfile pProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
//pProfile.videoFrameWidth = 1280;
//pProfile.videoFrameWidth = 720;
recorder.setProfile(pProfile);
//recorder.setOutputFile(myRecAudioFile.getAbsolutePath());//保存路径
pfd = ParcelFileDescriptor.fromSocket(soc);
recorder.setOutputFile(pfd.getFileDescriptor());
recorder.prepare();
recorder.start();
android API 级别是 17,当我启动媒体记录器时,程序会死一两秒。像这样的错误日志:
IMediaDeathNotifier- media server died
Camera - Camera server died
有遇到过类似问题的朋友可以给我一些建议吗?