Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

WebRTC to wowza

Discussion in 'Unity Render Streaming' started by fabricio_unity429, Mar 16, 2022.

  1. fabricio_unity429

    fabricio_unity429

    Joined:
    Jan 2, 2022
    Posts:
    1
    Is it possible to stream directly from Unity to a Wowza server using Unity Render Streaming? or do I still need a web server in between?

    When running the Broadcast sample pointing to a wowza signaling url (wss://XXX.streamlock.net:8443/webrtc-session.json) I see the connection is successful but the stream never seems to get to wowza.

    On wowza we have the concept of a "Application Name" and a "stream name", what would be the equivalents in unity render streaming?
     
  2. kannan-xiao4

    kannan-xiao4

    Unity Technologies

    Joined:
    Nov 5, 2020
    Posts:
    76
    Probably because the Signaling protocol is incorrect.
    Package's WebsocketSignaling has only been confirmed to work with our WebApp.
    So, please implement Wowza Signaling class using ISignaling Interface.
     
  3. turntengineering

    turntengineering

    Joined:
    Mar 31, 2022
    Posts:
    1
    Hi @fabricio_unity429 I'm interested in building this signaling protocol. Getting render streaming into Wowza server would open a lot of interesting use cases. Have you tried this yet?
     
  4. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    288
    I wrote a sample to stream from Unity to Wowza using WebRTC.
    (The scene is a "Wowza Streaming Sample" scene)
    Unity_WowzaStreaming_Sample

    Click the "Start Live Stream" button on the Wowza dashboard to start Live Stream before running this sample.

    Note: It doesn't show up in the VIDEO PREVIEW on the Wowza dashboard, but you can see that the STATISTICS value is changing.
    You can check the streaming by accessing the URL of WebRTC Playback Page or Playback URLs and playing.
     
    kazuki_unity729 likes this.
  5. al3xj3ns3n

    al3xj3ns3n

    Joined:
    Sep 10, 2018
    Posts:
    21
    Hey @gtk2k, do you know if its possible to configure that sample to work on Unity 2019.4.21f1? It's working great on 2021.3.6f1 but when trying to port it over the connection attempt starts returning this error:

    Failed to set local offer sdp: Failed to set local video description recv parameters for m-section with mid='0'.


    EDIT: Actually nevermind figured it out. Line 105 needs to be changed to
    WebRTC.Initialize(EncoderType.Software);
     
    Last edited: Jul 15, 2022
  6. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    288
    @al3xj3ns3n
    What version of "WebRTC" Package are you using?
     
  7. al3xj3ns3n

    al3xj3ns3n

    Joined:
    Sep 10, 2018
    Posts:
    21
    @gtk2k We're running 2.4.0-exp.6, and I'm actually running into a new problem now trying to get things implemented in the main application. In the CreateDesc method the yield return op line appears to stall out. I'm seeing the WSOnOpen and StartStreaming debug messages, but it seems like the ICE isn't updating. We've got it connected up to a Spout Receiver to get a webcam feed from OBS, and that part works fine in the example project you provided, but when we try to carry that code over into our own app it stalls for some reason.
     
  8. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Have you solved the issue? I recommend to use the new version.
     
  9. al3xj3ns3n

    al3xj3ns3n

    Joined:
    Sep 10, 2018
    Posts:
    21
    We did manage to figure out what the issue was yes, it was specific to our project, the ctx was being set in another system and we needed to account for that change to get it to connect properly. Currently I'm trying to work out how I would then best receive a webcam signal from the WebRTC wowza server back to the Unity app. Our current receiver runs through VLC and it is managing to receive the feed correctly, but it still has pretty significant latency which we don't see on the WebRTC playback page so I'm assuming there's still some format swapping causing a slowdown.
     
    Last edited: Aug 10, 2022
  10. al3xj3ns3n

    al3xj3ns3n

    Joined:
    Sep 10, 2018
    Posts:
    21
    Are there any examples demonstrating sending a WebRTC signal from Wowza back into Unity? I've created a wowa receiver which is set up similar to the wowza connector with trackers to try and receive the texture, but the Ws_OnMessage doesn't appear to be firing when it tries to connect.
     
  11. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Mm, sorry but we have never tested our product with Wowza.
    Does anyone have the experience about that?
     
  12. al3xj3ns3n

    al3xj3ns3n

    Joined:
    Sep 10, 2018
    Posts:
    21
    Do you know if its possible to set up a wowza receiver to go with this to stream from Wowza back into Unity without running into significant feed delays? I've been trying to get our system to work with it, but I'm still seeing several seconds of delay between the stream sending out and getting sent back.
     
  13. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    I have not tested it with wowza but it seems strange that Unity is running with the significant delays.
    @gtk2k Have you seen the delays with you sample?
     
  14. duckatfake

    duckatfake

    Joined:
    Mar 8, 2018
    Posts:
    3
    Did you try to check the Prioritize latency to create an HLS stream with the lowest latency possible in the Live Stream Setup? Otherwise it might just be the lowest latency you can get from Wowza as there's no "SFU Passthrough" for WebRTC.
     
  15. GyoSeok

    GyoSeok

    Joined:
    Dec 27, 2022
    Posts:
    1
    I tested using Unity_WowzaStreaming_Sample, but the following error message occurs. Help..
    Unity 2021.3.13f1
    WebRTC 3.0.0-pre.3

    ArgumentException: sdp is null or empty
    Unity.WebRTC.RTCPeerConnection.SetRemoteDescription (Unity.WebRTC.RTCSessionDescription& desc) (at Library/PackageCache/com.unity.webrtc@2.4.0-exp.8/Runtime/Scripts/RTCPeerConnection.cs:747)
    WowzaConnector+<SetDesc>d__22.MoveNext () (at Assets/WowzaConnector.cs:201)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <c399efc08928422d8828d74a2b19ffba>:0)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    <>c__DisplayClass18_0:<Ws_OnMessage>b__0(Object) (at Assets/WowzaConnector.cs:166)
    UnityEngine.UnitySynchronizationContext:ExecuteTasks()
     
  16. nguyenhoangvuong3373

    nguyenhoangvuong3373

    Joined:
    Oct 8, 2018
    Posts:
    1
    It seem like the format in the message data that sent to ws/http is not correct.
    The same issue when I try to streaming Unreal game ( streamer ) with Unity WebApp through Pixel Streaming Signaling ( cause I need to use MatchMaker here) , have to make adapter to correct the message sending "connect", "offer" , "answer" , "candidate" ( In Unreal Pixel Streaming, it send "iceCandidate") , still in process .....

    You can format the message received on server, set sdp in message like :
    Code (JavaScript):
    1. {
    2.    type: "offer",
    3.    from: "<connection_id>",
    4.    data: {
    5.      sdp : "u= a= m= ........",
    6.      connectionId: "<connection_id>",
    7.   }
    8. }
     
    Last edited: Aug 4, 2023