×

Discussion Board

Results 1 to 15 of 25

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    69

    Unable to play video

    Hi all,

    I'm trying to run the following code, however its gives me nothing. Other than the video, everything's running fine. Please check through the code if you find anything going wrong.


    else if (c == Demo)
    {

    form1.deleteAll();
    form1.setTitle("Demo Video");
    form1.removeCommand(Next1);
    form1.removeCommand(Exit);


    playFromResource();



    }


    public void playFromResource()

    {

    try

    {

    InputStream in = getClass().getResourceAsStream("/Video/Hitesh.mpeg");
    if (in != null)
    {
    mPlayer = Manager.createPlayer(in, "video/mpeg");
    }else
    {
    alert = new Alert("Alert", "No video", null, null);
    display.setCurrent(alert);
    return;

    }
    mPlayer.prefetch();

    mPlayer.realize();
    if((mVidc = (VideoControl)mPlayer.getControl("VideoControl"))!=null)

    {

    mVideoItem = (Item)mVidc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
    form1.append(mVideoItem);
    }

    mPlayer.prefetch();
    mPlayer.start();
    // form1.removeCommand(mPlayCommand);
    display.setCurrent(form1);


    }
    catch (Exception e)

    {e.printStackTrace();}

    }

    waiting for response.

  2. #2
    Regular Contributor
    Join Date
    Jul 2008
    Location
    Faridabad(Delhi NCR)
    Posts
    343

    Re: Unable to play video

    Are you getting any exception if yes then please let us know so that we can slove your problem
    Anshu Chauhan
    J2me Developer

  3. #3
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    69

    Re: Unable to play video

    Yes, when i tried running it with .3gp it gave me a media error but when i play with mpeg, it gives me that alert for input stream to be null.

    i checked the location of the file and matched it correctly on the code also checked the .jar file....the file structure is same there too......

  4. #4
    Regular Contributor
    Join Date
    Jul 2008
    Location
    Faridabad(Delhi NCR)
    Posts
    343

    Re: Unable to play video

    change Manager.createPlayer(in, "video/mpeg"); with
    Manager.createPlayer(is, "video/3gpp");

    becoz you are using 3gp file. I m sure it will work

    and for mpeg file i think your mobile will not support that
    Anshu Chauhan
    J2me Developer

  5. #5
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    69

    Re: Unable to play video

    it gives me an error below



    javax.microedition.media.MediaException: Cannot create a Player for: video/3gpp
    at javax.microedition.media.Manager.getPlayerFromType(Manager.java:818)
    at javax.microedition.media.Manager.createPlayer(Manager.java:868)
    at javax.microedition.media.Manager.createPlayer(Manager.java:745)
    at AirtelMainMidlet.playFromResource(AirtelMainMidlet.java:109)
    at AirtelMainMidlet.commandAction(AirtelMainMidlet.java:310)

  6. #6
    Regular Contributor
    Join Date
    Jul 2008
    Location
    Faridabad(Delhi NCR)
    Posts
    343

    Re: Unable to play video

    ON which handset you are trying to run your application can you please mention that. or you playing video file on emulator
    Anshu Chauhan
    J2me Developer

  7. #7
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    69

    Re: Unable to play video

    well i believe there is somethings wrong with the code.............cause i have tried running this code on most of the phones...............

    the error was on emulator.

    phones i have tried on - Nokia N70, Sony Erricson K750i, I-mate(which hangs god knows why) and HTC(don't know the model)

Similar Threads

  1. cant play large video
    By zhouliwx in forum Mobile Java General
    Replies: 3
    Last Post: 2010-07-12, 11:28
  2. Play video with a active call in progress
    By mawe in forum Symbian Media (Closed)
    Replies: 14
    Last Post: 2008-11-20, 14:23
  3. Unable To Play a Video File In symbian 9.1 device
    By mailkamlesh in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-14, 18:06
  4. Unable To Play a Video File In symbian 9.1 device
    By mailkamlesh in forum Symbian
    Replies: 0
    Last Post: 2006-08-14, 08:15
  5. Play video on Canvas with N 6600 doesnt work. Please help!!!
    By Robert111 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-02-22, 08:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×