Android Playing Movie Files In A Live Wallpaper Android Playing Movie Files In A Live Wallpaper android android

Android Playing Movie Files In A Live Wallpaper


You can use the following code

VideoView videoView;    VideoView = (VideoView) findViewById (R.id.txt1);    videoView.setVideoPath(path);    videoView.setVisibility(VideoView.VISIBLE);videoView.start();

i have tried to play mp4 on my emulator but it was not showing video but when i tried on device it work fine.


Haven't tried that before but I think you can use vlcj framework that's totally free and can play effectively almost any type of video (and of course plays .mp4 video files) .I can't give you any code in android because have never worked with android but I know java and and it just works.So here what i use in Java:

NativeLibrary.addSearchPath("libvlc",path); //To set path of libvlcNative.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);//To import libvlc//The path can be a folder in your android project.All the files needed are in vlc player installation folder.so yes you have to install vlc in your computer to get those files but just once.canvas = new WindowsCanvas();panel.add(canvas);//panel is like your VideoViewcanvas.setVisible(true);canvas.setBackground(Color.black);mediaPlayerFactory = new MediaPlayerFactory();player12 = mediaPlayerFactory.newEmbeddedMediaPlayer();CanvasVideoSurface videoSurface = mediaPlayerFactory.newVideoSurface(canvas);player12.setVideoSurface(videoSurface);player12.setPlaySubItems(true);player12.startMedia(yourVideoPath); player12.setAspectRatio(""+panel.getWidth()+":"+panel.getHeight()); //Those two lines are for your video to be adusted in your panel or better to your VideoViewplayer12.setCropGeometry(""+panel.getWidth()+":"+panel.getHeight()); 

The jar files you have to include in your classpath are jna-3.4.0.jar,platform-3.4.0.jar,vlcj-2.1.0.jar