473,770 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

J2ME Question: Problem playing video...

4 New Member
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 2188
mani86
3 New Member
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 New Member
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
4058
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 application works fine on some devices. But at Samsung mobile phone, I have a problem. In this phone my 2 commands appear under menu command, and then I can
1
3560
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 phones have very limited resources so the interpreter should be small and fast. Does anyone know of a simple scripting language source to handle if ( ) { } else {} and while ( ) { } and expressions and function calls back into Java. I'm using...
0
3240
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 also does not meet my needs). Does Java read in the entire file and then allow you to skip through the file or does it create a ??pointer?? to the file and allow you to skip to an offset location within this file without it having to read in...
14
2353
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 default player to kick in. What might be causing the video to start then stop? Thanks. http://www.askblax.com
0
3464
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 desired behavior, i.e. having all the transparent parts of the image show the underlying playing video, I get some sort of background
1
1557
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); player.addPlayerListener(this); player.realize();
0
2288
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
1802
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" CLASSID= "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE= "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" TYPE="application/x-oleobject"
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8931
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.