You Are Here:

Community: Developer Discussion Boards

#1 Old Writing a custom DataSource - 2006-07-13, 11:50

Join Date: May 2006
Posts: 48
Paranoid_Android
Offline
Registered User
Hello. I'm writing a custom datasource for streaming from an InputStream but I've a doubt:
Which is the class responsible for giving the support for streaming?It depends on the DataSource or it depends on the Player?
Or better..I know that a player does not support streaming,for example,from an InputStream.I can't pass an InputStream while it isn't complete so I began to write my own DataSource that manages the reading from the stream..but;
it's enought to write a custom DataSource or it depends also on how the Player is implemented?And if it depends on the player..what have I to do?
Have I to write a custom Player too..that begins to play before the reading from the stream is completed??

Thanks!!
Reply With Quote

#2 Old Re: Writing a custom DataSource - 2006-08-09, 11:20

Join Date: Aug 2006
Posts: 307
axs
Offline
Regular Contributor
The class which is extending DataSource is responsible for keeping media locator, content type and SourceStream(s). The class which is implementing SourceStream interface is responsible for data receiving (also known as protocol handling) through the provided InputStream(s). Actually, it is no matter how and through which mediums you read your data, as long as you can put it into the output buffer during the "read()" method invocation. And this is the main idea behind the DataSource: you take care about the data delivery mechanizm, and Player takes care about the use of your data (of course, if it supports your media's MIME type).

So, to create the Player, the Manager class uses your DataSource object 1) to define MIME type of the media, 2) connect to it and 3) get SourceStream(s) after successful connection. The Player uses SourceStream in a very simple way: it asks for the length of data, asks seek type and after all repeadetly calls "read()" method of the SourceStream object (in hope that you have prepeared data for it). Oh... and I forgot about the "tell()" method which tells your Player where it is now. This how things are working in the emulator-world. Now welcome to the real world.

Unfortunatelly not all Nokia mobile phones (should I say firmwares?) are able to correctly create Players from the DataSource objects. The reason is not just in your code, but in the way how Java VM is implemented. For example, on some Nokia phones the Player calls "read()" method of the SourceStream objects only once, and tries to put all the data into the memory during this single method invocation. This is not only makes a delay (imagine how long will take loading of 4Mb mp3 file into the memory by using mobile Java), but also will bring OutOfMemoryError at the final stage, when 2Mb heap memory will be finally filled out by the half of your 4Mb music file. It's just ugly, and it is not even close to the MMAPI specifications, where "read()" method returns chunks of data, and Player plays them immidiatelly. Firmware updates usually (and unfortunatelly) are not bringing any solutions to these problems. Such things stay the same for the other mobile vendors too :/
Last edited by axs : 2006-08-11 at 22:47.
Reply With Quote

#3 Old Re: Writing a custom DataSource - 2006-08-15, 01:50

Join Date: Mar 2006
Posts: 65
brokendove
Offline
Regular Contributor
I have got an article on custom datasource and streaming coming up on Java.net in the coming weeks. I will post here again when that is up.

Regards,
Vikram Goyal,
Pro MMAPI Book
http://www.mmapibook.com
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
CRichText and Custom fonts hansmeet2 Symbian User Interface 2 2006-11-15 18:56
Creating custom items crashes Nokia 6630 jvm handtems Mobile Java General 5 2006-06-20 16:21
How to insert CMyListbox in custom CMyDialog studnokia Symbian User Interface 0 2005-09-07 15:43
Custom item not displayed correctly kakoskin Mobile Java Media (Graphics & Sounds) 0 2004-10-11 22:50
How to make reliable connection between Nokia 6230 phone and a custom device Fii General Discussion 2 2004-07-17 11:11

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