在android搭了http服务器,可以访问手机文件了之后 http服务器android浏览器 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以查查,浏览器播放mp4,估计得html5或者使用第三方控件 HTTP协议网络传输都是以流的形式进行传输的,.MP4也是文件,首先你得把文件流缓存到本地,再进行播放。至于,怎么样通过HTTP协议,可以试试这个/**http下载*/ public static boolean httpDownload(String httpUrl,String saveFile){ // 下载网络文件 int bytesum = 0; int byteread = 0; URL url = null; try { url = new URL(httpUrl); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); return false; } try { URLConnection conn = url.openConnection(); InputStream inStream = conn.getInputStream(); FileOutputStream fs = new FileOutputStream(saveFile); byte[] buffer = new byte[1204]; while ((byteread = inStream.read(buffer)) != -1) { bytesum += byteread; System.out.println(bytesum); fs.write(buffer, 0, byteread); } return true; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } } android中的 单选列表对话框和多选列表对话框 一直出不来 拍照 测距 android程序在什么时候停止工作线程 ListView 怎么加列边框? 请教几个有关ListView的问题? 【bugreport】android底下都有哪些bugreport开源项目啊 android新手求入职场的android大牛手机适配问题 菜鸟问一个putExtra的问题 volley使用错误 android怎么隐藏正在运行的程序在设置中也找不到 FragmentManager在Activity重建后,add的fragment消失,救命 android中startManagingCursor过期问题
你可以查查,浏览器播放mp4,估计得html5或者使用第三方控件
public static boolean httpDownload(String httpUrl,String saveFile){
// 下载网络文件
int bytesum = 0;
int byteread = 0;
URL url = null;
try {
url = new URL(httpUrl);
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return false;
}
try {
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(saveFile);
byte[] buffer = new byte[1204];
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread;
System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
return true;
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}