2017-05-12 3 views
0

すべての参加者のビデオストリームを各参加者のための別々のファイルとして記録したいと思います。コンポジットを使用して単一のビデオを取得すると素晴らしいでしょう。ンクレットグループでの録音はどのようにして行うのですか?

私は以下のようにUserSession.javaで私のコードを追加しました:

public UserSession(final String name, String roomName, finalWebSocketSession session, MediaPipeline pipeline) { 

this.pipeline = pipeline; 
this.name = name; 
this.session = session; 
this.roomName = roomName; 
this.outgoingMedia = new WebRtcEndpoint.Builder(pipeline).build(); 
this.outgoingMedia.connect(this.outgoingMedia); 


this.outgoingMedia.addIceCandidateFoundListener(newEventListener<IceCandidateFoundEvent>() { 

    @Override 
    public void onEvent(IceCandidateFoundEvent event) { 
    JsonObject response = new JsonObject(); 
    response.addProperty("id", "iceCandidate"); 
    response.addProperty("name", name); 
    response.add("candidate",JsonUtils.toJsonObject(event.getCandidate())); 
    try { 
     synchronized (session) { 
     session.sendMessage(new TextMessage(response.toString())); 
     } 
    } catch (IOException e) { 
     log.debug(e.getMessage()); 
    } 
    } 
}); 

this.composite = new Composite.Builder(pipeline).build(); 
this.hubPort = new HubPort.Builder(this.composite).build(); 
this.outgoingMedia.connect(hubPort); 
this.recorder = new RecorderEndpoint.Builder(composite.getMediaPipeline(), "file:///home/vikram/Videos/9/"+this.roomName+"/"+this.name+".webm").build(); 
try{ 
recorder.record(); 
}catch(Exception e){ 
    e.printStackTrace(); 
} 
} 

WebMのファイルは、すべての参加者のための、しかしサイズ「0バイト」で作成されます。あなたは

`this.outgoingMedia.addMediaStateChangedListener(新しいイベントリスナー(){

   @Override 
       public void onEvent(MediaStateChangedEvent event) { 
        if (event.getNewState() == MediaState.CONNECTED){ 
         webRtcEndPoints.add(outgoingMedia); 
         RecorderEndpoint recorderEndpoint = new RecorderEndpoint.Builder(pipeline,"file://"+room.getRecordingFilePath()+ roomName + "/"+ counter + ".webm").build(); 
         webRtcEndPoints.connect(recorderEndpoint); 
         recorderEndpoint.setMaxOutputBitrate(2000); 
         recorderEndpoint.record(); 
         } 
      });` 
outgoingWebRtcEndPoint

をmangaingているuserSesion.javaで

書き込みリスナー:ここ

答えて

0

は自分の質問のためのソリューションです。
関連する問題