zoukankan      html  css  js  c++  java
  • Atitit.android播放smb 网络邻居视频文件解决方案

    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.jarSMB库(SMB相关功能已基本实现),可能还用到apacheHTTP服务器相关内容

    作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

    转载请注明来源: http://www.cnblogs.com/attilax/

     

    2. 解决方案::smb2http stream convert

    Buildg个嵌入式web服务器..+smbFileok..

     

     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

     

     

  • 相关阅读:
    STL源码剖析之_allocate函数
    PAT 1018. Public Bike Management
    PAT 1016. Phone Bills
    PAT 1012. The Best Rank
    PAT 1014. Waiting in Line
    PAT 1026. Table Tennis
    PAT 1017. Queueing at Bank
    STL源码剖析之list的sort函数实现
    吃到鸡蛋好吃,看看是哪只母鸡下的蛋:好用的Sqlite3
    cJSON
  • 原文地址:https://www.cnblogs.com/attilax/p/5316546.html
Copyright © 2011-2022 走看看