Android的 - 视频流媒体在当地的HTTPS服务器:SSL证书被拒绝流媒体、被拒、证书、服务器

2023-09-06 03:32:12 作者:知心文字控 ン

我需要的视频流通过本地HTTPS服务器(当然做一些背景DRM)的Andr​​oid系统。在Android媒体播放器然后连接到本地服务器,流式的视频内容到屏幕上。

I need to stream video over a local HTTPS server (of course to do some background DRM) in Android. The Android media player is then connecting to the local server, 'streaming' the video content to the screen.

这一切工作正常使用的HTTP服务器,但只要我启用SSL,视频播放器停止。

It all works fine with a HTTP server but as soon as I enable SSL, the video player stops.

如果我连接到HTTPS服务器从外面我的应用程序使用的浏览器,我得到的,我可以忽略,然后视频播放器开始一个SSL警告。

If i connect to the HTTPS server from outside my app using a browser, I get an SSL warning which i can ignore and then the video player starts.

有没有一种方法来禁用严格的证书处理的媒体播放器模块?我已经看到了很多关于如何用我自己的HTTP连接,要做到这一点的职位,但没有就如何做到这一点的媒体播放器。

Is there a way to disable the strict certificate handling for the media player module? I have seen a lot of posts on how to do this using my own HTTP connection, but nothing on how to do this for the media player.

谢谢!

更新:谷歌的内联网证书或即时证书,你会发现东西是这样运作的。会尝试一下明天在这里发表了答案。

UPDATE: Google for 'intranet certificate' or 'instant certificate' and you will find something that's supposed to work. Will try it out tomorrow and post the answer here.

推荐答案

您应该试试这个肯定的,

You Should Try this for Sure,

    // Create a trust manager that does not validate certificate chains
    TrustManager[] trustAllCerts = new TrustManager[]{
        new X509TrustManager() {
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return null;
            }
            public void checkClientTrusted(
                java.security.cert.X509Certificate[] certs, String authType) {
            }
            public void checkServerTrusted(
                java.security.cert.X509Certificate[] certs, String authType) {
            }
        }
    };

    // Install the all-trusting trust manager
    // Try "SSL" or Replace with "TLS"
    try {
        SSLContext sc = SSLContext.getInstance("SSL");
        sc.init(null, trustAllCerts, new java.security.SecureRandom());
        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
    } catch (Exception e) {
    }

    // Now you can access an https URL without having the certificate in the truststore 
           // Your Code Goes Here

以下是本 的证书验证的HTTPS连接 安卓信任的SSL证书的 http://stackoverflow.com/a/6378872/1008278

Here are More Solutions for ThisCertificate Validation in an HTTPS Connection Android: Trusting SSL certificates http://stackoverflow.com/a/6378872/1008278