devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
265 stars 64 forks source link

Receiving media data from client #122

Closed stserakhau closed 1 year ago

stserakhau commented 1 year ago

Hello guys,

I tried to receive media data from the client, but have failed.

Client side:

this.peerConnection = new RTCPeerConnection(iceConfig);
for (let track of localMediaStream.getTracks()) {
     this.peerConnection.addTrack(track, localMediaStream);
}

Server side:

class RTCClient implements PeerConnectionObserver {
....
    @Override
    public void onAddStream(MediaStream stream) {
        PeerConnectionObserver.super.onAddStream(stream);
    }

    @Override
    public void onAddTrack(RTCRtpReceiver receiver, MediaStream[] mediaStreams) {
        PeerConnectionObserver.super.onAddTrack(receiver, mediaStreams);
    }

    @Override
    public void onRemoveTrack(RTCRtpReceiver receiver) {
        PeerConnectionObserver.super.onRemoveTrack(receiver);
    }

    @Override
    public void onTrack(RTCRtpTransceiver transceiver) {
        PeerConnectionObserver.super.onTrack(transceiver);
    }
....
}

The Communication and streaming between browsers rtc-clients are ok, but the methods listed above on the backend are not executed.

Is this feature supported by the library?

stserakhau commented 1 year ago

related project https://github.com/stserakhau/banalytics-agent/

I want to integrate an agent as a participant in a WebRtc call

devopvoid commented 1 year ago

Sending audio, video and data is supported and is working. I suppose your SDPs are not exchanged in order.

stserakhau commented 1 year ago

Thx, will check in nearest time