跨网络视频聊天不起作用

时间:2018-07-23 16:23:30

标签: android webrtc

我正在使用webrtc android示例在用户之间运行视频聊天。我可以在同一网络中实现此目标,但是当我在其他网络中尝试时,它就会失败。

我正在使用下面的公共STUN / TURN服务器来实现此目的,但仍然没有成功,并且在android logcat中出现了未授权错误。

下面是我正在使用的一段代码:

> read.csv("all_data.csv", header = T)
          X samplename            X.region    feature position coverage reference alternate alt_frequency CDS_position AA_position    AA_change
1         1  Sample2-1 pJW316-17_beforeNGS non-coding       29       29         G         A   0.965779194           NA          NA         <NA>
2         2  Sample2-1 pJW316-17_beforeNGS non-coding       54      299         A         G   0.006437500           NA          NA         <NA>
3         3  Sample2-1 pJW316-17_beforeNGS non-coding       64      349         T         C   0.011101974           NA          NA         <NA>
4         4  Sample2-1 pJW316-17_beforeNGS       nsps       85      644         A         G   0.004437500            9           3 synonymous>K
5         5  Sample2-1 pJW316-17_beforeNGS       nsps       96      808         A         G   0.003437500           20           7          D

并在android logcat中获得以下错误:

public static List<PeerConnection.IceServer> defaultIceServers(){
    List<PeerConnection.IceServer> iceServers = new ArrayList<PeerConnection.IceServer>(25);
    iceServers.add(new PeerConnection.IceServer("stun:stun.l.google.com:19302"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.services.mozilla.com"));
    iceServers.add(new PeerConnection.IceServer("turn:turn.bistri.com:80", "homeo", "homeo"));
    iceServers.add(new PeerConnection.IceServer("turn:turn.anyfirewall.com:443?transport=tcp", "webrtc", "webrtc"));

    // Extra Defaults - 19 STUN servers + 4 initial = 23 severs (+2 padding) = Array cap 25
    iceServers.add(new PeerConnection.IceServer("stun:stun1.l.google.com:19302"));
    iceServers.add(new PeerConnection.IceServer("stun:stun2.l.google.com:19302"));
    iceServers.add(new PeerConnection.IceServer("stun:stun3.l.google.com:19302"));
    iceServers.add(new PeerConnection.IceServer("stun:stun4.l.google.com:19302"));
    iceServers.add(new PeerConnection.IceServer("stun:23.21.150.121"));
    iceServers.add(new PeerConnection.IceServer("stun:stun01.sipphone.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.ekiga.net"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.fwdnet.net"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.ideasip.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.iptel.org"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.rixtelecom.se"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.schlund.de"));
    iceServers.add(new PeerConnection.IceServer("stun:stunserver.org"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.softjoys.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.voiparound.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.voipbuster.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.voipstunt.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.voxgratia.org"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.xten.com"));

    return iceServers;
}

public void onConnectedToRoom(final boolean initiator) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (peerConnectionClient == null) {
                Log.w(TAG, "Room is connected, but EGL context is not ready yet.");
                return;
            }

            Log.i(TAG, "Creating peer connection");
            peerConnectionClient.createPeerConnection(VideoRendererGui.getEGLContext(),
                    localRender, remoteRender, new SignalingParameters(defaultIceServers(), initiator));

            if (initiator) {
                Log.i(TAG, "Creating OFFER...");
                // Create offer. Offer SDP will be sent to answering client in
                // PeerConnectionEvents.onLocalDescription event.
                peerConnectionClient.createOffer();
            }
        }
    });
}

有人可以暗示我在做什么错吗?

0 个答案:

没有答案