×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Jun 2010
    Location
    Palestine/Ramallah
    Posts
    76

    Question How to play media file in System media player in j2me????

    I want to play media files (.mp3, .3gp,..) impeded in jar file via OS media player
    like real player on Symbian
    Please help me if there are any code snippet.

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: How to play media file in System media player in j2me????

    Try using platformRequest() passing the URI of any .mp3 or .3gp file on the device, if it works - move the media from JAR to device file system in some temp folder and pass its URI to the platformRequest.

    platformRequest("nativeapp:application-exe=MediaPlayer.exe;content=E:\Feelings.MP3;application-args=-ExampleArgument");

    Refer to: http://library.forum.nokia.com/topic...C-C024F2956836
    Thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    Jun 2010
    Location
    Palestine/Ramallah
    Posts
    76

    Re: How to play media file in System media player in j2me????

    Quote Originally Posted by ektasrv View Post
    Try using platformRequest() passing the URI of any .mp3 or .3gp file on the device, if it works - move the media from JAR to device file system in some temp folder and pass its URI to the platformRequest.

    platformRequest("nativeapp:application-exe=MediaPlayer.exe;content=E:\Feelings.MP3;application-args=-ExampleArgument");

    Refer to: http://library.forum.nokia.com/topic...C-C024F2956836
    Thanks for replay
    i plaied the file using system media player
    but permission raised for each playing time it is confuse me
    is there any way to disable this event???
    please if you know dont hesitate to tell me

  4. #4
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: How to play media file in System media player in j2me????

    Try signing the app with 3rd party certificate like Verisign and educate your end user to set the permission for the app - for accessing file system as "Ask only once" or "All ways allowed" if available for this app.
    Thanks,
    Ekta

  5. #5
    Registered User
    Join Date
    Mar 2014
    Posts
    5

    Re: How to play media file in System media player in j2me????

    Can you tell how you plaied the video. I'm trying to do the same. Please help me.

  6. #6
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,557

    Re: How to play media file in System media player in j2me????

    Local file access code examples: http://developer.nokia.com/community.../Data_Articles

    Video streaming examples (among other things): http://developer.nokia.com/community...media_Articles

    Making a platform request call example: http://developer.nokia.com/community...r_from_Java_ME

    If those examples are not sufficient for you, please post here the code you have written to attempt to do what you wish, and let us know what you expect to happen and explain also what actually/really happens (including any and all errors or exceptions).

  7. #7
    Registered User
    Join Date
    Mar 2014
    Posts
    5

    Re: How to play media file in System media player in j2me????

    I'm trying to play a .mp3 file using default media player from my app using platformRequest.

    This is my code - platformRequest("file:///C:/song.mp3");
    (I tried this too - platformRequest("nativeapp:application-exe=MediaPlayer.exe;content=file:///C:/song.mp3"); )

    The file exists in that location and nothing happens by using platformRequest. I tried for web URL and call requests and those working fine. But I can't perform the same for media files . And i don't have any errors or exceptions.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to play media file in System media player in j2me????

    Quote Originally Posted by Prabhu View Post
    The file exists in that location
    How sure are you about that? http://developer.nokia.com/community...ems_in_Java_ME and http://developer.nokia.com/community...ers_in_Java_ME may help in deciding if the file is really there.

  9. #9
    Registered User
    Join Date
    Mar 2014
    Posts
    5

    Re: How to play media file in System media player in j2me????

    Quote Originally Posted by wizard_hu_ View Post
    How sure are you about that? http://developer.nokia.com/community...ems_in_Java_ME and http://developer.nokia.com/community...ers_in_Java_ME may help in deciding if the file is really there.
    I already tried those links and verified the file path. it is perfect and also i checked with the following code ,

    public boolean isFileExisted(String path) {
    boolean isExisted = false;
    FileConnection filecon = null;
    try {
    filecon = (FileConnection) Connector.open(path, Connector.READ);
    isExisted = filecon.exists();
    } catch (java.lang.SecurityException e) {
    } catch (Exception e) {
    } finally {
    try {
    if (filecon != null) {
    filecon.close();
    }
    catch (Exception e) {
    }
    }
    return isExisted;
    }
    }

    public void playFileFromSDCard() {

    String path = "file:///C:/song.mp3";

    if (isFileExisted(path)) {
    try {
    System.out.println("path exist -> calling platform request " + path);
    platformRequest(path);
    } catch (ConnectionNotFoundException ex) {
    ex.printStackTrace();
    }
    }
    else {
    System.out.println("path doesnt exists");
    }
    }

    and i got result "path exist -> calling platform request file:///C:/song.mp3" .
    Last edited by Prabhu; 2014-03-19 at 06:33.

  10. #10
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    682

    Re: How to play media file in System media player in j2me????

    nativeapp: locator is not available for you on Series40 & New Asha platforms
    see the available locators here http://developer.nokia.com/resources...n-java-me.html

    nativeapp: locator was available on Symbian's j2me VM (but not to 3rd party developers IIRC)

    If you are targeting only the new Asha platform then you can simply run it using the file path only as such
    platformRequest("file:///MemoryCard/song.mp3");

    However to go beyond the scope of your question may I ask why are you even trying to play the song on the phone player which will cause your app to stop running and send the user to the phone player app? this is not good user interaction, you can play almost anything that the phone player will be able to play by yourself inside the app using the MMAPI.
    Heard of DVLUP? Join here

  11. #11
    Registered User
    Join Date
    Mar 2014
    Posts
    5

    Re: How to play media file in System media player in j2me????

    Quote Originally Posted by shai.i View Post
    why are you even trying to play the song on the phone player which will cause your app to stop running and send the user to the phone player app?
    I also like to play some .3gp files from my app. I need the functionality of media player for video files like screen rotation. So i should invoke the default media player.

  12. #12
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    682

    Re: How to play media file in System media player in j2me????

    You can also play 3gp videos inside your app so I still don't see a reason to invoke the phone's default media player.
    Heard of DVLUP? Join here

  13. #13
    Registered User
    Join Date
    Mar 2014
    Posts
    5

    Re: How to play media file in System media player in j2me????

    Quote Originally Posted by shai.i View Post
    You can also play 3gp videos inside your app
    But we don't have the video rotation (to play in landscape mode ) functionality right ?

  14. #14
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    682

    Re: How to play media file in System media player in j2me????

    You can change the app orientation using Orientation.setAppOrientation at runtime from the com.nokia.mid.ui.orientation package
    that will also change your video rotation.

    That API is available on Asha 1.0 and 1.1 platform, I don't know if its available also on Nokia DP 2.0 platform, you should check it out.
    Heard of DVLUP? Join here

  15. #15
    Registered User
    Join Date
    May 2014
    Posts
    1

    Re: How to play media file in System media player in j2me????

    If your application in manufacturer domain)) you may use void from com.nokia.mid.impl.jms.core.Launcher (its package exist in S40 6th Edition SDK)
    Launcher.handleContent(String url);
    url like this: E:\\mp3file.mp3, E:\\pngfile.png (open images, audio/video files in OS mediaplayer).
    In my application i use its code.

Similar Threads

  1. Media Player which can play keypad tones fast!
    By manish.agarw in forum Symbian
    Replies: 5
    Last Post: 2010-06-09, 09:04
  2. Play Media File in J2me
    By prajapati.ajay in forum Mobile Java General
    Replies: 3
    Last Post: 2009-10-09, 19:51
  3. e51 media player hangs on microSD media scaning
    By antonioriva in forum Audio
    Replies: 0
    Last Post: 2009-08-09, 20:50
  4. Replies: 1
    Last Post: 2008-10-15, 16:08
  5. Replies: 0
    Last Post: 2005-06-08, 10:19

Posting Permissions

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