Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

video url Http error 405 can't download

Writer Emily Wong

I have an online video url, I can use vitamio video player play it online, but once I use android HttpUrlConnection download, I failed and received http 405 error.Can anyone give me some help?

 HttpURLConnection conn = null; int totalSize = 0; conn = (HttpURLConnection) new URL(url).openConnection(); conn.setConnectTimeout(10 * 1000); conn.setRequestMethod("GET"); conn.connect(); totalSize = conn.getContentLength(); [1]:

the url is [the url of a video][1] I put the url on , it displayed right length which is 71917427.

1 Answer

This problem was finally solved by add userAgent:

conn.setRequestProperty("User-agent", "");

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy