i can connect ios app with kurento room for conference call without any issue but i cannot connect it with android, here i am following tutorial Kurento WebRTC Peer For Android to make android client to connect with kurento room.Here is the code what i am tryingpublic class MainActivity extends AppCompatActivity implements RoomListener,NBMWebRTCPeer.Observer { private LooperExecutor executor;private static KurentoRoomAPI kurentoRoomAPI;private EglBase rootEglBase;private NBMWebRTCPeer nbmWebRTCPeer;private SurfaceViewRenderer localView;private SurfaceViewRenderer remoteView;private VideoRenderer.Callbacks localRender;private SessionDescription localSdp;private SessionDescription remoteSdp;NBMMediaConfiguration.NBMVideoFormat receiverVideoFormat = new NBMMediaConfiguration.NBMVideoFormat(1280, 720, ImageFormat.YUV_420_888, 30);NBMMediaConfiguration mediaConfiguration = new NBMMediaConfiguration(NBMMediaConfiguration.NBMRendererType.OPENGLES, NBMMediaConfiguration.NBMAudioCodec.OPUS, 0, NBMMediaConfiguration.NBMVideoCodec.VP8, 0, receiverVideoFormat, NBMMediaConfiguration.NBMCameraPosition.FRONT);private boolean isMyVideoPublished = false;private boolean isMyIceCandidateSent = false;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int hasCameraPermission = checkSelfPermission(Manifest.permission.CAMERA); List<String> permissions = new ArrayList<String>(); if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) { permissions.add(Manifest.permission.CAMERA); } if (!permissions.isEmpty()) { requestPermissions(permissions.toArray(new String[permissions.size()]), 111); } } executor = new LooperExecutor(); executor.requestStart(); String wsRoomUri = "wss://172.16.1.9:8443/room"; kurentoRoomAPI = new KurentoRoomAPI(executor, wsRoomUri, this); kurentoRoomAPI.connectWebSocket(); localView = (SurfaceViewRenderer) findViewById(R.id.gl_surface_local); remoteView = (SurfaceViewRenderer) findViewById(R.id.gl_surface_remote); localView.init(EglBase.create().getEglBaseContext(), null); localView.setZOrderMediaOverlay(true); localView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL); localView.setMirror(true); localView.requestLayout(); remoteView.init(EglBase.create().getEglBaseContext(), null); remoteView.setZOrderMediaOverlay(true); remoteView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL); remoteView.setMirror(true); remoteView.requestLayout(); nbmWebRTCPeer = new NBMWebRTCPeer(mediaConfiguration, this, localView, this); nbmWebRTCPeer.initialize(); //nbmWebRTCPeer.generateOffer("local", true); //nbmWebRTCPeer.generateOffer("MyRemotePeer", false);}@Overridepublic void onRoomResponse(RoomResponse response) { Log.d("onRoomResponse", "******** onRoomResponse : "+response.toString()); if (response.getId() == 123) { Log.d("onRoomResponse", "Successfully connected to the room!"); nbmWebRTCPeer.generateOffer("Jeeva", true); //kurentoRoomAPI.sendMessage("112233", "Jeeva Moto", "Hello room!", 125); } else if (response.getId() == 125) { Log.d("onRoomResponse", "The server received my message!"); } else if (response.getId() == 126) { }else if (response.getId() == 129) { }}@Overridepublic void onRoomError(RoomError error) { Log.d("onRoomError", "******** onRoomError : "+error.toString());}@Overridepublic void onRoomNotification(RoomNotification notification) { if(notification.getMethod().equals(RoomListener.METHOD_SEND_MESSAGE)) { final String username = notification.getParam("user").toString(); final String message = notification.getParam("message").toString(); Log.d("onRoomNotification", "Oh boy! " + username + " sent me a message: " + message); } Log.d("onRoomNotification", "******** RoomNotification : " + notification); if(notification.getMethod().equals("iceCandidate")) { Map<String, Object> map = notification.getParams(); Log.d("onRoomNotification", "******** Map RoomNotification : " + map); String sdpMid = map.get("sdpMid").toString(); int sdpMLineIndex = Integer.valueOf(map.get("sdpMLineIndex").toString()); String sdp = map.get("candidate").toString(); IceCandidate ic = new IceCandidate(sdpMid, sdpMLineIndex, sdp); nbmWebRTCPeer.addRemoteIceCandidate(ic, "remote"); }}@Overridepublic void onRoomConnected() { Log.d("onRoomConnected","******** Called"); kurentoRoomAPI.sendJoinRoom("Jeeva", "112233", true, 123);}@Overridepublic void onRoomDisconnected() {}@Overridepublic void onInitialize() {}@Overridepublic void onLocalSdpOfferGenerated(SessionDescription localSdpOffer, NBMPeerConnection connection) { Log.d("onLclSdpOfrGen","******** localSdpOffer : "+localSdpOffer.description+" connection : "+connection.getConnectionId()); if (!isMyVideoPublished) { kurentoRoomAPI.sendPublishVideo(localSdpOffer.description,false,129); //String username = "qwerty"; //kurentoRoomAPI.sendReceiveVideoFrom(username, "webcam", localSdpOffer.description, 129); isMyVideoPublished = true; }else { String username = "qwerty"; kurentoRoomAPI.sendReceiveVideoFrom(username, "webcam", localSdpOffer.description, 129); }}@Overridepublic void onLocalSdpAnswerGenerated(SessionDescription localSdpAnswer, NBMPeerConnection connection) { Log.d("onLclSdpAnsGen","******** localSdpAnswer : "+localSdpAnswer.description+" connection : "+connection.getConnectionId());}@Overridepublic void onIceCandidate(IceCandidate iceCandidate, NBMPeerConnection nbmPeerConnection) { Log.d("onIceCandidate", "******** iceCandidate : " + iceCandidate.sdp + " nbmPeerConnection : " + nbmPeerConnection.getConnectionId()); if (!isMyIceCandidateSent){ isMyIceCandidateSent = true; kurentoRoomAPI.sendOnIceCandidate("Jeeva", iceCandidate.sdp, iceCandidate.sdpMid, Integer.toString(iceCandidate.sdpMLineIndex),129); } else { kurentoRoomAPI.sendOnIceCandidate("qwerty", iceCandidate.sdp, iceCandidate.sdpMid, Integer.toString(iceCandidate.sdpMLineIndex), 129); nbmWebRTCPeer.addRemoteIceCandidate(iceCandidate, iceCandidate.sdp); }}@Overridepublic void onIceStatusChanged(PeerConnection.IceConnectionState state, NBMPeerConnection connection) { Log.d("onIceStatusChanged","******** state : "+state+" connection : "+connection);}@Overridepublic void onRemoteStreamAdded(MediaStream stream, NBMPeerConnection connection) { Log.d("onRemoteStreamAdded","******** stream : "+stream+" connection : "+connection); nbmWebRTCPeer.attachRendererToRemoteStream(remoteView, stream);}@Overridepublic void onRemoteStreamRemoved(MediaStream stream, NBMPeerConnection connection) { Log.d("onRemoteStreamRemoved","******** stream : "+stream+" connection : "+connection);}@Overridepublic void onPeerConnectionError(String error) { Log.d("onPeerConnectionError","******** error : "+error);}@Overridepublic void onDataChannel(DataChannel dataChannel, NBMPeerConnection connection) { Log.d("onDataChannel","******** dataChannel : "+dataChannel+" connection : "+connection);}@Overridepublic void onBufferedAmountChange(long l, NBMPeerConnection connection, DataChannel channel) { Log.d("onBufferedAmountChange","******** channel : "+channel+" connection : "+connection);}@Overridepublic void onStateChange(NBMPeerConnection connection, DataChannel channel) { Log.d("onStateChange","******** channel : "+channel+" connection : "+connection);}@Overridepublic void onMessage(DataChannel.Buffer buffer, NBMPeerConnection connection, DataChannel channel) { Log.d("onMessage","******** channel : "+channel+" buffer : "+buffer+" connection : "+connection);}}I am looking for any working sample for android client which connects kurento room for conference call. 解决方案 Kurento also has completed Android client with simple UI.It allows to connect to "kurento-room" server using of their KurentoAPI.It has only 2p2, but contain implementation of all needed signaling, so it may be a good start point.More details are there. 这篇关于kurento会议室的Android客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-27 04:32