I\'ve been really banging my head against the table trying to get the MediaPlayer class to try to play h.264-encoded videos on Android 2.1. My code is rather simple:
<
If you are dealing with remote URL, use below code to get encoded url compatible with MediaPlayer.
public String getEncodedURL(String urlStr) throws Exception
{
URL url = new URL(urlStr);
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
urlStr = uri.toASCIIString();
return urlStr;
}