简体   繁体   English

kurento android客户端库:如何从sdp提供视频流?

[英]kurento android client library: how to get video stream from sdp offer?

In kurento android, after joining the room for group video call, whenever someone connects and starts streaming, the function 在kurento android中,加入房间进行群组视频通话后,每当有人连接并开始流式传输时,该功能

onRemoteStreamAdded(MediaStream mediaStream, NBMPeerConnection nbmPeerConnection)

is called, and I can simply attach the mediastream with a videorenderer and it works. 被称为,我可以简单地附加媒体流与视频中心,它的工作原理。 But when I join the room with existing peers publishing their videos, no media streams show up, but sdp offers are generated. 但是,当我与现有同行一起发布他们的视频时,没有媒体流出现,但生成了sdp优惠。 How do I get video stream from all the users in the room using sdp offers? 如何使用sdp优惠从房间中的所有用户获取视频流?

@aditya i have worked on M2M streaming . @aditya我曾参与M2M流媒体工作。 I have done like this :- 我这样做了: -

  @Override
public void onRoomResponse(RoomResponse response) {
    int requestId = response.getId();
    boolean check = false;
    for (Map.Entry<Integer, String> entry : videoRequestUserMapping.entrySet()) {

        if (entry.getKey() == requestId) {
            check = true;
        }
    }
    if (check || (requestId == publishVideoRequestId)) {

        SessionDescription sd = new SessionDescription(SessionDescription.Type.ANSWER,
                response.getValue("sdpAnswer").get(0));

        if (callState == CallState.PUBLISHING) {

            callState = CallState.PUBLISHED;
            nbmWebRTCPeer.processAnswer(sd, "local");
            mHandler.postDelayed(offerWhenReady, 2000);

        } else if (callState == CallState.WAITING_REMOTE_USER) {
            callState = CallState.RECEIVING_REMOTE_USER;
            String connectionId = videoRequestUserMapping.get(requestId);
            Log.e("ConnectionId", ":" + connectionId);
            nbmWebRTCPeer.processAnswer(sd, connectionId);
        } else {

            callState = CallState.RECEIVING_REMOTE_USER;
            String connectionId = videoRequestUserMapping.get(requestId);

            nbmWebRTCPeer.processAnswer(sd, connectionId);
        }
    } 
}

hi first you need to close the connection when someone leaves the group using 首先,当有人离开小组时,您需要关闭连接

nbmWebRTCPeer.closeConnection("username");

you can manages on this method : 你可以管理这个方法:

 public void onIceStatusChanged(PeerConnection.IceConnectionState     iceConnectionState, NBMPeerConnection nbmPeerConnection) {
 if (iceConnectionState.name().equalsIgnoreCase("CLOSED"))  
   {
   nbmWebRTCPeer.closeConnection(nbmPeerConnection.getConnectionId());
   }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM