How to unpublish without a session

I am testing OpenVidu as an alternative to TokBox.

In TokBox the publisher object has a destroy event which removes the video from the DOM and deletes the publisher object (the camera gets turned off).

OpenVidu has a unpublish method on the session object which is similar, but I have a case where I don’t have a session. I am only creating a publisher to allow users to make sure their camera is working and see how everything works before actually joining a session.

This is what I have tried that hasn’t worked…

  • manually remove the video element from the DOM.
  • call publishVideo(false) on the publisher
  • I even tried copying what session.unpublish does

Is there a method to do this, or some manual way to replicate what unpublish does but without a session? The goal is to get the camera/mic stopped.

Hello @Adam,

Nowadays OpenVidu doesn’t provide any method with this feature. However, you can destroy the publisher when is not connected to the session with the following code:

publisher.stream.disposeWebRtcPeer();
publisher.stream.disposeMediaStream() 

In the upcoming versions, we’ll provide this feature as a method.

Regards Adam :slight_smile:

That works perfectly. Thanks!

Hi @CSantosM. Has this feature been added? Thanks.

No yet, we have other priorities.

Greetings

Hi, just checking if this feature already implemented?

Hi @CSantosM, any update on this feature?