无法将本机 Android 设备连接到 kurento 媒体服务器

Not able connect Native Android device to kurento Media server

我已经开始使用 kurento 媒体服务器开发直播。我在 Ubuntu 14.04TLS 中安装了 kurento 媒体服务器。它已成功安装并成功启动。 我用过 STUN 服务器,我取消了这两行的注释

 stunServerAddress=<stun_ip_address>
 stunServerPort=<stun_port>

并使用IP、PORT如下:173.194.66.127:19302 .完成所有这些事情后,我启动了 kurento 媒体服务器,它开始了。 现在,我通过实现 RoomListener 接口创建 Android 本机应用程序。 这是连接 Kurento 媒体服务器的代码。

public class MainActivity extends AppCompatActivity implements RoomListener {
        private LooperExecutor executor;
        private static KurentoRoomAPI kurentoRoomAPI;
        private String TAG = "MainActivity";
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            executor = new LooperExecutor();
            executor.requestStart();
            String wsRoomUri = "wss://173.194.66.127:19302/room";
            kurentoRoomAPI = new KurentoRoomAPI(executor, wsRoomUri, this);
            kurentoRoomAPI.connectWebSocket();
        }
        @Override
        public void onRoomResponse(RoomResponse response) {
            Log.d(TAG, "Response");
        }
        @Override
        public void onRoomError(RoomError error) {
            Log.d(TAG, "Error:  " + error.toString());
        }
        @Override
        public void onRoomNotification(RoomNotification notification) {
            Log.d(TAG, "Notification Received");
        }
        @Override
        public void onRoomConnected() {
            Log.d(TAG, "Connected");
        }
        @Override
        public void onRoomDisconnected() {
            Log.d(TAG, "Room Disconnected");
        }

    }

但是当我运行应用程序时,它显示以下错误:

Process: com.base.videostreamingkurento, PID: 1880


java.lang.AssertionError: java.net.SocketTimeoutException: failed to connect to /173.194.66.127 (port 19302) after 90000ms
                                                                          at libcore.io.IoBridge.connect(IoBridge.java:117)
                                                                          at java.nio.SocketChannelImpl.connect(SocketChannelImpl.java:199)
                                                                          at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:210)
                                                                          at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:188)
                                                                          at java.lang.Thread.run(Thread.java:818)
                                                                       Caused by: java.net.SocketTimeoutException: failed to connect to /173.194.66.127 (port 19302) after 90000ms
                                                                          at libcore.io.IoBridge.connectErrno(IoBridge.java:189)
                                                                          at libcore.io.IoBridge.connect(IoBridge.java:127)
                                                                          at libcore.io.IoBridge.connect(IoBridge.java:115)

看来您对您的部署和 IP 有点困惑。您正在尝试从您的客户端连接到 STUN 服务器。相反,请尝试在这一行中设置您的应用服务器所在的 IP 和端口

String wsRoomUri = "wss://APP_SERVER_IP:8443/room";

如果你能把它画下来,你会更清楚地看到一切的去向以及应该连接到什么。