• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

set video wallpaper in android

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Friends

how to set video wallpaper in android?

this is my code, but not properly working


class MovieLiveWallpeperEngine extends Engine {

private MediaPlayer mp;

@Override
public void onCreate(SurfaceHolder holder) {
super.onCreate(holder);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mp = new MediaPlayer();
mp.setDisplay(new MySurfaceHolder(holder));
mp.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {

mp.start();
}
});
try {

String path = "/sdcard/toycom13.mpg";

mp.setDataSource(path);
} catch (Exception e) {
Log.e(TAG, "error");
}
mp.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.stop();
}
});
}

@Override
public void onDestroy() {
super.onDestroy();
if (mp != null) {
mp.stop();
mp.release();
}
}

@Override
public void onVisibilityChanged(boolean visible) {
super.onVisibilityChanged(visible);
if (visible) {
play();
}
}

private void play() {
if (mp.isPlaying()) {
mp.stop();
}
try {
mp.prepareAsync();
} catch (IllegalArgumentException e) {
Log.e(TAG, "error");
} catch (SecurityException e) {
Log.e(TAG, "error");
} catch (IllegalStateException e) {
Log.e(TAG, "error");
}
}
}
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please edit your post to UseCodeTags. It's unnecessarily hard to read the code as it is, making it less likely that people will bother to do so.

Also note that saying "it doesn't work" isn't likely to get you help: ItDoesntWorkIsUseless
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hey. I have a similar coding and only the sound is displayed...did it happened to you, could you solve it?...Im using a Raw File..any help would be great..
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic