android获取服务器视频,Android摄像头採集的视频数据流怎样通过Socket实时发送到目标服务端...
分两块:1.取得摄像头採集的视频流2.发送到server端protected MediaRecorder mMediaRecorder;private LocalServerSocket mLss = null;private LocalSocket mReceiver, mSender = null;mLss = new LocalServerSocket("myVideoStream");mR
分两块:
1.取得摄像头採集的视频流
2.发送到server端
protected MediaRecorder mMediaRecorder;
private LocalServerSocket mLss = null;
private LocalSocket mReceiver, mSender = null;
mLss = new LocalServerSocket("myVideoStream");
mReceiver = new LocalSocket();
//连接mLss,即接受方主动发起连接
mReceiver.connect( new LocalSocketAddress("myVideoStream"));
mReceiver.setReceiveBufferSize(100*1024);
mSender = mLss.accept();
mSender.setSendBufferSize(100*1024);
mMediaRecorder.start();
//mReceiver已经和mSender建立连接。也就能够觉得,camera採集的视频流会持续
//发给mReceiver,通过mReceiver.getInputStream()就能够获取到mSerder输入的视频流
mSocketHelper.setInputStream(mReceiver.getInputStream());
//mSocketHelper是你自己对Socket的封装,依据mMediaRecorder的不同的编码格式。实现不同的发送方式
mSocketHelper.start();
更多推荐
所有评论(0)