从 https 链接传输音频时出现问题
大家好,我对 Android 有点陌生,我开发了一个应用程序,它从服务器流式传输音频,一切都很顺利,直到我的应用程序崩溃,我对其进行了调试,发现 Android 媒体播放器在通过 HTTPS 链接流式传输时抛出异常。我有大约 20 个将音频流式传输到我的应用程序的链接,其中大约一半是 HTTPS 链接,但它们没有播放。如果有人理解它,请回答我需要帮助,如果你能给我任何一段对我来说更容易理解的代码。提前致谢
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 out the android media player is throwing exception while streaming through HTTPS link. I have almost about 20 links from where I'm streaming audio to my app and about half are HTTPS links and they are not playing. If anyone understand it please answer I need help, if you can give me any piece of code that would be much easier for me to understand.Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Android 媒体播放器不支持 HTTPS。如果您提供 HTTPS URL,则会下载该文件。
Android 文档中提供了“HTTPS”不受支持的事实。
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.
只需在调用 mediaplayer MySSLSocketFactory 之前添加以下代码
: https://github.com/joniks/Android-Async-HTTP/blob/master/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java
Just add below code before calling mediaplayer
MySSLSocketFactory: https://github.com/joniks/Android-Async-HTTP/blob/master/library/src/main/java/com/loopj/android/http/MySSLSocketFactory.java