| Reply | « Previous Thread | Next Thread » |
|
Hello!
I'm developing a music player for a few S40 3rd ed phones (6233, 6131, 6280, 6288). The music player must be able to search for music in the phone mem and build custom playlists, and play them. I have started with the 6233! My problem is that you cannot use FileConnection on a 5 MB mp3 because it will throw OutOfMemoryException... I'm trying to do streaming on the memory card but the following code throws an exception with msg: "Error connecting data source". player = Manager.createPlayer("file://localhost/E:/test.mp3"); where E: stands for the memory card... This is the same string passed to the FileConnection.open's method (wich works). I have tried to split an mp3 into 320kb pieces and play sequentially using ByteArrayInputStreams as Player's input. It works, but when switching between Players the sound is cut off for aprox 150 milliseconds. Can anybody tell me what to do? Another question: how do you make use of the contructor Player(DataSource dat). I mean that, if DataSource is a private class why isn't this constructor also private? Using: -JDK 1.4.0.13 -WTK25 beta -Nokia SDK S40 rd ed FP1 -Carbide.j 1.5 -Eclipse 3.2 |
|
Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
Offline
Super Contributor
|
|
hi,
try following: Code:
String url = System.getProperty("Fileconn.dir.memorycard") + "test.mp3";
player = Manager.createPlayer(url);
related technote: Playing large audio files by using InputStream throws an OutOfMemoryError hth, regards, Peter |
| peterblazejewicz |
| View Public Profile |
| Find all posts by peterblazejewicz |
|
Thanks for the reply!
I have tryed your suggestion and it doesn't work. I recieve the same exception. It says in that technical paper that you must add an extra tag in the JAD -> progressive_download: enabled. It seems little bit wierd the name of this tag (lowercases and underscore). Anyway it still doesn't work with the tag. Has anybody tested this solution? I need more detailed code if possible! Thanks again! PS: The test was made on Nokia 6233, firmware 4.52, if it helps with something! I know that the 6233 fully supports the FP1 SDK.
Last edited by pig30n : 2006-11-25 at 02:08.
|
|
Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
Offline
Super Contributor
|
|
|
hi,
I meant that part: Quote:
are you able to access mp3 file from other directories on memory card? according to specs all memory card should be accessible on S40 as "Designed public directories and files therein": http://www.forum.nokia.com/ME_Develo...82070821D.html another thing I could wonder is the meaning of "cleartext media file" in above description for S403rd edition devices, what does it mean? regards, Peter |
| peterblazejewicz |
| View Public Profile |
| Find all posts by peterblazejewicz |
|
Yes i am able to access any file from memory card, but i'm not able to make the Player class to stream from a big (>1MB) mp3, for example.
This is the actual code: try { FileConnection fileConn =(FileConnection)Connector.open("file://localhost/E:/test.mp3"); //This if is valid, so the path is valid and the file exists. //If i pass fileConn.openInputStream() to a player, i recieve OutOfMemory, //because the mp3 is too large... if(fileConn.exists()) { //None of the above methods works player = Manager.createPlayer(fileConn.getURL()); //String url = System.getProperty("Fileconn.dir.memorycard") + "test.mp3"; //player = Manager.createPlayer(url); //player = Manager.createPlayer("file://localhost/E:/test.mp3"); } } catch ... "Error connectig to data source" Is there any other thing that i miss here? The "Application access"->"Data access"->"Add and edit data" is set tot "Ask every time". The other 2 options "Ask first time only" and "Always allowed" are not available. Thanks! |
|
Finally!!!
After a lot of search over the whole internet :P i finally found the solution into the following Sony Ericsson Tech Paper :D : http://developer.sonyericsson.com/si...api_jsr135.jsp In other words: 1) You have a 5MB mp3 on the memory card. 2) The memory card on all Nokia is drive E:/ (the phone's memory is C:/) 3) Suppose you have the mp3 on E:/test.mp3. 4) If you want to create a player that streams over the mp3 you should use the following MAGIC CODE: Player p = Manager.createPlayer("file:///E:/test.mp3"); p.realize(); p.start() .... 5) Btw: that progressive_download tag in the JAD is: progressive-download: enable not progressive_download: enabled like in the Nokia technote. Tested on 6233, S40 3rd Ed FP1 SKD Emulator, works for mp3, mp4 and aac files.
Last edited by pig30n : 2006-12-14 at 16:22.
|
|
I forgot to tell you that this works only if your application is Trusted
If the application is not trusted you can create the player, but the Player.start() method throws "Device Error". The "Application access"->"Data access"->"Add and edit data" must be set to Always Allowed in order to be able to stream via Mem Card. Exception is thrown even if you select Ask every time and accept every question about security issues that the phone triggers.
Last edited by pig30n : 2006-12-13 at 15:17.
|
|
Hi,
I am looking for a developer who can help me stream internet radio on S40 3rd edition phones. I can explain details to someone who is interested. Can be contacted on technicaldil @ yahoo.co.in |
| technicaldil |
| View Public Profile |
| Find all posts by technicaldil |
|
Hi i tried this jad property in N70 but i it is not working...I am getting Unknown Exception 0.Please suggest me what i am missing.I made sure the file path is correct.
1.My file is available in "E:/Videos/test.3gp" 2.File size is around 25 MB 3.Jad property is "progressive-download:enable" 4.The suite settings(Read and edit user data) of the application i changed from "Not allowed" to "Ask Everytime"(Since that is the only alternative i have) My code snippet is as follows. try{ initDone = false; if (videoFile == null){ midlet.alertError("No video file specified"); return; } String filename="file:///E:/Videos/test.3gp"; player = Manager.createPlayer(filename); player.addPlayerListener(this); player.prefetch(); player.realize(); VideoControl videoControl = (VideoControl) (player .getControl("VideoControl")); if (videoControl == null){ midlet.alertError("VideoControl not supported"); }else{ videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this); videoControl.setVisible(true); } initDone = true; player.start(); }catch (Exception ioe){ discardPlayer(); midlet.alertError("IOException: " + ioe+"size="+ size); } please suggest me what else i am missing. Thanks & Regards kannan [kamalinfo2k2@yahoo.com] |
| kamalinfo2k2@yahoo.com |
| View Public Profile |
| Visit kamalinfo2k2@yahoo.com's homepage! |
| Find all posts by kamalinfo2k2@yahoo.com |
|
it's progressive_download: enabled
I guess this might not solve your issue though... Hartti |
|
Hi there. The progressive download feature is only available for certain types of media: mp3, aac and mp4. I see there that you are trying to stream a 3gp file, and this is your problem :(
I also noticed that mp3 files encoded with VBR (Variable bitrate) are not supported by the Java Player. It throws a very sad Exception when you try to realize the player. Its not so nice, because VBR mp3s allows you the most non-lossy encoding that the mp3 format can give. The funny thing is that the phone's player (on a Nokia phone) can play those type of files. The even more funny thing is that the Java Player on SE Wxxx (xxx > 700) doesn't throw any exception, and successfully plays mp3 format files with VBR. Now, i let you decide who's fault it is ... There are 10 kinds of people. Those who understand binaries, and those who don't! |
|
Hai
Hartti I am converting a flv to 3gp and mp4 and shifting moov box from end to front for progressive downloads every thing is fine but when i starts playing mp3 and 3gp file via progressive download it starts playing and after paying some part it stop playing i am not understanding this what is problem ? NEED HELP. Vijay Patidar
Last edited by vijaypatidar : 2008-04-22 at 09:55.
|
| vijaypatidar |
| View Public Profile |
| Find all posts by vijaypatidar |
|
OK Friends,
Here's the completer solution. I am new to J2ME programming and started out of my own interest to develop for my Nokia 5300 XpressMusic edition phone and hope this works for most of the S40 phones at least. My idea is to give keen insights into the following : 1) To play Video files (eg: 3gp) from the memory card without throwing the OutofMemory exception by the JVM at runtime. 2) To present a clear cu picture and advantage of using the Progressive Download feature in such user scenarios. I will tackle both issues one at a time. As a background, I had to develop a rural empowerment application in which a major part that was critical to its functioning is based on playing large sized (around 2-5 MB) videos on the phone. Of course, I can't have videos in JAR file and can't stream them too since India doesn't have the HTTP streaming over the air till now, though it is expected soon, as 3G bandwidth is now allocated. So, here's the solution. Since, I am using Nokia device, my memory card drive is E:/ and progressive download is supported on my phone (not supported on all - dependes on the Java Platform the phone uses. The new ones do support it increasingly.) 1. PLAYING VIDEOS STORED IN THE MEMORY CARD For playing videos, we can us the overloaded definition of the Manager.createPlayer(datasource) function which takes only one parameter instead of 2 i.e. inputstream and type of video like the following: //FileConnection fileConn = (FileConnection)Connector.open("file:///E:/test.3gp", Connector.READ); //InputStream in = fileConn.openInputStream(); //player = Manager.createPlayer(in, "video/3gpp"); Instead you are required to use this: player = Manager.createPlayer("file:///E:/test.3gp"); player.realize(); This will create a player for a file from the memory card. Here we are NOT using the JSR 75 FileConnection API and hence, no problems whatsoever as pointed by a few members. The following code comes after the one given above : videoControl = (VideoControl)player.getControl("VideoControl"); canvas = new VideoCanvas(this, videoControl); canvas.addCommand(stop); canvas.setCommandListener(this); display.setCurrent(alert,canvas); player.start(); Remember here that I am loading this video on a canvas (its neater to do so!) and not on a form, you can do it on a form too. The code will change slightly for that. 2. USING PROGRESSIVE DOWNLOAD FEATURE Using only what is given above, we can get a video playing from the memory card and hence get rid of the tension of keeping them in JAR files (i.e. in the local resources folder). But, this is not enough since, if the video size if greater than typically 150-200 kB, you will get an annoying runtime exception java/lang/OutofMemory. This happens bcoz the video when played from the memory card needs to be loaded completely into the runtime memory of the phone popularly known as 'heap' and then processed. Now, typically phone runtime heaps for Java are of the order of 2MB or so (2MB in Nokia 5300), hence, you can very well imagine the size of the video permitted to be shown in your application. The heap also contains all other runtime files of your application as well and that leaves a very meagre amount of space, usually 100-150 kB for your videos as I had told earlier. So, what's the solution? The latest Java platforms have come up with somethign known as 'Progresive Download' which allows users to stream videos or music files straight from the memory card and play/process them on the fly as they are being loaded from th memory. To use this option, which, in my opinion is the only remedy in case of playing large videos and music mp3s from the memory card, you simply need to set a user-defined property in the JAD file of your MIDlet. This is illustrated as following: progressive_download : enabled Yes, you got it right! It an underscore(_) and NOT a hyphen(-). This will let you forget all your worries regarding streaming big video files from your memory card in the MIDlet. But, remember, all phones do not carry the 'progressive download' add-on in their Java platform, so that makes it a small technical portability glitch though most of the new ones do, as I discussed earlier. Hope that loooooong post was of help. Thanks. Regards, Vishrut Shukla Centre for Software Development BITS, Pilani - Goa Campus Goa, India |
| vishrutshukla |
| View Public Profile |
| Find all posts by vishrutshukla |
|
Hi,
we are already trying for a very long time to stream via the memory card. However, without succes - except on SE phones. vishrutshukla, is it possible to explain what we exactly can do with this 'trick'? Quote:
Did you already achieved this with a Nokia phone without using RTSP? Thanks in advance, F. |
|
hi fvquicke!
I have already tried the technique using progressive_download. That works perfectly well. I m using Nokia 5300 (S40 3rd Edition) and have also tried on Nokia 3500 (same gen). I use to stream video files from my memory card (E) on th phone itself. The videos are as large as 1-2 MB. |
| vishrutshukla |
| View Public Profile |
| Find all posts by vishrutshukla |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| S40 3rd - Memory Bug! | moamoa | Mobile Java General | 3 | 2008-08-31 23:43 |
| Can I streaming Video from internet on S60 3rd edition? | jianyu_21 | Mobile Java Media (Graphics & Sounds) | 8 | 2008-04-25 06:15 |
| Is there anybody who is interested in S40 3rd camera module? | ffee21 | Mobile Java Media (Graphics & Sounds) | 3 | 2006-02-12 08:42 |
| s40 - memory required for loading the classes | space2 | Mobile Java General | 2 | 2005-07-12 15:07 |
| can not successfully link any sample using .NET | lobotomat | Symbian Tools & SDKs | 2 | 2002-08-20 01:29 |