How to update video resolution of publisher based on signal strength?

Hello,

I am now able to identify the speed of the internet of the publisher in android. But once I know the speed of the network carrier(wifi or GSM) I want to reduce or vary the resolution of the stream on that device so that the client can still be in the call even though the resolution is much lesser.

How do I do this?

I understand that there is publishVideo() (but this is at the point of connecting with the media server)

public void publishVideo(SessionDescription sessionDescription) {
Map<String, String> publishVideoParams = new HashMap<>();
publishVideoParams.put(“audioActive”, “true”);
publishVideoParams.put(“videoActive”, “true”);
publishVideoParams.put(“doLoopback”, “false”);
publishVideoParams.put(“frameRate”, “30”);
publishVideoParams.put(“hasAudio”, “true”);
publishVideoParams.put(“hasVideo”, “true”);
publishVideoParams.put(“typeOfVideo”, “CAMERA”);
publishVideoParams.put(“videoDimensions”, “{“width”:” + STREAM_WIDTH + “, “height”:” + STREAM_HEIGHT + “}”); //320
publishVideoParams.put(“sdpOffer”, sessionDescription.description);
this.ID_PUBLISHVIDEO.set(this.sendJson(JsonConstants.PUBLISHVIDEO_METHOD, publishVideoParams));
}

And, in localparticipant we set the widthxheight to the camera for the stream

public void startCamera() {

    final EglBase.Context eglBaseContext = EglBase.create().getEglBaseContext();
    PeerConnectionFactory peerConnectionFactory = this.session.getPeerConnectionFactory();

    // create AudioSource
    AudioSource audioSource = peerConnectionFactory.createAudioSource(new MediaConstraints());
    this.audioTrack = peerConnectionFactory.createAudioTrack("101", audioSource);

    surfaceTextureHelper = SurfaceTextureHelper.create("CaptureThread", eglBaseContext);
    // create VideoCapturer
    VideoCapturer videoCapturer = createCameraCapturer();
    VideoSource videoSource = peerConnectionFactory.createVideoSource(videoCapturer.isScreencast());
    videoCapturer.initialize(surfaceTextureHelper, context, videoSource.getCapturerObserver());
    videoCapturer.startCapture(STREAM_WIDTH, STREAM_HEIGHT, 30);
    // create VideoTrack
    this.videoTrack = peerConnectionFactory.createVideoTrack("100", videoSource);
    // display in localView
    this.videoTrack.addSink(localVideoView);
}

But how do I change the resolution dynamically?

Also, I am thinking about going for OpenVidu Pro! is there any change in the implementation on the client SDK there?

Thanks in advance!

Hello,

The openvidu-android tutorial is using OpenVidu Server RPC protocol.
You can use videoDimensions to set the resolution before to publish the video. You can check all field here.

Hi CSantosM, thanks for the reply!

I got that! and one more thing.

In android,

  1. How to find my streamId to apply filter in android?
  2. when should I apply filter? is it after joining the session & before publishing the video? or after publishing the video?

The filter is configured when init the publisher:

https://docs.openvidu.io/en/2.14.0/advanced-features/filters/#2a-initialize-a-publisher-object-configured-for-using-a-filter-from-the-beginning-of-the-publishing