J2ME Question: Problem playing video...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • praskuma
    New Member
    • Mar 2007
    • 4

    #1

    J2ME Question: Problem playing video...

    Hi

    I'm trying to play a video using j2me api I have the following code
    But for some reason the video doesnt apear on the emulator.

    I'm using netbeans IDE with the sun emulator.

    Can you please let me know if i need to tweak this code to see the actual video on the emulator ?

    Thanks
    Prasanna

    Code:
    package p2;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import javax.microedition.media.control.VideoControl;
    
    public class p2 extends MIDlet implements CommandListener {
        
        private Form form;
        public void startApp() {
            
            if (form == null) 
            {
                   form = new Form("Content types and protocols");
            
                    Command exitCommand = new Command("Exit", Command.EXIT, 0);
     
                    form.addCommand(exitCommand);
                    form.setCommandListener(this);
    
                    
              }
            try
            {
            String url = "http://today.java.net/today/2005/09/27/promo.mpg";
            Player p = Manager.createPlayer(url);
            p.realize();
    
            //Get the video controller
            VideoControl video = (VideoControl) p.getControl("VideoControl");
    
            //Get a GUI to display the video
            Item videoItem = (Item)video.initDisplayMode(
            VideoControl.USE_GUI_PRIMITIVE, null);
    
            //Append the GUI to a form
            form.append(videoItem);
    
            //Start the video
            p.start();
          }
           catch(Exception e)
           {}
            
              Display.getDisplay(this).setCurrent(form);
              
         }
        
        
        public void pauseApp() 
        {
        }
        
        public void destroyApp(boolean unconditional) 
        {
        }
        
        public void commandAction(Command c, Displayable s) 
        {
           notifyDestroyed();
        }
    
    }
    Last edited by JosAH; Apr 8 '07, 08:57 AM. Reason: added code tags for readability
  • mani86
    New Member
    • Apr 2007
    • 3

    #2
    hi :)
    this is the first time i post in this forum :)
    i am facing the same problem discussed above, and im using the exact code. but in my case i can hear the music from the video and can see an empty video screen. can anyone help us out with these problems. i would really appreciate any help. thanks in advance :)
    mani

    Comment

    • mani86
      New Member
      • Apr 2007
      • 3

      #3
      hi :)
      its me again. can anyone plz help me out with this problem, because the deadline to submit this ohase of the project is this tuesday.. displaying the video is the end result, so all the work doesnt count if there's no video :S
      i would appreciate any help. thanks again :)
      mani

      Comment

      Working...