Search Unity

Question Accessing IP camera / online videos and displaying them on 2D UI

Discussion in 'Audio & Video' started by NameNotFoundNnF, Nov 30, 2021.

  1. NameNotFoundNnF

    NameNotFoundNnF

    Joined:
    Nov 9, 2021
    Posts:
    5
    I don't know if this is the right forum section to post this in, but since the main topic is displaying videos on Unity, I assume this is the right one.

    I'm currently working on an university project, in which I have to develop a broadcaster of sorts. I need to be able to access an IP camera (a phone with an IP camera app), and display the video on a section of an UI interface (I was trying to use a raw image to hold this video, the same way I did for a local camera). However, after messing with many different components and scripts, I am still unable to display the video from the IP camera. I am also unable to fetch a video from a link (from Youtube, in this case) and display it, which is a later requirement. How would I be able to do this?
     
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    For the IP camera, you should be able to use the WebRTC package. It is in preview so not sure it will answer your need but it is the best we have right now. Unfortunately, Youtube doesn't support the streaming of videos outside of YouTube itself. You could create a simple HTTP server with the videos, you want to stream or find another service that allows it.
     
  3. NameNotFoundNnF

    NameNotFoundNnF

    Joined:
    Nov 9, 2021
    Posts:
    5
    Sorry for the late response, but would you be able to tell me how I can use the package you mentioned to connect to the IP Camera and stream its capture onto an UI section? I'm not very knowledgeable in the whole "Networking" side of things.
     
  4. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    Sorry, I think I misunderstood your question. I thought you meant you wanted to stream between 2 unity apps. Before using WebRTC, you need to know what options your app allows (HLS, DASH, RTMP, WebRTC, etc.). After that, you can check if WebRTC is a good solution to your problem.
     
  5. NameNotFoundNnF

    NameNotFoundNnF

    Joined:
    Nov 9, 2021
    Posts:
    5
    I managed to find a different way to access the IP camera and display the contents. It's not perfect, but for this kind of project, it'll work. I basically access the latest frame from the camera, display it, and do it over and over. Obviously, the framerate is not perfect at all, but again, for this project, it works.
     
  6. vermaji

    vermaji

    Joined:
    Jan 7, 2020
    Posts:
    3
    Can you please share what is the approach you are using?