473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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

Expand|Select|Wrap|Line Numbers
  1. package p2;
  2. import java.io.*;
  3. import javax.microedition.io.*;
  4. import javax.microedition.midlet.*;
  5. import javax.microedition.lcdui.*;
  6. import javax.microedition.media.*;
  7. import javax.microedition.media.control.VideoControl;
  8.  
  9. public class p2 extends MIDlet implements CommandListener {
  10.  
  11.     private Form form;
  12.     public void startApp() {
  13.  
  14.         if (form == null) 
  15.         {
  16.                form = new Form("Content types and protocols");
  17.  
  18.                 Command exitCommand = new Command("Exit", Command.EXIT, 0);
  19.  
  20.                 form.addCommand(exitCommand);
  21.                 form.setCommandListener(this);
  22.  
  23.  
  24.           }
  25.         try
  26.         {
  27.         String url = "http://today.java.net/today/2005/09/27/promo.mpg";
  28.         Player p = Manager.createPlayer(url);
  29.         p.realize();
  30.  
  31.         //Get the video controller
  32.         VideoControl video = (VideoControl) p.getControl("VideoControl");
  33.  
  34.         //Get a GUI to display the video
  35.         Item videoItem = (Item)video.initDisplayMode(
  36.         VideoControl.USE_GUI_PRIMITIVE, null);
  37.  
  38.         //Append the GUI to a form
  39.         form.append(videoItem);
  40.  
  41.         //Start the video
  42.         p.start();
  43.       }
  44.        catch(Exception e)
  45.        {}
  46.  
  47.           Display.getDisplay(this).setCurrent(form);
  48.  
  49.      }
  50.  
  51.  
  52.     public void pauseApp() 
  53.     {
  54.     }
  55.  
  56.     public void destroyApp(boolean unconditional) 
  57.     {
  58.     }
  59.  
  60.     public void commandAction(Command c, Displayable s) 
  61.     {
  62.        notifyDestroyed();
  63.     }
  64.  
  65. }
  66.  
Mar 7 '07 #1
2 2163
mani86
3
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
Apr 4 '07 #2
mani86
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
Apr 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sveta | last post by:
Hi, all! I am new with J2ME. I have application that has form with 2 commands (exit and select). All UI uses are high level API, and it is very important to leave it high-level. This...
1
by: Ralph Yozzo | last post by:
Hi, Does anyone know of a good place to look for a starting point -- I'm building an application on J2ME and I want to have a scripting language to both access my UI and the database RMS. Most...
0
by: Paul C | last post by:
I am wanting to store a collection of relatively large binary files on a device. The above method seems to be the only way I can do this (j2me databases do not meet my needs- the recordstore class...
14
by: askMe | last post by:
I developed a web page that plays an mpg using the simple embed tag. When the page loads, the video starts, but then stops after a few seconds. I use the embed tag because I want the user's...
0
by: SamSpide | last post by:
Hi all, I'm trying to place a semi-transparent image (i.e. an image with parts of it were drawn in transparent color) over a playing video, but can't seem to make it work. Instead of the...
1
by: mani86 | last post by:
Hi everyone :) i am trying to display a video located on a remote server, and im using the folliwing code to do it: try { player = Manager.createPlayer(locator);...
0
by: ArwaAbood | last post by:
hi every one how can I playing video online in mobile application. I'm using netbeans to build the application (j2me) and my server is tomcat server (jsp server)
1
by: ttamilvanan81 | last post by:
Hai everyone, I am working with a Image/Video Application. I need to display and play any video file in browser. Now i am using the following Embed Tag. <OBJECT ID="mediaPlayer" ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.