想要从 android 中的 asset 文件夹中播放 mp4 视频

发布于 2024-09-15 17:43:12 字数 78 浏览 3 评论 0原文

我想播放我的 asset/raw 文件夹中的 mp4 视频。 我成功地从 SD 卡播放 mp4 视频,但无法从资产文件夹或原始文件夹获取视频。

I want to play mp4 video which is available in my assets/raw folder.
I am successfully playing mp4 video from my sd card but not able to get video from assets folder or from raw folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

-残月青衣踏尘吟 2024-09-22 17:43:26

正如我所说的这里,您的问题可能来自于数据压缩后的大小:

大家好,如果我没记错的话,我有
加载时出现同样的问题
资产文件夹中的内容,但带有
数据库。看来里面的东西
您的资产文件夹可以有 2 个统计数据:
压缩与否。如果是的话
压缩,那么你就被允许 1 Mo
内存来解压缩它,否则
你会得到这种异常。
多个错误报告
关于这一点,因为文档
尚不清楚。所以如果你还想
要使用您的格式,您必须
使用未压缩的版本,或者给出
.mp3 或 .png 等扩展名
文件。我知道这有点疯狂但我
加载扩展名为 .mp3 的数据库
它工作得很好。这
另一种解决方案是打包你的
具有特殊选项的应用程序
告诉它不要压缩某些
扩大。但接下来你需要构建
手动添加您的应用程序并添加“zip -0”
选项。的优点是
未压缩资产是该阶段
发布之前的 zip-align
应用程序将对齐数据
正确以便加载时
内存可以直接映射。

所以,解决方案:

  • 将文件扩展名更改为 .mp3 或 .png 并查看是否有效
  • 手动构建您的应用并使用 zip-0 选项

As I said here, your issue might come from the size of the data if it is compressed :

Hi guys, If I remember well, I had
the same kind of issue when loading
stuff from the asset folder but with a
database. It seems that the stuff in
your asset folder can have 2 stats :
compressed or not. If it is
compressed, then you are allowed 1 Mo
of memory to uncompress it, otherwise
you will get this kind of exception.
There are several bug reports
about that because the documentation
is not clear. So if you still want to
to use your format, you have to either
use an uncompressed version, or give
an extension like .mp3 or .png to your
file. I know it's a bit crazy but I
load a database with a .mp3 extension
and it works perfectly fine. This
other solution is to package your
application with a special option to
tell it not to compress certain
extension. But then you need to build
your app manually and add "zip -0"
option. The advantage of an
uncompressed assest is that the phase
of zip-align before publication of an
application will align the data
correctly so that when loaded in
memory it can be directly mapped.

So, solutions :

  • change the extension of the file to .mp3 or .png and see if it works
  • build your app manually and use the zip-0 option
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文