| Reply | « Previous Thread | Next Thread » |
|
Hi
I've learnt through the forum that Nokia 6680 with older firmware cant play larger files. So i thought about streaming the file. The Nokia MMAPI tutorial suggests a way to stream file via HTTPConnection. I have tried to use the code on local file system with few changes as follows public InputStream urlToStream(String url) throws IOException { // Open connection to the http url... FileConnection connection = (FileConnection) Connector.open(url); DataInputStream dataIn = connection.openDataInputStream(); byte[] buffer = new byte[1024]; int read = -1; // Read the content from url. ByteArrayOutputStream byteout = new ByteArrayOutputStream(); while ((read=dataIn.read(buffer))>=0) { byteout.write(buffer, 0, read); } dataIn.close(); connection.close(); // Fill InputStream to return with content read from the URL. ByteArrayInputStream byteIn = new ByteArrayInputStream(byteout.toByteArray()); return byteIn; }} Instead of HTTPConnection, i'm using FileConnection. The above method returns the InputStream, which i use to create a player as follows. Player p = Manager.createPlayer(urlToStream("File:///..."),"audio/mpeg"); When i run the application on actual device, it asks for the read/write permission. The application, then waits for 3 to 4 seconds and exits. Please tell me if thats the right way or give me some other suggestion to play larger files (other than upgrading the firmware;-) ). Thanking in anticipation syson |
|
Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
Offline
Super Contributor
|
|
|
hi syson,
not sure what docs you are reffering, but 6680 does not have streaming support, also you can stream only via rstp or http depending on os version: from "Java Developer Library" (recent edition): Quote:
Peter |
| peterblazejewicz |
| View Public Profile |
| Find all posts by peterblazejewicz |
|
Hi Peter!
Thanks a million for sharing ur knowledge. As i mentioned in my first post, I'm just trying to develop an application which could play larger files even with small heap size. From ur message it seem impossible though :( Do u think there could be any other way of acheiving that end? Please give ur suggestion. Thanx syson |
|
Join Date: Dec 2005
Posts: 1,696
Location: Europe/Poland/Warsaw
Offline
Super Contributor
|
|
hello,
#1 maybe if you are responsible to provide music assets for that phone try to convert mp3 to AAC music file format (its available as compression format e.g. in PC Suite tool) - mime type "audio/aac", #2 try upgrading firmware version: http://discussion.forum.nokia.com/fo...light=6680+mp3 your issues coudl be related to firmware on phone, hth, regards, peter |
| peterblazejewicz |
| View Public Profile |
| Find all posts by peterblazejewicz |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| About the nokia doc: A MIDlet Example Using the Wireless Messaging API ... | SStefano | Mobile Java Tools & SDKs | 2 | 2008-04-03 20:02 |
| URGENT: File Upload problem on Nokia 6680 | eugeneleck | General Browsing | 0 | 2005-07-11 04:10 |
| Java Compability | emax73 | General Discussion | 0 | 2004-07-12 15:56 |
| does Nokia 6230 and 7200 support WB-AMR file and vdo streaming? | nogiafreak | Audio | 1 | 2003-11-28 14:13 |