Add filter effect to local stream

In our browser implementation of OpenVidu, it’s possible to see your own video feed.
When applying a filter to the local stream, this effect is not added to the local feed, as the local video frames come locally from the browser instead from the server where the filter is applied.
Is there any way of either adding the filter to the local feed or receiving the modified local stream from the server so that the user can see the filter applied to her/his stream?

Use the method subscribeToRemote in the Publisher object (https://docs.openvidu.io/en/2.15.0/api/openvidu-browser/classes/publisher.html#subscribeToRemote)

Regards

2 Likes

Hello, I was wondering if there is a way of subscribing to remote without the audio? I just want to see the filter locally without the audio feedback that comes along with subscribing to the remote stream.

You can just mute the audio track of the video player displaying the remote stream.

Hi, using this project for Android Client,openvidu-tutorials/openvidu-android at master · OpenVidu/openvidu-tutorials · GitHub , there is a method for adding effect on local stream? I’ve managed to add the filter, but only the remote client can see the result.

Regards

Server-side filters are only visible by subscribed streams. Local stream just displays the camera.
If you want to show the remote stream with the applied filter on the sender side, then you must create a second Connection on the sender (as if it was a different user), and subscribe to the stream. Then you can display the local camera stream and the remote filtered stream on the same devicec as you wish.

1 Like

Thanks for the reply!

Any example for subscribing to specific stream id? I’ve followed this step:

  1. create a new connection with SUBSCRIBER role
  2. Create a new session with the received token
  3. Start a new Web socket

The screen of subscriber is always black, whereas using Publisher as role, i’m able to see the video with the filter applied.

This is a code snippet of SessionActivity.java taken from android app

///Response from REST api /openvidu/api/sessions/SessionA/connection
String responseString = response.body().string();
Log.d(TAG, "responseSubscriber: " + responseString);
JSONObject tokenJsonObject = new JSONObject(responseString);
String token = tokenJsonObject.getString("token");
String id = tokenJsonObject.getString("id");
Session session2 = new Session("SessionA", token, views_container, SessionActivity.this);
LocalParticipant localParticipant = new LocalParticipant("sub2", session2,SessionActivity.this.getApplicationContext(), localVideoView);
 localParticipant.startCamera(); //for publisher role
startWebSocket(session2);

I have found a lot of documentation about openvidu-browser rather than the android version.
Any suggestion?

Best regards