This blog has been contributed to Forum Nokia Wiki at http://wiki.forum.nokia.com/index.php/How_to_make_Video_splash
In those a few lines you will find a code of how to create easy startup splash screen that can play video files of any format (GIF,AVI,mpg,3gpp,real etc..)
video splash class
<br />package GALAXY.videosplash;<br /><br />import java.io.*;<br /><br />import javax.microedition.lcdui.*;<br />import javax.microedition.media.*;<br />import javax.microedition.media.control.*;<br /><br />public class Splash extends Canvas implements PlayerListener, Runnable {<br /> private Display display;<br /> private Displayable next;<br /> private String MIMEtype;<br /> private Player player;<br /> private String file;<br /><br /> public Splash(Display display, Displayable next, String file,<br /> String MIMEtype) {<br /><br /> this.display = display;<br /> this.next = next;<br /> this.file = file;<br /> this.MIMEtype = MIMEtype;<br /> Thread th = new Thread(this);<br /> th.start();<br /><br /> }<br /><br /> protected void keyPressed(int keyCode) {<br /> stopPlayer();<br /> nextScreen();<br /> }<br /><br /> protected void paint(Graphics g) {<br /> int x = g.getClipX();<br /> int y = g.getClipY();<br /><br /> int w = g.getClipWidth();<br /> int h = g.getClipHeight();<br /><br /> g.setColor(0x0000000);<br /> g.fillRect(x, y, w, h);<br /><br /><br /> }<br /><br /> protected void pointerPressed(int x, int y) {<br /> stopPlayer();<br /> nextScreen();<br /> }<br /><br /> protected void showNotify() {<br /><br /> }<br /><br /> private void nextScreen() {<br /><br /> this.display.setCurrent(next);<br /> }<br /><br /> public void run() {<br /> try {<br /> resetplayer();<br /> } catch (MediaException ex) {<br /> nextScreen();<br /> }<br /> this.play(file);<br /><br /> }<br /><br /> public void playerUpdate(Player player, String playerstate, Object object) {<br /> if (playerstate == PlayerListener.END_OF_MEDIA) {<br /> try {<br /> resetplayer();<br /> } catch (MediaException me) {<br /><br /> }<br /> player = null;<br /> nextScreen();<br /> }<br /><br /> }<br /><br /> private void resetplayer() throws MediaException {<br /> if (player != null) {<br /> if (player.getState() == Player.STARTED) {<br /> player.stop();<br /> }<br /> if (player.getState() == Player.PREFETCHED) {<br /> player.deallocate();<br /> }<br /> if (player.getState() == Player.REALIZED ||<br /> player.getState() == Player.UNREALIZED) {<br /> player.close();<br /> }<br /> }<br /> player = null;<br /> }<br /><br /> private void play(String url) {<br /> try {<br /> InputStream is = getClass().getResourceAsStream(url);<br /> VideoControl vc;<br /> resetplayer();<br />
second ,this is example of launch it form midelt,note that all I have to do i just create & initiate new instance of videosplash class
video splash class
<br />package GALAXY.videosplash;<br /><br />import javax.microedition.midlet.*;<br />import javax.microedition.lcdui.*;<br /><br />public class SplashMIDlet extends MIDlet {<br /> static SplashMIDlet instance;<br /><br /> public SplashMIDlet() {<br /> instance = this;<br /> }<br /><br /> public void startApp() {<br /> Display dispaly = Display.getDisplay(this);<br /><br /><br /> Splash sp = new Splash(dispaly, new Form("Test"),"/PhotoStory.3gp", "video/3gpp");<br /><br /><br /> }<br /><br /> public void pauseApp() {<br /> }<br /><br /> public void destroyApp(boolean unconditional) {<br /> }<br /><br /> public static void quitApp() {<br /> instance.destroyApp(true);<br /> instance.notifyDestroyed();<br /> instance = null;<br /> }<br /><br />}<br />
CodeProject