How to use Unity WebRTC DataChannel with WebSockets in LAN - Full Tutorial

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 42

  • @firedragongamestudio
    @firedragongamestudio  День назад

    This project is open source and the repo can be found here: github.com/FireDragonGameStudio/YT-Unity-WebRTC

  • @Dylan_Rider
    @Dylan_Rider Месяц назад

    eyyyy thanks for making these videos. You have been a complete lifesaver!!!! im still not completely familiar with how it all works but i know ill get there eventually. Im just glad its working XD

  • @otaro36
    @otaro36 5 дней назад

    Hello, how are you? I would like to ask the following question: I have a Janus server providing a WebRTC video, and I need to play it in Unity using WebRTC, but I’m not sure about the procedure. Could you explain how to do it?

  • @numoru
    @numoru Год назад +5

    Yo bro Is this a secret? 😂whispering like someone hiding in a closet with a serial killer looking for them

    • @firedragongamestudio
      @firedragongamestudio  Год назад +3

      Well, you'll have to watch the whole video to find out 😂 I simply messed up the Audio settings when exporting and was too lazy to export again. Wasn't aware that YT doesn't provide a possibility to increase the audio after uploading, sry about that 😅

    • @snakebyteOne
      @snakebyteOne 9 месяцев назад +1

      Yeah, thought I stumbled onto an ASMR video :)

  • @pjpar2
    @pjpar2 11 месяцев назад +1

    Thank you so much for your tutorial. Using Unity-WebRTC with the official sample is really hard.
    I have followed your tutorial but I have obtained a different behavior in the messages exchange and, finally an error. The message "SERVER SimpleDataChannelService started!" appears twice and the next message is "Sender oppened channel!" before any ICEcandidate or Offer exchange. Do you know where could be the problem? I know it is a difficult question without any other data but any idea could help me. Thank you.

    • @firedragongamestudio
      @firedragongamestudio  10 месяцев назад +1

      There may be a possibility that you added the Server script two times in your scene. Pls make sure that there is only one running websocket server.

  • @nikkiasteinza590
    @nikkiasteinza590 10 месяцев назад +1

    Hey there! Thanks for this. I'm having an issue: it takes a while to enter play mode in the Unity editor, and then there's no 'SERVER SimpleDataChannelService started!' message. Can you shed some light on this? Using unity 2022.3.20f1

    • @firedragongamestudio
      @firedragongamestudio  10 месяцев назад

      Maybe you haven't added the server script to the hierarchy?

    • @nikkiasteinza590
      @nikkiasteinza590 10 месяцев назад

      Both scripts are added@@firedragongamestudio

    • @nikkiasteinza590
      @nikkiasteinza590 10 месяцев назад

      Both scripts are added, when debugging I can see the wssv Ip at the SimpleDataChannelServer is not what we define on the InitClient. Could be that? @@firedragongamestudio

    • @nikkiasteinza590
      @nikkiasteinza590 10 месяцев назад

      It was that!

  • @VeneDrummer
    @VeneDrummer 2 месяца назад

    I'm at around minute 23. I get this error that says webRTC doesn't have context. I look online and it seems like I need WebRTC.Initialize(); to set up peer connections? but I currently don't see it in the code. is it something new? am I missing something?
    You don't plan on putting source online right? I'm trying to follow but sometimes double checking code is hard because I have to scroll through the video to see where you wrote something.

    • @firedragongamestudio
      @firedragongamestudio  Месяц назад

      I'm actually going to open-source the code with January 2025. So if you're still struggeling, you should be able to test the code directly in about 3 weeks :)

  • @aleksandrafomin6157
    @aleksandrafomin6157 7 месяцев назад

    Hi, thank you so much for the video! I'm having an Error SocketException: Could not resolve host 'MacBook-Pro-Alex.loc'
    Couldn't find any solution for that yet, would you happen to know what might cause this? it's the same Error with all the WebRTC tutorials.

    • @firedragongamestudio
      @firedragongamestudio  7 месяцев назад +1

      Sounds like the string for the host is escaped somehow and cropped.

  • @myselfbryan
    @myselfbryan 8 месяцев назад

    Hi there! Thanks for the video. It's a great one!
    I wonder what I should do If I want to utilize WebRTC on the Server, not LAN. Can you suggest to me where to look?

    • @firedragongamestudio
      @firedragongamestudio  8 месяцев назад

      Depending on the server (LAN or online) you'll have to look intp TURN and/or STUN servers for WebRTC.

  • @ARfun
    @ARfun Год назад

    You guess this would work for the HoLoLens 2 or Quest 3 to get a communication between device and PC as well?

    • @firedragongamestudio
      @firedragongamestudio  Год назад

      It doesn't work for Hololens2 as the Unity package doesn't support Windows UWP (docs.unity3d.com/Packages/com.unity.webrtc@3.0/manual/requirements.html). It does work for Quest3, already uploaded a follow up video, for media streams incl. Quest3. Feel free to check it out :)

  • @AngelCorral-tech
    @AngelCorral-tech 9 месяцев назад

    Thanks for this amazing video. I'm trying to send a mesh over webSockets, if I send a cube, send and receive it works, but if I try to send a mesh (from azure kinect) I've received a message 'InvalidOperationException: DataChannel is not open' . There is a maximum buffer message size ? How I can increase the socket buffer ? Thanks a lot !! great job.

    • @firedragongamestudio
      @firedragongamestudio  9 месяцев назад

      Is it really the buffer size? If the data channel is closed, there must be a reason why...

  • @adhiksharma4370
    @adhiksharma4370 Год назад +1

    Can we create a video call app using unity-webrtc?

    • @firedragongamestudio
      @firedragongamestudio  Год назад

      Absolutely! I already created and uploaded a video media stream tutorial. I'm planning to release a tutorial with multiple streams too, pls look forward to it :)

    • @adhiksharma4370
      @adhiksharma4370 Год назад

      Awsome tutorial
      Webrtc is not easy to understand but your tutorial made it very easy

  • @i.pelazazi1321
    @i.pelazazi1321 10 месяцев назад

    Hello, thanks for your great tutorial can this work between 2 terminal over the internet ?.

    • @firedragongamestudio
      @firedragongamestudio  10 месяцев назад +1

      Yes, but you'll have to use TURN or STUN servers for this. It's on my list for future tutorials.

    • @i.pelazazi1321
      @i.pelazazi1321 10 месяцев назад

      @@firedragongamestudio i
      will keep whatching ^^

  • @gonzalolo
    @gonzalolo 9 месяцев назад

    hi mate, thanks for the video.
    can i use this approach to connect over the web? with forwarding?

    • @firedragongamestudio
      @firedragongamestudio  9 месяцев назад +1

      Yes, you'll have to look for STUN and TURN servers. The WebRTC docs are pretty good explaining that :)

    • @gonzalolo
      @gonzalolo 9 месяцев назад

      @@firedragongamestudio thanks for the answer mate, but i did not want to depend on a paid service, and rather do port forwarding on the host side, he creates a server and we do the handshake to enable webRTC p2p, webrtc doc is very vague :(

    • @firedragongamestudio
      @firedragongamestudio  9 месяцев назад +1

      @@gonzalolo There are currently several options for TURN servers available online, both as self-hosted applications (like the open-source COTURN project) and as cloud provided services.

    • @gonzalolo
      @gonzalolo 9 месяцев назад

      @@firedragongamestudio really appreciate your time mate :) thanks

  • @정주호-f5x
    @정주호-f5x 4 месяца назад

    Hello,
    Thank you for the video!
    I followed along and built and ran the application on Android.
    However, whenever I toggle "Send Message Via Channel" in the editor, I receive the message: 'InvalidOperationException: DataChannel is not open - Unity.WebRTC.RTCDataChannel.Send.'
    Additionally, the messages that appear in the editor do not show up on Android. I'm not sure why this is happening.

    • @firedragongamestudio
      @firedragongamestudio  4 месяца назад

      Are your devices in the same network/wifi? Have you changed the ip address of your websocket server to your local ip addess?

    • @firedragongamestudio
      @firedragongamestudio  4 месяца назад

      And try to turn of your firewall, maybe that's interfering too.

    • @정주호-f5x
      @정주호-f5x 4 месяца назад

      My laptop and Android phone are connected to the same Wi-Fi network, and the WebSocket server's IP has been changed to my local IP address.
      I have also disabled the firewall on my laptop.
      However, I am still encountering the same error

  • @mustafamagdy6658
    @mustafamagdy6658 11 месяцев назад

    Can i send and receive data between two android devices connected to the same local network ?

    • @firedragongamestudio
      @firedragongamestudio  11 месяцев назад

      Yes, if the websocket server itself runs on a PC in the same LAN. You can't start a websocket server on an Android device, afaik.

  • @fuatyyy
    @fuatyyy 4 месяца назад +4

    Please stop randomly pasting in code snippets. Its really annoying and makes it hard to follow along

    • @Dylan_Rider
      @Dylan_Rider Месяц назад

      lol, learn it yourself? i did just fine. why should he have to handwrite all of the code a second time just for your convenience?