Search code examples
androidlive-wallpaper

Android video as a live wallpaper


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();
 }

Solution

  • 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