docs.unity3d.com
    Show / Hide Table of Contents

    Bidirectional Sample

    This is a sample of bi-directional(send/receive) each other's video.

    It works with Unity-Unity or Unity-Browser combination.

    Note

    If no codec is available on both sender and receiver, the video can not stream. Please note that the compatibility of codecs is different corresponding to platforms and graphics API.

    Usage

    Hardware acceleration

    Recommend enabling Hardware Encoder support on the Render Streaming inspector to improve performance using hardware acceleration.

    Procedure (Unity-Unity)

    1) Launch the signaling server using private mode. Please refer to this link for launching.

    Note

    This sample does not work on signaling server in public mode.

    Launch web server

    2) Open Bidirectional scene and specify IP address of the signaling server to the Signaling URL parameter on the inspector.

    3) If you need, change the Device Index parameter on WebCamStreamer component.

    Change Device Index

    4) Build and run application. After running application click SetUp button. (ConnectionID is autofill.)

    Bidirectional Sample Setup

    Note

    When building application for iOS platform, you need set Camera Usage Description on Player Settings. If not set this, your application exits. (refer this page)

    Set Camera Usage Description

    5) Enter same ConnectionID on the application in Unity Editor.

    Enter Same ID

    6) Press the SetUp button in Unity Editor.

    7) You can see streaming video each other's. (Of course, it also works with Unity applications.)

    Bidirectional Streaming

    Procedure (Unity-Browser)

    1.~3. steps same as Unity-Unity Procedure.

    4) Open your web browser and access http://localhost. You can see the top page. Click a Bidirectional Sample link.

    Browser Bidirectional Sample Link

    5) Enter same ConnectionID on the Unity Application to Browser text area.

    Enter Same ID on browser

    6) Click StartVideo button, after that click SetUp button in Browser.

    Click StartVideo Button

    7) You can see streaming video each other's.

    Bidirectional Streaming with browser

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023