Confused about basic concepts

Hi. I’ve been “playing” with OpenVidu for a while and it seems that I’m not understanding some basic concepts. I’ve read the docs, the samples and searched the forums, but still some things are evading me:

  • Using ipcameras tutorial as a base, I’m trying to create a frontend where a user choose a camera to see or to hide. The cameras are grouped in rooms, so every room is a Session, isn’t it?. For a viewer to watch the cameras, I need a Subscriber Connection with a token to join the Session. Every camera is a “IP-CAM” Connection. When I click on the first camera, everything seems fine and the live stream is showed, but when I click the second camera the same stream is duplicated although I have made sure that the correct rtsp URI is given to the new camera Connection.
  • A camera connection does not have a token, it’s not a viewer but why the user that is already in the session can’t see a new camera added to the session connections? Do I have to recreate the user with the new Session state that has the 2 cameras?.
  • From what I’ve read, a Publisher can publish new streams to a Session, so the backend is acting like a Publisher. In that case, why is not created at the beginning? or maybe I’m wrong.

Hello,

You can publish as many IP cameras as you want to a single OpenVidu Session. Any user connected to that Session will be able to subscribe to those streams and receive the IP cameras. In fact, this is exactly what the openvidu-ipcameras tutorial does: openvidu-ipcameras - OpenVidu Docs

If you want to publish every IP camera in a different Session, then for the final user you will need to create a differente Connection to each Session (and use a different token to connect to each one of them) to be able to receive them. In this case you will have your app (for example a web in a Chrome tab) displaying multiple IP cameras that are actually published to multiple Sessions and are received by the final user through different Connections, each one of them subscribed to one IP camera. Does this make sense? Answering your first point, I don’t know what might be happening for the same IP camera to duplicate in your frontend, but something must be wrong.

IP cameras are “special” participants of a Session. They don’t need a token because you can only publish them to a Session from your application’s backend (using openvidu-java-client, openvidu-node-client or REST API). A user connected to the Session will always receive the proper client events to be able to subscribe to them if necessary.

I don’t really understand your last point. Yes, in this case you could say that your backend is “acting like a publisher”, as an IP camera is a participant of the session in some way, always published from your server side and not from the client side. And of course you can create it from the beginning if you want. Initialize your session and publish an IP camera before giving tokens to clients and letting them connect to the Session. That’s completely up to your application’s logic.

1 Like