Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Wowza live stream into iOS and Android using WebRTC with Game Object Overlay

Discussion in 'Unity Render Streaming' started by BSGDevelopment, Aug 26, 2023.

  1. BSGDevelopment

    BSGDevelopment

    Joined:
    Jul 8, 2022
    Posts:
    8
    Is it possible to use the webRTC package to receive a live stream from Wowza into Unity (iOS/Android apps) and then place game objects on top of the video? I am investigasting using this package as a solution to a problem we currently have.

    I built our game to show a live streamed video and also built other game objects on top of the video (score, menu etc) using a 3D webview. The problem is that in Android it works great. In iOS, you have to run the Webview in Native 2D mode to show video, which brings the webview to the front and then I am not able to layer game objects on top.

    I looked at the sample for sending a stream to Wowza. That looks promising. If anyone has a sample fo receiving a stream from Wowza they can share, that would be extremely helpful and appreciated.

    Thanks!
     
  2. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    275
    Attach this script file to Quad, etc., set sdpURL/applicationName/streamName, start streaming on Wowza, and then run Unity.
    (Dependencies: WebSocket-Sharp, Json.NET[com.unity.nuget.newtonsoft-json])
     

    Attached Files:

    Last edited: Aug 27, 2023
    BSGDevelopment likes this.
  3. BSGDevelopment

    BSGDevelopment

    Joined:
    Jul 8, 2022
    Posts:
    8
    Thank you! After some work, I figured out that I needed to encode the video in VP8 to make it work. And now all is well. Truly appreciate your prompt response.
     
  4. BSGDevelopment

    BSGDevelopment

    Joined:
    Jul 8, 2022
    Posts:
    8
    One thing to note, and I put this here in case others find this and run into the issue. I was getting an error where the websocket would close right away. It was throwing a 1015 code (which is an issue with TLS and certificate signing). I believe our cert through Wowza for wss is likely self signed. So it could not connect to the stream on iOS or Android. However it worked fine on my test app from the PC. The solution is quite simple, although discovering it was not. I added the following line of code before calling ws.Connect():

    Code (CSharp):
    1. ws.SslConfiguration.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12;