Atitit.android播放smb 近端分享視頻檔案解決方案,atitit.androidsmb

來源:互聯網
上載者:User

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

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.