You Are Here:

Community: Developer Discussion Boards

#1 Old openInputStream - 2007-04-13, 23:56

Join Date: Apr 2007
Posts: 7
neilruparel
Offline
Registered User
i have used the following code in a file browser, to look for a song through the file directory, and select a file:

try {
if (fileName.endsWith(".mp3") || fileName.endsWith(".amr") || fileName.endsWith(".wma"))
{
is = null;
FileConnection fc =
(FileConnection)Connector.open("file://localhost/" + currDirName + fileName);
is = fc.openInputStream();
midlet.getDisplay().setCurrent(midlet.get_mp3PlayerForm());


and the following code to play the selected file:

private void doPlay() {
try {
player = Manager.createPlayer(fileConnection.get_IS(), "audio/amr");
player.prefetch();
player.start();
} catch (IOException x) {
x.printStackTrace();

With this coding, i am getting different outcomes on different phones.

On Nokia N70, there is 15second wait before the song starts playing.
On Nokia N91, the song does not play at all.
On Sony K800i, the song plays immediately.

I feel this has something to do with the openOutputStream method.
Can somebody please help me with this.
Thanks,
Neil
Reply With Quote

#2 Old Re: openInputStream - 2007-04-16, 08:25

Join Date: Aug 2006
Posts: 307
axs
Offline
Regular Contributor
Probably the reason is in the progressive loading feature which is available on most Sony Ericsson mobile phones, and on some N-series mobile phones from Nokia.

IMHO the best way to create a player for the multi-platformed J2ME application is by providing Manager with the file URI only. In many cases the mobile platform is able to play files immediatelly and optimize playback speeds only through the URI interface.
Reply With Quote

#3 Old Re: openInputStream - 2007-04-16, 12:44

Join Date: Dec 2004
Posts: 184
shaii
Offline
Regular Contributor
i agree with axs
not to mention "audio/amr" as a content type may not work for all 3 file format u selected across platforms (like nokia had problems audio/x-wav on some phones and used audio/wav)
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
openinputstream() returns null linne345 Mobile Java Networking & Messaging & Security 1 2006-06-08 16:16
openinputstream Huack Mobile Java Networking & Messaging & Security 2 2005-08-16 16:33
HttpConnection in Nokia6600 sujithkumar Mobile Java Networking & Messaging & Security 4 2005-01-02 16:40
Trouble using openInputStream() with Nokia 12 fpaaske Nokia M2M 5 2004-04-28 20:20
7650 openInputStream throws exception -20015 antmanes Mobile Java General 5 2003-04-07 02:17

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ