【问题标题】:can not run video file in android studio无法在 android studio 中运行视频文件
【发布时间】:2021-12-23 13:49:12
【问题描述】:

this is the screen shot of my project

我的原始目录中的视频文件显示问号。我将我的文件命名为全小写。运行应用程序时无法播放视频。当我点击来自 android studio 的视频时,它会显示 this happens when I click the video from android studio

【问题讨论】:

  • 你能把你videoView的代码也附在MainActivity中吗?

标签: java android android-studio kotlin video


【解决方案1】:

From localpath 下面显示一个视频文件 chk 代码

VideoView mVideoView = (VideoView)findViewById(R.id.videoview);
String uriPath = "android.resource://com.android.AndroidVideoPlayer/"+R.raw.k;
Uri uri = Uri.parse(uriPath);
mVideoView.setVideoURI(uri);
mVideoView.requestFocus();
mVideoView.start(); 

用于从 URL 获取视频使用

https://ia600201.us.archive.org/22/items/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4

Uri vidUri = Uri.parse(vidAddress);

更多信息请查看Example1Example2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-07
    • 2016-09-13
    • 2016-02-26
    • 1970-01-01
    • 2013-02-15
    • 2021-04-22
    相关资源
    最近更新 更多