分兩塊:服務器
1.取得攝像頭採集的視頻流ide
2.發送到服務器端編碼
` 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(1001024); mSender = mLss.accept(); mSender.setSendBufferSize(1001024); mMediaRecorder.start();get
//mReceiver已經和mSender創建鏈接,也就能夠認爲,camera採集的視頻流視頻流會持續發給mReceiver,經過 mReceiver.getInputStream()就能夠獲取到mSerder輸入的視頻流 mSocketHelper.setInputStream(mReceiver.getInputStream()); //mSocketHelper是你本身對Socket的封裝,根據mMediaRecorder的不一樣的編碼格式,實現不一樣的發送方式 mSocketHelper.start(); `服務器端