如何解决Android 应用录制的视频无法打开任何外部播放器错误是无法播放此链接
我只想使用 Intent 在 MX Player 或其他外部播放器中播放录制的视频。
Intent intent = new Intent(Intent.ACTION_VIEW);
File file = new File(Environment.getExternalStorageDirectory() + "/TPVideos/" + videoRecordingList.get(position).getVideoFile().getName());
Log.e(TAG,"File: "+file.getAbsolutePath());
Uri data = FileProvider.getUriForFile(context,BuildConfig.APPLICATION_ID,file);
intent.setDataAndType(data,"video/mp4");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(intent);
这是我在清单文件中的元数据
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.roshan.telepromptervideoapp"
android:exported="false"
android:grantUriPermissions="true">
<Meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
这是我的 filepaths.xml 文件
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="my_docs" path="." />
<external-path name="external_files" path="TPVideos/" />
hear is my directory from where I get the file.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。