Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. WebRtcClient(RtcListener listener, Integer bookingId) {
  2. mListener = listener;
  3. this.bookingId = bookingId;
  4. PeerConnectionFactory.initializeAndroidGlobals(listener, true, false, false);
  5. factory = new PeerConnectionFactory();
  6.  
  7. pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
  8. pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "false"));
  9. pcConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
  10.  
  11. AudioSource audioSource = factory.createAudioSource(pcConstraints);
  12. AudioTrack localAudioTrack = factory.createAudioTrack("ARDAMSa0", audioSource);
  13. localAudioTrack.setEnabled(true);
  14.  
  15. localMS = factory.createLocalMediaStream("ARDAMS");
  16. localMS.addTrack(localAudioTrack);
  17.  
  18. iceServers.add(new PeerConnection.IceServer("nevermind"));
  19. iceServers.add(new PeerConnection.IceServer("nevermind", "test", "test"));
  20.  
  21. mListener.onLocalStream(localMS);
  22.  
  23. }
  24.  
  25. public void onCreateSuccess(final SessionDescription sdp) {
  26.  
  27. CallBody request = new CallBody();
  28. request.setToken(Preferences.getCallToken());
  29. request.setBookingId(bookingId);
  30. request.setSdp(sdp);
  31. pc.setLocalDescription(this, sdp);
  32. SocketManager.get().callConnect(request, new ResponseAdapter(null) {
  33. @Override
  34. public void onSuccess(Api apiName, String json) {
  35. Log.d(TAG, json);
  36. }
  37. });
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement