开发者

Android MediaRecoder writing it to a socket

开发者 https://www.devze.com 2023-01-16 22:43 出处:网络
Currently, I am using Android MediaRecorder class to record video and writing it to a file. recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

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

精彩评论

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