/// <summary> /// Get VideoStreamOperation. /// </summary> /// <param name="videoStreamOperation">The current VideoStreamOperation.</param> /// <returns>The VideoStreamOperation.</returns> internal static pjsua2.pjsua_call_vid_strm_op GetVideoStreamOperation(VideoStreamOperation videoStreamOperation) { // Select the srtp signaling. switch (videoStreamOperation) { case VideoStreamOperation.PJSUA_CALL_VID_STRM_ADD: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_ADD; case VideoStreamOperation.PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV; case VideoStreamOperation.PJSUA_CALL_VID_STRM_CHANGE_DIR: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_CHANGE_DIR; case VideoStreamOperation.PJSUA_CALL_VID_STRM_NO_OP: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_NO_OP; case VideoStreamOperation.PJSUA_CALL_VID_STRM_REMOVE: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_REMOVE; case VideoStreamOperation.PJSUA_CALL_VID_STRM_SEND_KEYFRAME: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_SEND_KEYFRAME; case VideoStreamOperation.PJSUA_CALL_VID_STRM_START_TRANSMIT: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_START_TRANSMIT; case VideoStreamOperation.PJSUA_CALL_VID_STRM_STOP_TRANSMIT: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_STOP_TRANSMIT; default: return pjsua2.pjsua_call_vid_strm_op.PJSUA_CALL_VID_STRM_NO_OP; } }
/// <summary> /// Add a new video stream. /// </summary> public void AddVideoStream() { // Set as tranmit. VideoStreamOperation videoStreamOperation = VideoStreamOperation.PJSUA_CALL_VID_STRM_ADD; // Set the video stream options. CallSetVideoStreamParam callSetVideoStreamParam = new CallSetVideoStreamParam(); callSetVideoStreamParam.CaptureDevice = _mediaManager.GetVideoCaptureDeviceID(); callSetVideoStreamParam.Direction = MediaDirection.PJMEDIA_DIR_ENCODING_DECODING; callSetVideoStreamParam.MediaIndex = -1; // Start transmitting the capture. _call.SetVideoStream(videoStreamOperation, callSetVideoStreamParam); }
/// <summary> /// Set the video stream direction. /// </summary> /// <param name="direction">The meadia stream direction.</param> /// <param name="mediaIndex">The video media index, usually 1 unless a new video has been added.</param> public void SetVideoStreamDirection(MediaDirection direction, int mediaIndex = 1) { if (_hasVideo) { // Set as tranmit. VideoStreamOperation videoStreamOperation = VideoStreamOperation.PJSUA_CALL_VID_STRM_CHANGE_DIR; // Set the video stream options. CallSetVideoStreamParam callSetVideoStreamParam = new CallSetVideoStreamParam(); callSetVideoStreamParam.CaptureDevice = _mediaManager.GetVideoCaptureDeviceID(); callSetVideoStreamParam.Direction = direction; callSetVideoStreamParam.MediaIndex = mediaIndex; // Start transmitting the capture. _call.SetVideoStream(videoStreamOperation, callSetVideoStreamParam); } }
/// <summary> /// Set the video capture device id. /// </summary> /// <param name="captureDeviceID">The capture device id; default is -1.</param> /// <param name="mediaIndex">The video media index, usually 1 unless a new video has been added.</param> public void SetVideoCaptureDevice(int captureDeviceID = -1, int mediaIndex = 1) { if (_call != null) { if (_hasVideo) { // Set as tranmit. VideoStreamOperation videoStreamOperation = VideoStreamOperation.PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV; // Set the video stream options. CallSetVideoStreamParam callSetVideoStreamParam = new CallSetVideoStreamParam(); callSetVideoStreamParam.CaptureDevice = captureDeviceID; callSetVideoStreamParam.Direction = MediaDirection.PJMEDIA_DIR_ENCODING_DECODING; callSetVideoStreamParam.MediaIndex = mediaIndex; // Start transmitting the capture. _call.SetVideoStream(videoStreamOperation, callSetVideoStreamParam); } } }
/// <summary> /// Stop video capture transmit. /// </summary> /// <param name="mediaIndex">The video media index, usually 1 unless a new video has been added.</param> public void StopVideoTransmit(int mediaIndex = 1) { if (_call != null) { if (_hasVideo) { // Set as tranmit. VideoStreamOperation videoStreamOperation = VideoStreamOperation.PJSUA_CALL_VID_STRM_STOP_TRANSMIT; // Set the video stream options. CallSetVideoStreamParam callSetVideoStreamParam = new CallSetVideoStreamParam(); callSetVideoStreamParam.CaptureDevice = _mediaManager.GetVideoCaptureDeviceID(); callSetVideoStreamParam.Direction = MediaDirection.PJMEDIA_DIR_ENCODING_DECODING; callSetVideoStreamParam.MediaIndex = mediaIndex; // Start transmitting the capture. _call.SetVideoStream(videoStreamOperation, callSetVideoStreamParam); } } }