Android的视频作为动态壁纸壁纸、动态、视频、Android

2023-09-03 22:03:56 作者:毁我现在′废你将来

我试图把视频作为动态壁纸。 我使用的媒体播放器的。我能得到SurfaceHolder,我可以给持有人的媒体播放器。 但它不是下面的异常工作对我来说,它给我

LogCat中的异常详细信息

  ERROR / AndroidRuntime(302):java.lang.UnsupportedOperationException:壁纸不支持在保持屏幕
 

如果我不给媒体播放器它的工作原理给持有人,但我可以只听到声音。 我看到了一个应用程序VideoLiveWallpaper,它集视频作为动态壁纸,因此它可以是可能的,可能是我失去了一些东西。我粘贴code,有这方面的帮助将AP preciated。

ç段 $ C $

 公共无效surfaceCreated(SurfaceHolder持有者){
  // TODO自动生成方法存根

 holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  熔点= MediaPlayer.create(getApplicationContext(),R.raw.sample);
  mp.setDisplay(保持器);
  mp.start();
 }
 

解决方案

我的猜测是,目前流通中的视频动态壁纸是用完全不同的方法:媒体手动解码,并绘制它逐帧。我不认为这个问题可以使用简单的方法加以解决 - 否则会有更多的人已经做到了

我假设你有这样的参考,但以防万一:的http:// forum.xda-developers.com/showthread.php?t=804720 在明确提及不同的视频格式使我相信开发人员正在做自己的解码... 祝你好运, 乔治

动态壁纸的天花板 神器 Wallpaper Engine 终于上线 Android 版了

i am trying to put video as a live wallpaper. I am using media player for that. i can get SurfaceHolder and i can give that holder to the media player. But its not working for me, its giving me following exception

LogCat Exception Detail

ERROR/AndroidRuntime(302): java.lang.UnsupportedOperationException: Wallpapers do not support keep screen on

if i dont give holder to the media player it works, but i can hear only audio. I saw one application VideoLiveWallpaper , which set video as a live wallpaper, so it can be possible, may be i am missing something . I am pasting the code, any help on this will be appreciated.

Code Snippet

public void surfaceCreated(SurfaceHolder holder) {
  // TODO Auto-generated method stub

 holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  mp=MediaPlayer.create(getApplicationContext(), R.raw.sample);
  mp.setDisplay(holder);
  mp.start();
 }

解决方案

My guess is that the Video Live Wallpaper currently in circulation is using a totally different approach: decoding the media manually and drawing it frame by frame. I do not think this problem can be tackled using your simple method--otherwise more people would have already done it.

I assume you have this reference, but just in case: http://forum.xda-developers.com/showthread.php?t=804720 The explicit mention of differing video formats leads me to believe the developer is doing his own decoding... Good luck, George