WebRTC + Android +远程视频未显示

时间:2019-11-08 11:06:12

标签: java android webrtc-android

请查看以下代码,并让我知道显示远程视频时需要更改的内容。音频播放正常。正在工作的最新Webrtc库。在onAddStream方法中,我的Videotrack大小为1,但在remoteVideoTrack addSink方法中未呈现。

 private PeerConnection createPeerConnection(PeerConnectionFactory peerConnectionFactory, boolean isLocal) {
    //
    PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(getServerList());
    //
    PeerConnection.Observer pcObserver = new CustomPeerConnectionObserver("localPeerCreation") {
        @Override
        public void onIceCandidate(IceCandidate iceCandidate) {
            super.onIceCandidate(iceCandidate);
            //SignallingClient.getInstance().sendICECandidate(iceCandidate);
            if (iceCandidate.serverUrl.length() > 1)
                SignallingClient.getInstance().sendICECandidate(iceCandidate);
        }

        @Override
        public void onAddStream(MediaStream mediaStream) {
            super.onAddStream(mediaStream);
            Log.e("mytagVFrame", "Video Frame is OUt == " + mediaStream.videoTracks.size());
            VideoTrack remoteVideoTrack = mediaStream.videoTracks.get(0);
            remoteVideoTrack.setEnabled(true);
            ProxyVideoSink videoSink = new ProxyVideoSink();
            videoSink.setTarget(mRemoteSurfaceViewRenderer);
            remoteVideoTrack.addSink(videoSink);
        }
    };
    return peerConnectionFactory.createPeerConnection(rtcConfig, pcObserver);
    //
}

1 个答案:

答案 0 :(得分:0)

我有同样的问题。我发现我在两个不同的地方打电话给EglBase.create();