Android : Proxy settings for MediaPlayer class
I'm developing an android application. In this application, I have to play video from HTTP server. I am trying to use Media开发者_JS百科Player class for playing this HTTP video steam. I am receiving "Unable play the video" error.
My WI-FI connection requires a proxy for internet access. how to specify these proxy settings.
You can try:
Properties systemSettings=System.getProperties();
systemSettings.put("http.proxyHost", "your.proxy.host.here");
systemSettings.put("http.proxyPort", "8080"); // use actual proxy port
However, bear in mind that "Unable play the video" has many potential causes. Use adb logcat
, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the warnings or errors that MediaPlayer
generates, to give you more clues. For example, your video may not be "safe for streaming".
精彩评论