1

I'm curious if someone can point me to (or just describe) how, given that an Android application has an extremely limited memory space to play with (I think it's around 20 megs), a video player can load and play videos that are an order of magnitude or more larger in size. Is the app loading the video in some sort of chunks?

I ask because I have an app that has some video assets embedded and the app has grown to be about 80 megs and is just a total monster for compiling and debugging (without the assets the app would only be about 2 megs), and I was thinking that I should just remove the assets and have them download on the side and sit on the sdcard, rather than within the apk, but I'm worried that loading them and playing them at run time will bust through the app's memory allotment, and was hoping someone can shed some light on what my options are.

TIA

4

3 回答 3

1

他们以可管理的块缓冲视频,是的。即使您的视频大小为 GB,您也不会使用标准视频播放 API 撞到内存墙。您可以使用标准调用setVideoURIsetVideoPath指向文件,它将从那里处理它。如果MediaPlayer您不使用VideoView

不过,在 apk 之外下载视频仍然是个好主意。如果我必须为每次增量升级下载一个新的 80MB 文件,我可能会直接卸载。如果您不想自己托管它们,请查看补充 apk 选项。

于 2012-10-19T21:10:17.007 回答
1

您可以将游戏带入可以绕过此限制的本机层。看看我写的博客http://jnispot.blogspot.com/2012/10/jnindk-arrays-bitmaps-and-games-oh-my.html

于 2012-10-19T20:25:33.317 回答
0

我不知道这是否是视频应用程序所做的,但您实际上可以通过在本机代码中使用 malloc 语句将内存增加到超出正常限制。这绕过了大约 20 MB 的正常最大值。

我只将它用于在处理大型加密文件(甚至大约 10MB 文件)时 AES 加密需要相当多内存的 android 设备上进行加密。

于 2012-10-19T20:23:00.443 回答