Two way audio issue as only one can speak and other can hear

Aim: 2 users should be able to talk over audio and only one of them publishing video as well.

Assume 2 users are in session. Lets call the first user as operator and the second user as caller one.

Operator initiates a session and asks caller to join the session. Operator wants to see the video of caller and well as hear what the caller is speaking and for self it only wants to share audio and not video

I have tried implementing this but I can only hear callers audio and see callers video at operator but caller is not able to hear operators audio. Can anyone please help here

Below is the pulblisher configuration for operator

function getPublisherData() {
//Checking if the video is being streamed by caller or operator and publishing data on the basis of devices 

    //Publisher data for operator
    $parameters.PublisherData = OV.initPublisher($parameters.Selector, {
        audioSource: $parameters.IsAudioCapability ==true? undefined : false, // The source of audio. If undefined default microphone
        videoSource: $parameters.IsVideoCapability == true ? undefined : false, // The source of video. If undefined default webcam
        publishAudio: $parameters.IsAudioCapability ==true? true : false, // Whether you want to start publishing with your audio unmuted or not
        publishVideo: true, // Whether you want to start publishing with your video enabled or not
        resolution: '640x480', // The resolution of your video
        frameRate: 30, // The frame rate of your video
        insertMode: 'APPEND', // How the video is inserted in the target element 'video-container'
        mirror: $parameters.IsFrontCamera
    });
    $resolve();
    joinSession();
    session.unpublish($parameters.PublisherData);
}

Below is the streamcreatedhandler for operator

function streamCreatedHandler(event) {

   

    // if(event.target.streamManagers.length ===0 && $parameters.Recording){

    //     $actions.StartRecording();

    // }

    //$('#ShareWith').prop('disabled', false);

    noofCallers++;

        var subscriber = session.subscribe(event.stream, $parameters.Selector);

        subscriber.on('videoElementCreated', function(event) {

            loader(false);

            $actions.CallerStreamed();

            $("#muteUnmute").show();

            EndedCall(false);

            // Add a new HTML element for the user's name and nickname over its video

            appendUserData(event.element, subscriber.stream.connection, event.stream);

            $parameters.NumOfVideos++;

            updateLayout();

            //document.getElementById("SwitchStatus").value = true;

            //document.getElementById("ShareWith").value = true;

        });

}

Below is the publisher data configuration for caller:

function getPublisherData() {

            //Getting device available on the caller side

            //Publisher data for caller

            $parameters.PublisherData = OV.initPublisher($parameters.Selector, {

                audioSource: $parameters.IsAudioCapability ? undefined : false, // The source of audio. If undefined default microphone

                videoSource: videoDevices.length > 0 ? videoDevices[videoDevices.length - 1].deviceId : undefined, // The source of video. If undefined default webcam

                // videoSource: $parameters.IsFrontCamera ? videoDevices[0].deviceId : videoDevices[1].deviceId,

                publishAudio: false, // Whether you want to start publishing with your audio unmuted or not

                publishVideo: true, // Whether you want to start publishing with your video enabled or not

                resolution: '640x480', // The resolution of your video

                frameRate: 30, // The frame rate of your video

                insertMode: 'APPEND', // How the video is inserted in the target element 'video-container'

                mirror: $parameters.IsFrontCamera

            });

            $resolve();

            joinSession();

}

Below is the streamcreatehandler for caller:

function streamCreatedHandler(event) {

    if(event.stream.connection.data === '{"clientData":"Operator"}'){

        var subscriber = session.subscribe(event.stream, $parameters.Selector);

        subscriber.on('videoElementCreated', function(event) {

            noOfCallers = 1;

            // Add a new HTML element for the user's name and nickname over its video

            appendUserData(event.element, subscriber.stream.connection, event.stream);

            $parameters.NumOfVideos++;

            updateLayout();

        });

    // When the HTML video has been appended to DOM...

}

    //$actions.ActivateLiveChat()

}

Hi @chetan_choudhary

I’m also facing the same issue that you have been facing, could you let me know if your issue is solved? If yes, please let me know the solution that you have used to solve the issue.

Here is a description of the issue.

Issue:
We are working on a remote collaborative application that is deployed both as an APK using the Cordova app on the client side (sender) and as a web application on the receiver’s end. In an active open vidu one-on-one call, A being the sender and B being the receiver, the audio of B(Receiver) is not audible to A(Sender). Whereas the video of both A(Sender) & B(Receiver) is visible to each other. When tested on OpenVidu by creating a custom room, both the audio and video of A & B are audible and visible.

Solutions tried and failed:
All these changes were made to the client-side javascript files.

1)Tried changing the audio source from true to undefined.
2)Tried printing the value of the publishAudio, while printing the value, it shows as true
3)Tried changing the OpenVidu Browser version from 2.18.0 to 2.20.0

Packages used:

  1. OpenVidu: 2.20.0

Browsers tested: Chrome (106.0.5249.121), MS Edge (107.0.1418.26)

Thanks in advance :slight_smile: