想在包中打包一个小视频进行部署
有没有什么方法可以以编程方式引用一个非常小的视频文件并将其包含在包中 - 即我不想将其单独放在 SD 卡上。我正在考虑将其放入“原始”包目录中。
例如,MPEG4 在“原始”中称为“视频”
我试图找出 Uri.parse() 的正确格式,但它打败了我。我认为它应该类似于 R.raw (在设置音频媒体播放器时使用 myMediaPlayer = MediaPlayer.create(this, R.raw.audiocameralive1) - 但它似乎不是。
任何建议
奥利弗
Is there any way to reference programmatically a very small video file adn include it in teh package - i.e. I don't want to have it separate on the SD card. I am thinking of putting it in the 'raw' package directory.
E.g. MPEG4 called 'video' in 'raw'
Am trying to work out what the correct format for Uri.parse() but it has beaten me. I thought it should be something like R.raw (as used when setting up a media player for audio myMediaPlayer = MediaPlayer.create(this, R.raw.audiocameralive1) - but it doesn't seem to be.
Any suggestions
Oliver
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我看到有很多观点,所以如果有人正在寻找解决方案,这就是我最终所做的 - 并且似乎工作得很好。可能有更干净的方法来做同样的事情,但是,这对我来说很有意义......
奥利弗
I see there have been a number of views, so in case anyone is looking for a solution, this is what I eventually did - and seems to work fine. There is probably cleaner way of doing the same but, this one makes sense to me ...
Oliver
使用
Activity.getAssets()
获取AssetManager
。使用open
加载文件。Use
Activity.getAssets()
to get anAssetManager
. The load the file withopen
.