开发者

Android MediaRecoder writing it to a socket

Currently, I am using Android MediaRecorder class to record video and writing it to a file.

recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);

recorder.setOutputFile("/sdcard/r开发者_高级运维ecordtest.m4e"); But is there anyway I can write it to a socket?


It is probably better to read from the file in another thread and send that to a socket.

In response to your specific question: You can open a Socket, get a ParcelFileDescriptor and pass that into the MediaRecorder's setOutputFile method.

This page describes how, complete with pseudo code: http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜