No sound coming after Audio / Video Call connection

$(document).ready(function(){

let appID = "XXXXXXXXXXX"; //"APP_ID";
let region = "us"; // "REGION";
let apiKey = "XXXXXXXXXXXXXXXXXXXXXXXX"; //"auth API_KEY";

let showMessage = '';
let conversationData = '';
let callSestionId = ''; 
let receiverID = '';

var appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
CometChat.init(appID, appSetting).then(
  () => {
    console.log("Initialization completed successfully");
    // You can now call login function.
    userLogin();
     //addUsers();


  },
  error => {
    console.log("Initialization failed with error:", error);
    // Check the reason for error and take appropriate action.
  }
);


function userLogin(){

   let UID = jQuery("#userloginId").val(); //"superhero5";

   CometChat.login(UID, apiKey).then(
      user => {
        console.log("Login Successful:", { user });    
        //sendMessage();
        //receiveMessage();
        getalluserList();
        conversationDetails();
      },
      error => {
        console.log("Login failed with exception:", { error });   
        alert("This user is not available");
        window.location.href = "https://www.fathomreads.com/app/cometchat";
      }
   );

}

function getalluserList()
{
    var limit = 30;
    var usersRequest = new CometChat.UsersRequestBuilder().setLimit(limit).build();

    usersRequest.fetchNext().then(
      userList => {
          
        
        // userList will be the list of User class. 
        console.log("User list received:", userList);
        // retrived list can be used to display contact list. 
        
        showUsersList(userList);
        
      },
      error => {
        console.log("User list fetching failed with error:", error);
      }
    ); 
}

$(’#action_menu_btn’).click(function(){
$(’.action_menu’).toggle();
});

function showUsersList(userList)
{
    var userlistHtml = "";
    
    userList.forEach(function (value, index) {
        console.log("user listing", value);
        userlistHtml += '<li class="select_user" data-user="' + value.uid + '" data-username="' + value.name + '" data-pic="' + value.avatar + '">' +
                        '<div class="d-flex bd-highlight">' +
                            '<div class="img_cont">' + 
                                '<img src="' + value.avatar + '" class="rounded-circle user_img">' +
                                '<span class="online_icon ' + value.status + ' "></span>' + 
                            '</div>' + 
                            '<div class="user_info">' +
                                '<span>' + value.name + '</span>' + 
                                '<p>' + value.name + ' is ' + value.status + '</p>' +
                            '</div>' +
                        '</div>' +
                       '</li>';

    });
    
    
    
    jQuery("#contactuser_list").html(userlistHtml);
    
}

function conversationDetails()
{
    
    var conversationsRequest = new CometChat.ConversationsRequestBuilder()
        .setLimit(50)
        .build();

      conversationsRequest.fetchNext().then(
        conversationList => {
          console.log("Conversations list received:", conversationList[0]);
          showMessage = conversationList[0];
          //conversationData = conversationList; 
        },
        error => {
          console.log("Conversations list fetching failed with error:", error);
        }
      );


    

}

jQuery("#contactuser_list").on( "click", "li", function() {
    jQuery(".select_user").removeClass('active');
    jQuery(this).addClass('active');
    console.log('Show message', conversationData);
    //jQuery("#talkuser_name").html(showMessage.conversationWith.name); data-username
    jQuery("#talkuser_name").html(jQuery(this).attr("data-username")); 
    jQuery("#talkuser_img").attr("src",jQuery(this).attr("data-pic"));
    receiverID = jQuery(this).attr("data-user");
    jQuery(".msg_head").show();
    
});


jQuery(".video_cam").on('click', ".calling_btn", function(){
    
   // var receiverID =  "superhero5"; //"UID";
    if(jQuery(this).attr("data-calltype") == 'AUDIO')
       var callType = CometChat.CALL_TYPE.AUDIO;  //AUDIO VIDEO 
    else
        var callType = CometChat.CALL_TYPE.VIDEO;  //AUDIO VIDEO
    
    var receiverType = CometChat.RECEIVER_TYPE.USER;  //GROUP USER

    var call = new CometChat.Call(receiverID, callType, receiverType);

    CometChat.initiateCall(call).then(
      outGoingCall => {
        console.log("Call initiated successfully:", outGoingCall);
        jQuery("#startcall_model").modal();
         callSestionId = outGoingCall.sessionId;
         //startCall();
         callBeginsForUser(callSestionId);
        //callSestionId = outGoingCall.sessionId;
        // perform action on success. Like show your calling screen.
      },
      error => {
        console.log("Call initialization failed with exception:", error);
        CometChat.removeCallListener(receiverID);
      }
    );

});


jQuery(".receive_section").on('click',".receive_call",function(){
    console.log("Accept Call");
    receiveCall(callSestionId);
});

jQuery(".receive_section").on('click','.reject_call',function(){
    console.log("Reject Call");
    rejectCall(callSestionId);
});

function receiveCall(sessionID)
{
     CometChat.acceptCall(sessionID).then(
      call => {
        console.log("Call accepted successfully:", call);
        callBeginsForUser(sessionID);
        //startCall();
        // start the call using the startCall() method
      },
      error => {
        console.log("Call acceptance failed with error", error);
        // handle exception
      }
    ); 
}


function rejectCall(sessionID){
    
    var sessionID = sessionID;
    var status = CometChat.CALL_STATUS.REJECTED;

    CometChat.rejectCall(sessionID, status).then(
      call => {
        console.log("Call rejected successfully", call);
        CometChat.removeCallListener(receiverID);
        jQuery("#calling_model").modal('hide'); 
        jQuery("#startcall_model").modal('hide');
      },
      error => {
        console.log("Call rejection failed with error:", error);
      }
    );

}

jQuery(".receive_section").on('click','.endoutgoing_call',function(){
    endoutgoing_call(callSestionId);
});

function endoutgoing_call(sessionID){
    
    var sessionID = sessionID;
    var status = CometChat.CALL_STATUS.CANCELLED; 

    CometChat.rejectCall(sessionID, status).then(
      call => {
        console.log("Call ended successfully", call);
        CometChat.removeCallListener(receiverID);
        jQuery("#calling_model").modal('hide'); 
        jQuery("#startcall_model").modal('hide');
      },
      error => {
        console.log("Call rejection failed with error:", error);
      }
    );

}

//var listenerID = "superhero5"; //"UNIQUE_LISTENER_ID";
CometChat.addCallListener(
  receiverID,
  new CometChat.CallListener({
    onIncomingCallReceived(call) {
      console.log("Incoming call:", call);
      jQuery("#calling_model").modal();
       callSestionId = call.sessionId;
       callBeginsForUser(callSestionId);
      // Handle incoming call
    },
    onOutgoingCallAccepted(call) {
      console.log("Outgoing call accepted:", call);
      callBeginsForUser(call.sessionId);
      // Outgoing Call Accepted
    },
    onOutgoingCallRejected(call) {
      console.log("Outgoing call rejected:", call);
      // Outgoing Call Rejected
      jQuery("#calling_model").modal('hide'); 
    },
    onIncomingCallCancelled(call) {
      console.log("Incoming call calcelled:", call);
      jQuery("#calling_model").modal('hide');
    }
  })
);


CometChat.addMessageListener(
  receiverID,
  new CometChat.MessageListener({
    onTextMessageReceived: textMessage => {
      console.log("Text message received successfully", textMessage);
      // Handle text message
    },
    onMediaMessageReceived: mediaMessage => {
      console.log("Media message received successfully", mediaMessage);
      // Handle media message
    },
    onCustomMessageReceived: customMessage => {
      console.log("Custom message received successfully", customMessage);
      // Handle custom message
    }
  })
);


function callBeginsForUser(sessionID){
    
   jQuery("#calling_model").modal('hide'); 
   jQuery("#startcall_model").modal('hide');
         
   CometChat.startCall(
      sessionID,
      document.getElementById("callScreen"),
      new CometChat.OngoingCallListener({
        onUserJoined: user => {
          // Notification received here if another user joins the call. 
          console.log("User joined call:", user);
          // this method can be use to display message or perform any actions if someone joining the call 
        },
        onUserLeft: user => {
          // Notification received here if another user left the call. 
          console.log("User left call:", user);
          // this method can be use to display message or perform any actions if someone leaving the call 
        },
        onCallEnded: call => {
          // Notification received here if current ongoing call is ended. 
          console.log("Call ended:", call);
          // hiding/closing the call screen can be done here. 
        }
      })
    );

}

});

Hello @abinash.mohapatra,

Can you please let us know which version of the SDK are you using? And also can you please let us know the browser you are using?

Hi Mayur,

Thanks for replying.

I’m using https://unpkg.com/@cometchat-pro/chat@2.0.6/CometChat.js

API version : V2

Browser : Firefox 74.0 (64-bit)
Chrome: Version 80.0.3987.132 (Official Build) (64-bit)

Hello @abinash.mohapatra,

We are looking into this issue and have created a GitHub issue for the same. Kindly watch the GitHub issue for further updates. I am sharing the link to the GitHub issue below.

1 Like

Hello @abinash.mohapatra,

We are working on improving the cross-browser audio/video calling. You can track the progress of this issue at the link given below.

https://feedback.cometchat.com/cometchat-pro-bugs/p/cross-browser-voice-video-calling-for-web

1 Like

Hello @abinash.mohapatra,

We’ve identified this issue affecting a few of our customers and have released a patch. This issue was due to SSL handshakes timing out. Please confirm if everything is working as expected. Please let us know if you face any issue.