【问题标题】:how to play video downloaded from server in SD-card如何在 SD 卡中播放从服务器下载的视频
【发布时间】:2012-12-16 18:33:51
【问题描述】:

我从服务器下载了一个文件并将其保存在 DOWNLOAD 文件夹中

如何使用代码从 android 的默认播放器播放它?

使用肌动蛋白代码?喜欢这段代码

Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")), "application/vnd.android.package-archive");
            startActivity(intent);

【问题讨论】:

    标签: android video android-intent android-mediaplayer


    【解决方案1】:

    您设置的“类型”错误。 使用以下代码。

    Intent i = new Intent(Intent.ACTION_VIEW);                      
    i.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")),"video/*");
    startActivity(i); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 2016-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多