Atitit.android播放smb 近端分享視頻檔案解決方案,atitit.androidsmb
Atitit.android播放smb 近端分享視頻檔案解決方案
Android4.4
1.1. Android4視頻播放器不能直接地支援smb協議..子好先轉換成個http流
1.2. ES檔案瀏覽器播放區域網路視頻的方式也是smb2http
據分析播放器的播放記錄分析,ES檔案瀏覽器播放區域網路視頻時 將區域網路中 /192.168.1.168/SharedDocs/huantaihu.mp4視頻檔案的地址轉換為標準HTTP資料流格式 "http://127.0.0.1:59767/smb/192.168.1.168/SharedDocs/huantaihu.mp4";;
然後就可以通過intent直接調用本地播放器程式來播放了
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
strSMBURLPath="http://127.0.0.1:59767/smb/192.168.1.168/SharedDocs/huantaihu.mp4";;
intent.setDataAndType(Uri.parse(strSMBURLPath), "video/*");
startActivity(intent);
據反編譯ES檔案管理工具源碼,除了用到jcifs.jar的SMB庫(SMB相關功能已基本實現),可能還用到apache的HTTP伺服器相關內容
作者:: 綽號:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿爾 拉帕努伊 ) 漢字名:艾龍, EMAIL:1466519819@qq.com
轉載請註明來源: http://www.cnblogs.com/attilax/
2. 解決方案::smb2http stream convert
Buildg個嵌入式web伺服器..+smbFile走ok蘭..
package com.attilax.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class StreamUtil {
byte[] buffer = new byte[524288];
public void convertStream(InputStream in, OutputStream out) {
// InputStream in = new FileInputStream(srcFile);
// out = new FileOutputStream(destFile);
int byteread;
byteread = read(in);
while (byteread != -1) {
if (byteread != 0) {
try {
out.write(buffer, 0, byteread);
System.out.println("---out.write.."+byteread);
//out.flush();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
byteread = read(in);
}
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private int read(InputStream in ) {
int byteread;
try {
byteread = in.read(buffer,0,524288);
} catch (Exception e) {
e.printStackTrace();
byteread = 0;
}
return byteread;
}
}
3. 瑞福
android通過SMB訪問區域網路PC中的共用視頻檔案,如何在android上搭建個媒體伺服器 以便通過HTTP形式訪問_百度知道.html