×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    254

    how to run a video in 5800 xpress music

    hi all
    i am trying to run video using j2me in 5800 but when i run it,
    it shows prefetch -4 error and it is unable to play that media

    can anyone post me the proper way to run media on the device


    regards
    Arun Gupta

  2. #2
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: how to run a video in 5800 xpress music

    hi ,
    please post ur code here.
    are u prefetch the player before creating it.
    media format is not the issue else u got the unsupported media exception.
    are u test ur application on other devices. is the same issue occurs with all other ones or this is only with 5800. well as u know that 5800 is latest device so there is no more known issues with this.

    thanks,
    jitu_goldie..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  3. #3
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    104

    Re: how to run a video in 5800 xpress music

    Hi Arun,

    For the playing a video this is format:
    InputStream is=getClass().getResourceAsStream(file);
    Player player=null;
    player=Manager.createPlayer(is,"video/mpeg");
    player.prefetch(); // prefetch
    player.realize(); // realize
    player.start(); // and start


    Thanks
    Shravan

  4. #4
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    254

    Re: how to run a video in 5800 xpress music

    First
    The Prefetch error comes suddenly and there is no idea when and at what time it may come up
    i am posting the code of my player

    Player code the start method is called by a thread



    public void start()
    {
    try {
    /*
    *if there is an adv coming suddenly then close the running player and file connection to check
    */
    if(player != null && fconn!=null)
    stop();
    //filepath=System.getProperty("fileconn.dir.memorycard");
    String rootfile = filepath+adv.File;
    graphics.setColor(12,255,255);
    graphics.fillRect(0,0,getWidth(),getHeight());
    graphics.setColor(0);
    graphics.drawString(adv.File,0,30,0);
    repaint();

    //Opening the file connection

    fconn=(FileConnection)Connector.open(rootfile,Connector.READ);
    graphics.setColor(0);
    graphics.drawString(fconn.exists()+"",0,50,0);
    repaint();
    // Checking the File Connection
    if(fconn.exists())
    {
    ins=fconn.openInputStream();
    }
    // Creating the appropiate player

    if(array[index].endsWith(".3gp"))
    player = Manager.createPlayer(ins,"video/3gpp");
    if(array[index].endsWith(".mp4"))
    player = Manager.createPlayer(ins,"video/mp4");
    // Adding the playerlistener
    player.addPlayerListener(this);
    // relaising the player
    player.realize();
    if(player.getState()==Player.REALIZED)
    {
    player.prefetch();
    }

    // get the video control

    control = (VideoControl)player.getControl("VideoControl");
    if (control != null)
    {
    control.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this);
    control.setDisplaySize(this.getWidth(),this.getHeight());
    control.setVisible(true);
    }

    // start the player

    player.start();


    }
    catch(Exception e) {
    stop();
    Alert erro = new Alert("Erro",e.getMessage(),null,AlertType.ERROR);
    display.setCurrent(erro);
    }finally{
    try{
    ins.close();
    fconn.close();
    }catch(Exception ex)
    {}


    }
    }

    public void stop() {
    if(player != null && fconn!=null)
    {

    try{
    player.removePlayerListener(this);
    player.stop();
    player.deallocate();
    player.close();

    player=null;
    if(ins!=null)
    ins.close();
    if(fconn!=null)
    fconn.close();

    ins=null;

    fconn=null;

    graphics.drawString("player && fconn closed",0,100,0);
    repaint();
    }catch(Exception ex)
    {
    graphics.setColor(0);
    graphics.drawString("player && fconn closed",20,50,0);
    repaint();
    }
    }
    }

    public void playerUpdate(Player p, String s, Object o) {
    status = s;

    if(p.getState() == Player.STARTED)
    {
    int width = control.getDisplayWidth();
    int height = control.getDisplayHeight();
    control.setDisplayLocation((getWidth() - width)/2,(getHeight() - height)/2);
    control.setVisible(true);
    status = s + ": DW=" + width + "-DH=" + height + "-SW=" + control.getSourceWidth() + "-SH=" + control.getSourceHeight();
    }
    if(s == PlayerListener.END_OF_MEDIA)
    {
    try
    {
    stop();
    InformAllAdvComplete = true;
    }
    catch(Exception me) {
    }
    }
    repaint();
    }

  5. #5
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    254

    Re: how to run a video in 5800 xpress music

    shravan your code is correct same way it is done still the player crashes

    Quote Originally Posted by sharvan1981 View Post
    Hi Arun,

    For the playing a video this is format:
    InputStream is=getClass().getResourceAsStream(file);
    Player player=null;
    player=Manager.createPlayer(is,"video/mpeg");
    player.prefetch(); // prefetch
    player.realize(); // realize
    player.start(); // and start


    Thanks
    Shravan

  6. #6
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: how to run a video in 5800 xpress music

    hi,
    please check that what type of formats were supported by 5800.
    try each format one by one.
    play media from resource in place of filesystem for just testing.
    may be player not found the file or not supported the format.

    may be ur problem get solved.


    thanks,
    jitu_goldie..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  7. #7
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    254

    Re: how to run a video in 5800 xpress music

    in 5800
    both 3gpp and mp4 are supported format..
    if i place the media in the resources it will become very heavy
    these are my questions anyway i will do that and i will inform about that

    regards
    Arun Gupta

  8. #8
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: how to run a video in 5800 xpress music

    hi,
    i was suggest u to put that file in resource just for testing purpose.
    U can verify by doing this that whether it is the problem of 5800 or may be ur not getting correct file path.


    thanks,
    jitu_goldie..
    thanks,
    jitu_goldie..

    KEEP TRYING..

Posting Permissions

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