Issues using the blur filter after calling replaceTrack()

So I’m not 100% sure whether I’m doing something wrong on my end or whether this issue is actually a bug in OpenVidu, but anyway: My OpenVidu app used to have an own background blur implementation. However, since OpenVidu PRO now has an own implementation for background filters, I decided to switch over.

The issue can be described easily:

What is working: Entering the session with audio and video enabled → activating the blur effect
What isn’t working: Entering the session with audio and video enabled → switch the camera to some other device which will trigger replaceTrack() on the publisher → activating the blur effect

The second case will only show a black video player until I remove the filter again.

Is this a bug in OpenVidu or am I doing something wrong?

Could possibly be a bug. Calling replaceTrack on the video stream can interfere with the blur filter. In the meantime, I recommend removing the filter before calling replaceTrack, and the adding it again, just in case.

Hi,

I have just tested the scenario you described in call.openvidu.io, and I am not able to replicate it.
If you have two video devices and connect to a session, apply the blur effect on it and change the video device on the “Setttings” button, the filter simply deactivates and the camera changes. Not black video player at all.

Can you test this on call.openvidu.io?

Hi Pablo,
thank you for your reply!
Seems like this is a more complex issue. I just tried this scenario in call.openvidu.io as suggested, however I only have one video device on my laptop, so I tried it with my Android Device (Chrome). Once I switch the cameras, the other participants only sees a black screen for my video stream. If some third person enters the room, my video can be seen for a short moment and then turns black again.
So while this is another issue, I think I need to further check my implementation since you didn’t have any issues playing through this scenario in OpenVidu Call.
I’ll report back once I found the issue.

Hi,

We have fixed a bug that seems to be related to this problem. Properties audioActive and videoActive could be changing when calling method Publisher.replaceTrack. This is the commit fixing it: 0e9ae092e5bc085419aadd32a413528bf8434adb

Ah thank you, this actually explains the issue I had with OpenVidu call.
For the original issue described in my first post, I now use the following workaround:

publisher.stream.applyFilter('VB:blur');
publisher.addVideoElement(document.querySelector('.publisher[data-connection-id="local"] video'))

The strange thing is that before calling “applyFilter”, the stream is shown correctly and after calling it, the video turns black. Calling “addVideoElement” solves this issue for me, however, it returns “0” which (according to the docs) means that this video element has already been associated. But it fixes my issue, so I’m good for now :slight_smile: