Device Google Glass XE19.1
我尝试在远程服务器上写文件:
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
mMediaRecorder.setVideoEncodingBitRate(0x4c4b40);
mMediaRecorder.setAudioChannels(2);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mMediaRecorder.setAudioEncodingBitRate(0x17700);
mMediaRecorder.setAudioSamplingRate(44100);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket);
mMediaRecorder.setOutputFile(pfd.getFileDescriptor());
在远程服务器文件写入时,但是当我尝试打开它时,我得到下一个错误:
ftypisom isom3gp4 free
但是当我保存在SD卡中时,没关系。怎么了?
P.S。这个测试代码:效果非常好。文件打开并播放
socket = new Socket(host,4444);
File file = new File("C:/video.mp4");
long length = file.length();
byte[] bytes = null;
bytes = new byte[1024];
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
int count;
while((count = bis.read(bytes))>0){
dos.write(bytes, 0, count);
}
System.out.println("File send");
bos.flush();
bos.close();
fis.close();
bis.close();
socket.close();