Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User bejoy_ak's Avatar
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124
    Hi all

    I'm trying to play a video file in my nokia 6303classic, but i am getting the below mentioned error
    "javax.microedition.media.MediaException: Invalid locator: /res/9876543210.3gpp"

    i checked the formats supported by my phone and from that i was able to know tha it supports "3gpp"

    Please help me in resolving this issue

    below is the code which i used to play the video file.

    Code:
    try{
                //myPlayer=Manager.createPlayer(getClass().getResourceAsStream("file://localhost/E:/Video Enrollment/"+mobNo+".3gp"), "video/3gpp");
                //myPlayer=Manager.createPlayer("file://localhost/E:/Video Enrollment/"+mobNo+".3gpp");
                myPlayer=Manager.createPlayer("/res/9876543210.3gpp");
                myPlayer.addPlayerListener(this);
                //myPlayer.setLoopCount(-1);
                myPlayer.prefetch();
                myPlayer.realize();
                videoControl = (VideoControl)myPlayer.getControl("VideoControl");
                if (videoControl != null) {
                    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this);
                    videoControl.setDisplaySize(getWidth(),getHeight());
                    videoControl.setDisplayLocation(0,0);
    		videoControl.setVisible(true);
                }
                myPlayer.start();
            }catch(Exception e){
                Display.getDisplay(midlet).setCurrent(new Alert("",e.toString(),null,AlertType.INFO));
                e.printStackTrace();
            }
    Thanks & Regards
    Bejoy A K

  2. #2
    Registered User bejoy_ak's Avatar
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124
    Hi all

    I am able to play a video file which is stored locally in midlet when i changed the code to as below

    "myPlayer=Manager.createPlayer(getClass().getResourceAsStream("/res/9876543210.3gpp"), "video/3gpp");"

    but now i am not able to play the same file when it is stored in memeory card

    "java.lang.Illegal Argument Exception:Param is Null"

    The code i used to play the file from memory card is

    Code:
     myPlayer=Manager.createPlayer(getClass().getResourceAsStream("file://localhost/E:/Video Enrollment/9876543210.3gpp"), "video/3gpp");          
                myPlayer.addPlayerListener(this);
                //myPlayer.setLoopCount(-1);
                myPlayer.prefetch();
                myPlayer.realize();
                videoControl = (VideoControl)myPlayer.getControl("VideoControl");
                if (videoControl != null) {
                    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this);
                    videoControl.setDisplaySize(getWidth(),getHeight());
                    videoControl.setDisplayLocation(0,0);
    		videoControl.setVisible(true);
                }
                myPlayer.start();
            }catch(Exception e){
                Display.getDisplay(midlet).setCurrent(new Alert("",e.toString(),null,AlertType.INFO));
                e.printStackTrace();
            }
    Last edited by bejoy_ak; 2011-12-07 at 17:03.
    Thanks & Regards
    Bejoy A K

  3. #3
    Nokia Developer Moderator r2j7's Avatar
    Join Date
    Aug 2007
    Posts
    1,595
    Hello Bejoy A K,

    how about if you try to create the Player as follows:

    InputStream in = getClass().getResourceAsStream( "/media.format" );
    Manager.createPlayer( in, "media/format" )

    I.e. reading the resources to InputStream first before passing the InputStream to the Player for playback.

    Regards,
    r2j7

  4. #4
    Nokia Developer Champion hartti's Avatar
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192
    Hmmm.. I guess bejoy_ak is trying to playback a file which is NOT inside the JAR file, but in the file system. Is this correct Bejoy_ak?
    If this is indeed the case, then you are providing the file location incorrectly. See more guidance in here
    http://library.developer.nokia.com/t...06B06E4AC.html

    Hartti

  5. #5
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    I guess this path was not recognized and hence the exception was thrown.
    file://localhost/E:/Video Enrollment/9876543210.3gpp", can you go through the URL that Hartti suggested,

    I will recommend to print and check the root folder of the file system of the device. Then you should access the same.Try to remove the Host name from the above path and revert with the results.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. javax.microedition.media.MediaException
    By csckid in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2010-06-05, 14:17
  2. javax.microedition.media.MediaException: Realize error: -7002
    By itismohit in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2009-04-07, 09:17
  3. javax.microedition.media.MediaException:Realize error:-5 at realizing
    By manojkumar.m in forum Mobile Java General
    Replies: 6
    Last Post: 2008-10-23, 05:25
  4. javax.microedition.media.Mediaexception:Deviceerror
    By gupta.akhil21 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2008-10-14, 17:12
  5. javax.microedition.media.MediaException on 6233
    By prihei in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2006-09-29, 18:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved