Hi everyone I\'m a bit new to android I have developed an app which is streaming the audio from server everything was going fine until my app crashed, I debugged it and found ou
Android media player doesn't support HTTPS. If you provide a HTTPS URL, then the file will be downloaded.
This "HTTPS" not supported fact is provided in android documentation.
Just add below code before calling mediaplayer
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(null, null);
MySSLSocketFactory sf = new MySSLSocketFactory(trustStore);
sf.setHostnameVerifier(MySSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
sf.fixHttpsURLConnection();
HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
MySSLSocketFactory: https://github.com/joniks/Android-Async-HTTP/blob/master/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java