You Are Here:

Community: Developer Discussion Boards

#1 Old Access to file with emulator - 2007-03-30, 10:00

Join Date: Jan 2007
Posts: 17
zidia
Offline
Registered User
Hi, I want to access to a audio file with carbide emulator but I'dont know where I must put it. I'm able to access to an image but with audio file don't work.

The code for image:
Code:
FileConnection fileConn = (FileConnection)Connector.open(imgName, Connector.READ);
            // load the image data in memory
            // Read data in CHUNK_SIZE chunks
            InputStream fis = fileConn.openInputStream();
            long overallSize = fileConn.fileSize();
            int length = 0;
            byte[] imageData = new byte[0];
            while (length < overallSize) {
                byte[] data = new byte[CHUNK_SIZE];
                int readAmount = fis.read(data, 0, CHUNK_SIZE);
                byte[] newImageData = new byte[imageData.length + CHUNK_SIZE];
                System.arraycopy(imageData, 0, newImageData, 0, length);
                System.arraycopy(data, 0, newImageData, length, readAmount);
                imageData = newImageData;
                length += readAmount;
            }
            fis.close();
            fileConn.close();
            if (length > 0) {
                currentImage = Image.createImage(imageData, 0, length);
            }
            
            //currentImage=zoomIn(currentImage);
            repaint();

Code for audio file:

Code:
 String url = "file:///E:/folder/file.amr";
 player = Manager.createPlayer(url);
All images and audio files are on C:\Nokia\Devices\Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S60_MIDP_Emulator\bin\Storage\Default\e\folder\
This work fine on device but not on emulator.

Thanks
Reply With Quote

#2 Old Re: Access to file with emulator - 2007-03-30, 10:42

Join Date: Oct 2005
Posts: 1,149
Location: Hyderabad,India
Priju Jacob Paul's Avatar
Priju Jacob Paul
Offline
Super Contributor
Quote:
Originally Posted by zidia
String url = "file:///E:/folder/file.amr";
player = Manager.createPlayer(url);
In the emulator E:\ is not present. Try placing the .amr file in c:\\nokia\\ and give this path onto your url.

Hope that helps.

Priju
Reply With Quote

#3 Old Re: Access to file with emulator - 2007-03-30, 11:16

Join Date: Jan 2007
Posts: 17
zidia
Offline
Registered User
Yes it is present into folder
C:\Nokia\Devices\Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S60_MIDP_Emulator\bin\Storage\Default\e\

This is the E:\\ on device.

I think there is an error while taking the InputStream because the url is correct while displaying an image.
Last edited by zidia : 2007-03-30 at 11:22.
Reply With Quote

#4 Old Re: Access to file with emulator - 2007-03-30, 11:52

Join Date: Jan 2007
Posts: 99
Location: Bangalore, India
khalandar
Offline
Regular Contributor
I feel this thread has the solution u are looking for. Even i ahve worked with CcarbideJ and S60 Emulator

http://discussion.forum.nokia.com/fo...d.php?t=102988


with regards,
Khalandar Pasha N
(khalandar_p@yahoo.co.in)
Reply With Quote

#5 Old Re: Access to file with emulator - 2007-04-02, 14:35

Join Date: Jan 2007
Posts: 17
zidia
Offline
Registered User
Thanks but this thread didn't help me.

I'putted both audio and image files into:
C:\Nokia\Devices\Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S60_MIDP_Emulator\bin\Storage\Default\e\myFolder\
and the urls are:

Code:
url="file:///E:/myFolder/a.amr"
url="file:///E:/myFolder/a.jpg"
but the emulator can create the InputStream only for images.
For audio I tried with
Code:
player = Manager.createPlayer(url);
and
Code:
FileConnection fileConn = FileConnection)Connector.open(url,Connector.READ);
InputStream fis = fileConn.openInputStream();
String ctype = "audio/amr";
player = Manager.createPlayer(fis,ctype);
and

Code:
InputStream is = this.getClass().getResourceAsStream(url);
Player player = Manager.createPlayer(is, "audio/amr");
but nothing.
Thanks
Reply With Quote

#6 Old Re: Access to file with emulator - 2007-04-03, 07:06

Join Date: Jan 2007
Posts: 99
Location: Bangalore, India
khalandar
Offline
Regular Contributor
Quote:
Originally Posted by zidia
Code:
InputStream is = this.getClass().getResourceAsStream(url);
Player player = Manager.createPlayer(is, "audio/amr");
What is the exception its giving here?
Ur using Eclipse or Netbeans?
I have the code for WTK2.5 if u want can share it with you??


with regards,
Khalandar Pasha N
(khalandar_p@yahoo.co.in)
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
Theme Studio 3.1 not creating themes zemm Themes/Carbide.ui 11 2008-10-18 09:41
S60 theme questions Nokian_Spb Symbian Media (Graphics & Sounds) 3 2006-08-17 07:11
Tips on using NDS 1.1 mitts Symbian Tools & SDKs 7 2006-01-18 17:07
9210 emulator: Internet access advanced settings crashes twaltari Symbian Tools & SDKs 0 2002-09-02 08:37
how can I open and test a compiled help file in the nokia 9210 emulator? rubyyogaswara Symbian Tools & SDKs 0 2002-08-29 06:09

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