动态壁纸中的视频视图?
根据其他问题android-video-as-a-live-wallpaper,在动态壁纸中播放视频的唯一方法是自己解码吗?
As per other questions android-video-as-a-live-wallpaper, is the only way to play a video in a live wallpaper is to decode it yourself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需使用 MediaPlayer 而不是 VideoView,并使用 MediaPlayer.setSurface 而不是 MediaPlayer.setDisplay。如果您使用 setDisplay,MediaPlayer 会尝试告诉 SurfaceHolder 保留不允许使用 LiveWallpapers 的屏幕,并会引发错误。
我使用 WebM/vpx8 视频,但这应该适用于 MediaPlayer 支持的任何内容(只需将视频文件放入 res/raw 中)
Just use MediaPlayer instead of VideoView and use MediaPlayer.setSurface instead of MediaPlayer.setDisplay. If you use setDisplay the MediaPlayer trys to tell the SurfaceHolder to keep the screen on which isn't allowed for LiveWallpapers and will throw an error.
I use WebM/vpx8 video but this should work with whatever MediaPlayer supports (just put the video file in res/raw)
简短的回答是肯定的。长答案是 http://ikaruga2.wordpress.com /2011/06/15/video-live-wallpaper-part-1/
Short answer is yes. Long answer is http://ikaruga2.wordpress.com/2011/06/15/video-live-wallpaper-part-1/
跳出框框思考,是否有可能在 Android 中的 java 窗口下获取一个可以工作的视频播放器并重新设置它的父级?我还没有在 Linux 或 Android 中这样做,但在 Windows 下,可以获取正在运行的应用程序的窗口句柄,并将其作为 Java 框架的子级,结果是其他应用程序的窗口看起来像是 Java 的一部分应用。
Just to think outside the box, is it possible to take a working video player and re-parent it under a java window in Android? I have not done this in Linux or Android, but under Windows it is possible to get the window handle of a running application and make it a child of a Java frame, with the result that the other application's window looks like its part of your Java application.
我尝试过 Justin Buser 解决方案,但它不起作用(在 API 16 设备上测试),还在 https://github.com/thorikawa/AndroidExample/tree/master/MovieLiveWallpaper/;它也不起作用。
唯一的解决方案似乎是将 FFMPEG 与 NDK 结合使用。例如: https://github.com/frankandrobot
I have tried the Justin Buser solution and it does not work (tested on a API 16 device), have also found a similar code on https://github.com/thorikawa/AndroidExample/tree/master/MovieLiveWallpaper/; it does not work either.
The only solution seems to be to use FFMPEG with NDK. eg : https://github.com/frankandrobot