how to pause and unpause video transmission using Android Pjsua 2?

Viewed 392

I wish to pause and unpause video transmission in video call on fly without dropping Audio call using Android Pjsua2 library. But some how i am not able to understand how to implement that feature to sample android pjsua2 app. Any help would be highly appreciated.

i went through below documentation and not able to understand ..how to implement it

enum pjsua_call_vid_strm_op This enumeration represents video stream operation on a call.

PJSUA_CALL_VID_STRM_START_TRANSMIT Start transmitting video stream. This will cause previously stopped stream to start transmitting again. Note that no re-INVITE/UPDATE is to be transmitted to remote since this operation only operates on local stream.

PJSUA_CALL_VID_STRM_STOP_TRANSMIT Stop transmitting video stream. This will cause the stream to be paused in TX direction, causing it to stop sending any video packets. No re-INVITE/UPDATE is to be transmitted to remote with this operation.

link documentation

2 Answers

Consider this code:

fun strmStopTransmit() {
    if (manager.isCaptureActive(camDevId)) {
        val callVidPrm = CallVidSetStreamParam()
        callVidPrm.setCapDev(camDevId)
        call.vidSetStream(pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_STOP_TRANSMIT, callVidPrm)
    }
}

Where manager is instance of pj::VidDevManager (link) (you can get it from pj::Endpoint (link)) and call is instance of pj::Call (link).

The implementation of the inverse function (resuming transmission) is obvious.

Good luck!

This document is too lengthy and not proper. I have been went through the same problem.

The following might help you:

SipManager.getInstance()?.activeCalls?.get(callId)?.mVideoPreview?.stop()

Here, activeCalls is instance of MyCall.

Related