Playing Video

MMAPI(Mobile Media API) provides a framework for playing media content on J2ME devices.There are protocols defined for real-time streaming of Internet radio content, streaming other RTP (Real-time Transport Protocol) content, capturing audio, and taking pictures.

The method below plays a video file the on mobile device:
public void run()
{
try
{
String url = "http://server/video-mpeg.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
videoForm.append(videoItem);

//Start the video
p.start();
}
catch(Exception e)
{}
}

If you want to play the video from an rtsp server, you only need to change url with "rtsp://server/video.mpg". This will only work on devices which support real time input streams.

13 comments:

  1. First of all , would like to say..nice work done !!!

    but what to do ...to read vedio files from mobile's memory and then play them ?

    ReplyDelete
  2. Hello,

    i wanted an running and simple example for playing a video from a local file system....not from server...........i did find many different codes from different webpages.......but none of them came along good........none of them worked for me.

    i have also gone through the MMAPI example which is there in the WTK package.....but that was also complicated.......

    thanks......
    or if you want you can mail me that too...

    hiteshrawat@gmail.com

    ReplyDelete
  3. nice code! but please tl me how shud i link the vedio file on the select of a button from the menu

    ReplyDelete
  4. Really nice code..
    But if i wanted to play last N number of seconds video from video file, then how to reduce the size of video.

    ReplyDelete
  5. What about the asterisk streaming?

    ReplyDelete
  6. how to get a video file from a tomcat server and making it to run in a mobile application

    ReplyDelete
  7. how to get a video like an image in j2me

    ReplyDelete
  8. hahaha funny this is like a pirate code for crack windows vista haha thanks for sharing you just give an idea for the windows media player.
    Nice post.

    ReplyDelete
  9. I just like your program ,were is the image result your program

    ReplyDelete
  10. I'm so glad to find your blog, even though I did it by a fluke. The information posted here is interesting and entertaining. In short, a really nice blog.

    ReplyDelete
  11. hiii, i want to play shout cast streaming radio on MIDP any help...thanks in advance

    ReplyDelete

 

Design by Blogger Buster | Distributed by Blogging Tips