Unity-Technologies / Unity-Technologies/com.unity.webrtc

[BUG]: Client side is not receiving Video Frames

Open
#1,072 4 comments 0 reactions 1 assignee View on GitHub

@karasusan is already working on this.

Since Dec 10, 2024.

bug
Dominant language
Assembly
Stars
852
Forks
238
PR merge metrics
No merged PRs in 30d

Description

Package version

3.0.0-pre.7

Environment
* OS:Windows 11
* Unity version: 2023.2
Steps To Reproduce

I have both server and client running in unity.
The server creates a Video Stream like this:

    _peerConnection = new RTCPeerConnection(ref config);
    _peerConnection.OnIceCandidate += OnIceCandidate;
    _peerConnection.OnIceConnectionChange += OnIceConnectionChange;
    _peerConnection.OnConnectionStateChange += OnConnectionStateChange;

    _localVideoTrack = _mainCamera.CaptureStreamTrack(1280,720);
    var sendStream = new MediaStream();
    _peerConnection.AddTrack(_localVideoTrack, sendStream);

The client tries to read the video stream. But only the ontrack is called only once.
var config = GetRTCConfiguration();
_peerConnection = new RTCPeerConnection(ref config);
_peerConnection.OnIceCandidate += OnIceCandidate;
_peerConnection.OnConnectionStateChange += OnConnectionStateChange;
//_peerConnection.OnTrack += OnTrack;

    _peerConnection.OnTrack = e =>
    {
        if (e.Track is VideoStreamTrack track)
        {
            track.OnVideoReceived += tex =>
            {
                Debug.Log("Video Received");
                _receiveImage.texture = tex;
            };
        }
    };

"Video Received" Log is printed just once. I was expecting it to print every frame. Can someone direct me the problem?

Current Behavior

No response

Expected Behavior

No response

Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.