IP Camera with REST API and Javascript

Hi there,
I’m trying to setup an application which should gather streams from IP Cameras and make them available via browser. Everything is deployed locally. So far I’ve the following:

  • OpenVidu deployment
  • .NET web application which talks to OpenVidu by means of REST API
  • Browser client which should display video streams (simple HTML/CSS/Javascript page)

I understand the following logic must be implemented:

  • In the .NET Application I need to create a new session, then I need to create a Connection of type “IP_CAMERA” for each stream I want to publish.
  • When a browser client request the video streams, it will contact the .NET application which in turn will open for that client a connection of type “WEBRtc” and return to the browser client the token generated by OpenVidu.
  • At this point the browser client should somehow be able to play the stream

I’ve the following doubts:

  • In the doc there is an example browser client, but I don’t understand where I am supposed to specify the .NET application endpoint and the openvidu endpoint.
    In general, a bit more documentation on the browser client part would be useful imho.
  • I couldn’t find any information about automatic connection teardown: is a connection tear down after a given timeout? where can I find informations about this?

Thank you for your time,
Alessandro

openvidu-ipcameras tutorial is a MVC application built with Java and Thymeleaf, which means that the client JS code won’t directly call the application server. The Java backend returns the HTML with the necessary OpenVidu Token already embedded in it (right here). If your app is not a traditional MVC app (the other common option is an SPA application that actually calls your applications server API with HTTP methods. Here you have a Microsoft post explaining these concepts just in case), then you just need to actively ask for an OpenVidu token to your .NET application server using JavaScript, consuming your application server endpoint (which needs to ask OpenVidu deployment for a Token and return it to the client).

I recommend reading the “Developing your video app” section of OpenVidu Docs: Developing your video app - OpenVidu Docs

As fot the OpenVidu endpoint, that is consumed when calling session.connect(TOKEN) right here.