| Reply | « Previous Thread | Next Thread » |
|
Hi,
I am trying to access a file for reading but it always fails. Below is the code I am using for that purpose but the returned stream (is) is always null. String filePath = System.getProperty("fileconn.dir.music"); InputStream is = getClass().getResourceAsStream(filePath+"b.mp3"); I guess I am missing something. I am using (6270001) S40_SDK_3rd_Edition. this is the path where b.mp3 resides on the hard disk: c:\Nokia\Devices\S40_SDK_3rd_Edition\bin\Storage\6270001\C\predefgallery\predefmusic\b.mp3 getProperty returns: "file:///C:/predefgallery/predefmusic/" but as I said getResourceAsStream always returns null. Please help with that. Thanks |
|
Hi,
Check whether you have READ access to the predefmusic folder.Also check manually in the phone whether the b.mp3 phone is good or not. Thanks Soku |
|
Hi beyossi! Welcome to Nokia Developer Discussion Boards!! :)
Are you getting any permission message while accessing the MP3 file ? Since you are trying in the emulator, go to Tools > Preferences > MIDP(Tab) Use the relavant Security domain and make sure that the permissions are set to "Allowed" and restart the emulator. Also make sure that the MP3 file you are trying with is a valid one. Are getting any Exceptions ? Regards Gopal |
|
Quote:
The directories have read access. the b.mp3 file can be played on a media player on my desktop, so I guess it means the file is readable and the file is good. At the first place the permissions in the MIDP tab were set to the defaults. Then I changed it to allowed as Gopal suggested (it required changing it to trusted) but the behaviour didn't change (i.e. getResourceAsStream still returned null). Shouldn't I do something with the JAR for making it trusted (is it just a configuration of the emulator)? Sorry for the silly questions, as it is my first java application (I came from real-time embedded environment using C). BTW, I am using the eclipse environment. Do you have any other suggestions? Thanks Yossi |
|
Hi,
could you check with another sample file for playing.Also check whether the file is DRM protected or having any other seecurity features. Thanks Soku |
|
Hi,
Also check whether the path u specified is correct. Also have a look at the following links...may be it would be helpful to you.. http://forum.java.sun.com/thread.jsp...sageID=4274220 http://developers.sun.com/mobility/a...ileconnection/ Thanks Soku |
|
Quote:
Can you give a try in the real device, does it still returns null ? Regards Gopal MobiQuil.com An initiative by Developers for Developers. http://www.mobiquil.com - Alpha - Launched. |
|
Since I am very new to mobile application development I don't know how to see the returned value on the device. Is there a convenient and simple way to do so?
I tried another file, but it didn't realy help. What is that DRM protection Soku had mentioned?, how can I check that? What else can be configured for security aspects? When checking another file I encountered a strange issue: I tried to play the file using the built in media player, but no voice was heard... Then I tried another file named mtmp05116.wav which was probably created in the SDK when I once played it through http connection (it looks like a temporary file the emulator kept on the disk), and it worked. However when I put it in the music directory I still got a null from the getResourceAsStream API. The 'bad' file can be played on the windows desktop (I encountered few such files) using the windows media player. Thanks |
|
Quote:
I suggest to try your MIDlet using an audio file that comes along with the SDK - Just to make sure that its not the issue with the Audio file. Regards Gopal |
|
Hi,
In the developer's guidelines document ( http://developer.sonyericsson.com/ge...do?docId=65067 ) on page 47 there's a list of which JSR-75 operations are permitted on DRM protected files and which aren't. It seems you shouldn't be able to open any InputStreams on them at all - is that what you're seeing? Thanks Soku |
|
Thanks for your help.
I also failed to Connect.open the file fore creating a fileConnection, which supposed to be allowed according to what is indicated in the attachement you sent. I also fail to do it on the device itself. I will try to play somemore with that. BTW, is there something in the application build proceddure that may limit me from doing specific actions? Thanks |
|
Try to copy your file in C:\Nokia\Devices\S40_SDK_3rd_Edition\bin\Storage\Default\C\predefgallery\predefmusic . I mean not inside '6270001\' directory, but to 'Default\'.
Regards Gopal |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Problems starting an J2ME app installed via .sis file on 9300i | fok | Mobile Java Tools & SDKs | 1 | 2006-10-11 22:46 |
| Carbide.vs problems generating AIF file | profoundwhispers | Symbian Tools & SDKs | 3 | 2006-06-06 09:51 |
| have two problems in import mmp file and without error in build | silver_man82 | Carbide.c++ IDE and plug-ins | 1 | 2006-06-03 05:18 |
| Problems with CBA resource in 2nd Resource File. | colinlawrence | Symbian Tools & SDKs | 5 | 2004-02-17 03:47 |
| Accessing data of a stored file | lazmous | Mobile Java General | 2 | 2003-04-04 16:50 |