0

I am using VideoView to download and play video in my app. Server is communicating via tls 1.2 protocol and it is by default disabled on Android 4.4.2(KitKat) device. Since I am not using any special http client to download stream but android's VideoView component, I could not find a way to set ssl socket factory of the VideoView. Is there anyway to enable Tls 1.2 for VideoView http connection?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

please check below link:

Making SSLEngine use TLSv1.2 on Android (4.4.2)?.

I have faced this issue for Image, Hope this solution help you in video view also.

try {
            ProviderInstaller.installIfNeeded(getApplicationContext());
            SSLContext sslContext = null;
            sslContext = SSLContext.getInstance("TLSv1.2");
            try {
                sslContext.init(null, null, null);
                SSLEngine engine = sslContext.createSSLEngine();
                engine.getEnabledCipherSuites();
            } catch (KeyManagementException e) {
                e.printStackTrace();
            }
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (GooglePlayServicesNotAvailableException e) {
            e.printStackTrace();
        } catch (GooglePlayServicesRepairableException e) {
            e.printStackTrace();
        }   
  • VideoView just accepts a uri with videoView.setVideoURI() method and automatically downloads video. I am not sure if and how i can use this solution. – Serdar Samancıoğlu May 03 '18 at 10:54
  • You can add in any of the your class just make sure before using video view. We have added this code in application class. –  May 03 '18 at 11:11
  • Tried it but didn't work. Are you sure SSLEngine object is not passed to any method as parameter later in your code? – Serdar Samancıoğlu May 03 '18 at 12:00
  • No, There is no such things to use it latter. –  May 03 '18 at 12:21
  • Ok, apparently the solution works, at least to download images. But I can't still download and play mp4 video on videoview, so I think the problem isn't related to tls version but videoview itself. – Serdar Samancıoğlu May 04 '18 at 13:15